This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var _ = require('underscore'); | |
| var Q = require('q'); | |
| var EligibleForSportsEnrollmentPolicy = function( student ) { | |
| this.student = student; | |
| }; | |
| EligibleForSportsEnrollmentPolicy.prototype = _.extend( EligibleForSportsEnrollmentPolicy.prototype, { | |
| run: function() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var expect = require('chai').expect | |
| var GradeReportPresenter = require('./gradeReportPresenter') | |
| var Grade = require('./grade') | |
| describe('GradeReportPresenter', function(){ | |
| before(function(){ | |
| this.student = { | |
| id: '123456', | |
| firstName: 'Susan', | |
| lastName: 'Smith', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| new CurrentStudentsWithAssignmentsQuery().run() | |
| .then(function( students ) { | |
| return new StudentGradeReportPresenter( students ).present(); | |
| }) | |
| .then(function( students ) { | |
| res.render('reportCard', students); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var _ = require('underscore'); | |
| var DetermineStudentPassingStatus = require('./determineStudentPassingStatus'); | |
| var GetAverageGradeFromAssignments = require('./getAverageGradeFromAssignments'); | |
| var GradeReportPresenter = function(student) { | |
| this.student = student | |
| } | |
| GradeReportPresenter.prototype = _.extend(GradeReportPresenter.prototype, { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "id": "123456", | |
| "firstName": "Susan", | |
| "lastName": "Smith", | |
| "gender": "f", | |
| "phone": "5551234567", | |
| "assignments": [ | |
| { | |
| "grade": 0.65 | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var expect = require('chai').expect; | |
| var CreateStudentQuery = require('./createStudentQuery'); | |
| describe('CreateStudentQuery', function(){ | |
| before(function(done){ | |
| this.student = { | |
| first_name: 'John', | |
| last_name: 'Smith', | |
| gender: 'M' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var CreateStudent = function(student) { | |
| this.student = student | |
| } | |
| CreateStudent.prototype = _.extend(CreateStudent.prototype, { | |
| run: function() { | |
| ... | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var _ = require('underscore') | |
| var async = require('async') | |
| var MongoClient = require('mongodb').MongoClient | |
| var CreateStudentQuery = function(student) { | |
| this.student = student | |
| } | |
| CreateStudentQuery.prototype = _.extend(CreateStudentQuery, { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var MongoClient = require('mongodb').MongoClient | |
| var createStudentQuery = function(student, callback) { | |
| MongoClient.connect('mongodb://127.0.0.1:27017/test', function(err, db) { | |
| if (err) throw err; | |
| var collection = db.collection('students'); | |
| collection.insert(student, function(err, docs) { | |
| collection.find().toArray(function(err, result) { |