Question

Pls help me with this Node Js homework. First implement this ejs file. Check out the...

Pls help me with this Node Js homework.

First implement this ejs file. Check out the TODO section and implement it.

Given:

ejs file:

<% include ../partials/header %>
<% include ../partials/menu %>
   <div class="container">
       <br>
       <div class="jumbotron">
       <h1 class="display-4">Fall 2018 Stats</h1>
       <p class="lead">Detailed information on how the Buffs are doing in the 2018 Football Season!</p>
       </div>
      
       <table class="table table-bordered" id="stats_table">
           <tr>
               <th class="align-bottom" rowspan="2">Game Date</th>
               <th class="align-bottom"rowspan="2">Opposing Team Name</th>
               <th class="text-center" colspan="2">Score</th>
               <th class="align-bottom" rowspan="2">Winner</th>
           </tr>
           <tr>
               <th>Home Score</th>
               <th>Opp. Score</th>
           </tr>
           <!-- TODO: Iterate over the Football_table data here
                       1. Display the information for each row (date, name, home score, visitor score)
                       2. Determine who the winner is and display it in the final column

                       If you're not sure how the logic should work here, review the code you add to the client-side javascript
                       that ran onload for Lab 5. We are doing the same kind of operations we had in Lab 5, but we are instead having
                       everything handled via server-side scriptes
           -->
          
       </table>
       <br>
       <table class="table text-center">
           <tr>
               <th>Wins</th>
               <th>Losses</th>
           </tr>
           <tr>
               <td> <!-- TODO: Display the total number of wins here.
                           This value should come from your server.js files query, don't calculate it in this file! --></td>
               <td> <!-- TODO: Display the total number of losses here.
                           This value should come from your server.js files query, don't calculate it in this file! --></td>
           </tr>
       </table>
      
   </div>
<% include ../partials/footer %>

Then complete the query function for me:

requirements:

    /team_stats - get request (no parameters)
           This route will require no parameters. It will require 3 postgres queries which will:
               1. Retrieve all of the football games in the Fall 2018 Season
               2. Count the number of winning games in the Fall 2018 Season
               3. Count the number of lossing games in the Fall 2018 Season
           The three query results will then be passed onto the team_stats view (pages/team_stats).
           The team_stats view will display all fo the football games for the season, show who won each game,
           and show the total number of wins/losses for the season.

What I got:

app.get('/team_stats',function(req,res){
//sql statement
//exeucute
//result to render data
res.render('pages/team_stats',{
my_title:"Team stats"
})

});

0 0
Add a comment Improve this question Transcribed image text
Answer #1

ejs file:

<% include ../partials/header %>
<% include ../partials/menu %>
   <div class="container">
       <br>
       <div class="jumbotron">
       <h1 class="display-4">Fall 2018 Stats</h1>
       <p class="lead">Detailed information on how the Buffs are doing in the 2018 Football Season!</p>
       </div>
      
       <table class="table table-bordered" id="stats_table">
           <tr>
               <th class="align-bottom" rowspan="2">Game Date</th>
               <th class="align-bottom"rowspan="2">Opposing Team Name</th>
               <th class="text-center" colspan="2">Score</th>
               <th class="align-bottom" rowspan="2">Winner</th>
           </tr>
           <tr>
               <th>Home Score</th>
               <th>Opp. Score</th>
           </tr>
           <!-- TODO: Iterate over the Football_table data here
                       1. Display the information for each row (date, name, home score, visitor score)
                       2. Determine who the winner is and display it in the final column

                       If you're not sure how the logic should work here, review the code you add to the client-side javascript
                       that ran onload for Lab 5. We are doing the same kind of operations we had in Lab 5, but we are instead having
                       everything handled via server-side scriptes
           -->
          
       </table>
       <br>
       <table class="table text-center">
           <tr>
               <th>Wins</th>
               <th>Losses</th>
           </tr>
           <tr>
               <td> <!-- TODO: Display the total number of wins here.
                           This value should come from your server.js files query, don't calculate it in this file! --></td>
               <td> <!-- TODO: Display the total number of losses here.
                           This value should come from your server.js files query, don't calculate it in this file! --></td>
           </tr>
       </table>
      
   </div>
<% include ../partials/footer %>

Then complete the query function for me:

requirements:

    /team_stats - get request (no parameters)
           This route will require no parameters. It will require 3 postgres queries which will:
               1. Retrieve all of the football games in the Fall 2018 Season
               2. Count the number of winning games in the Fall 2018 Season
               3. Count the number of lossing games in the Fall 2018 Season
           The three query results will then be passed onto the team_stats view (pages/team_stats).
           The team_stats view will display all fo the football games for the season, show who won each game,
           and show the total number of wins/losses for the season.

What I got:

app.get('/team_stats',function(req,res){
//sql statement
//exeucute
//result to render data
res.render('pages/team_stats',{
my_title:"Team stats"
})

});

Add a comment
Know the answer?
Add Answer to:
Pls help me with this Node Js homework. First implement this ejs file. Check out the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Hello Ive been tryting to add the CDN of jquery to my html code and I...

    Hello Ive been tryting to add the CDN of jquery to my html code and I keep getting an error Need help with this : ​​ Navigate to www.code.jquery.com in your Chrome browser. On this page, you'll find different stable versions of jQuery. Select uncompressed for jQuery Core 3.3.1. Copy the <script> tag that is given to you. In store_hours.html, paste that tag directly above your body's closing tag. This is the jQuery CDN. After you paste this code into...

  • I need HELP to get the code to do these function: If I keep clicking "Generate"...

    I need HELP to get the code to do these function: If I keep clicking "Generate" multiple times, the list keeps on getting bigger. The number of rows should always be equal to the number of columns. Also make the code to show both table at the same time? Here is the code I got some far : Code: <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <title>Testing</title> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous"> </head> <style> td...

  • Hi, trying to arrange the fourth photo under media tab for a mock web page. I'm...

    Hi, trying to arrange the fourth photo under media tab for a mock web page. I'm trying to figure out how to get the 'planned stadium' photo to be shifted to the right and parallel to the 'Ground View 2018' picture. Below is the attached code and thanks for your help: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <meta name="author" content="Ian Kusnadi" /> <title>Tottenham Spurs Fan Page</title> </head> <style type="text/css"> a:link...

  • Could someone please help me write this in Python? If time allows, it you could include...

    Could someone please help me write this in Python? If time allows, it you could include comments for your logic that would be of great help. This problem involves writing a program to analyze historical win-loss data for a single season of Division I NCAA women's basketball teams and compute from this the win ratio for each team as well as the conference(s) with the highest average win ratio. Background Whether it's football, basketball, lacrosse, or any other number of...

  • In a seperate javascript file This step in brewing beer is to extract sugars from grains by soaking the grains in hot wate a different wor 3. JavaSeript/DOM Background: The first amount of sugar...

    In a seperate javascript file This step in brewing beer is to extract sugars from grains by soaking the grains in hot wate a different wor 3. JavaSeript/DOM Background: The first amount of sugar (the grain's yield) to the wort. Calculating the final amount of sugar in the wort is an imp ing a beer recipe, since the sugars will later ferment into alcohol. To measure the amount of sugar in designi step is called mashing, and the resulting sugar-water...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT