Add Student Sonar backend code.

Review Request #6896 — Created Feb. 3, 2015 and submitted

Information

student-sonar
master
d5477b4...

Reviewers

This contains several pieces:

  • server.js and lib/routes.js define the basic web server side of things. There
    are currently a few API endpoints, and navigating to / will deliver an HTML
    page (which is included in the frontend change).
  • lib/slack.js has code to query our Slack logs from Amazon DynamoDB, as well
    as get the user list from the Slack API.
  • lib/students.js has code to load the students.json file as well as merge in
    Slack avatars.
  • lib/reviewboard.js has code to query the Review Board API.

Exercised all of this via the frontend.

Description From Last Updated

With ES6 let, you don't need to declare your variables at the top of the functions anymore. Just declare when …

mike_conleymike_conley

If you're going full-on ES6, I think you can use for-of: for (let item of logs.Items) { // ... } …

mike_conleymike_conley

Worth pulling this port number from the config.js file as well?

mike_conleymike_conley
reviewbot
  1. Tool: Pyflakes
    Ignored Files:
        lib/students.js
        lib/routes.js
        lib/reviewboard.js
        server.js
        lib/slack.js
    
    
    
    Tool: PEP8 Style Checker
    Ignored Files:
        lib/students.js
        lib/routes.js
        lib/reviewboard.js
        server.js
        lib/slack.js
    
    
  2. 
      
mike_conley
  1. 
      
  2. lib/routes.js (Diff revision 1)
     
     
     
     
     
     
    Show all issues

    With ES6 let, you don't need to declare your variables at the top of the functions anymore. Just declare when you need them.

  3. lib/routes.js (Diff revision 1)
     
     
    Show all issues

    If you're going full-on ES6, I think you can use for-of:

    for (let item of logs.Items) {
      // ...
    }
    

    Alternatively, since you're mapping from the log items to an array of results, I think you could use:

    let result = logs.Items.map(function(item) {
      let timestamp = moment.unix(parseFloat(item.timestamp.S)).startOf('day');
      return {
        channel_name: item.channel_name.S,
        text: item.text.S,
        timestamp: timestamp.unix()
      };
    });
    
    1. D'oh - I forgot we were on the server-side here.

  4. server.js (Diff revision 1)
     
     
    Show all issues

    Worth pulling this port number from the config.js file as well?

  5. 
      
david
reviewbot
  1. Tool: Pyflakes
    Ignored Files:
        lib/students.js
        lib/routes.js
        lib/reviewboard.js
        server.js
        lib/slack.js
    
    
    
    Tool: PEP8 Style Checker
    Ignored Files:
        lib/students.js
        lib/routes.js
        lib/reviewboard.js
        server.js
        lib/slack.js
    
    
  2. 
      
mike_conley
  1. Ship It!
  2. 
      
david
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to master (4c0f191)
Loading...