Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 2 commits
  • 4 files changed
  • 0 comments
  • 1 contributor
2  app.js
@@ -5,7 +5,7 @@ var express = require('express')
5 5 , routes = require('./routes')
6 6 , app = module.exports = express.createServer();
7 7
8   -var ProfileDAO = require('./profileDAO').ProfileDAO;
  8 +var ProfileDAO = require('./lib/profileDAO').ProfileDAO;
9 9 var profileDAO = new ProfileDAO('localhost', 27017);
10 10
11 11 // Configuration
48 profileDAO.js
... ... @@ -1,48 +0,0 @@
1   -var Db = require('mongodb').Db;
2   -var Connection = require('mongodb').Connection;
3   -var Server = require('mongodb').Server;
4   -
5   -ProfileDAO = function(host, port) {
6   - this.db = new Db('test', new Server(host, port, {auto_reconnect: true}, {}));
7   - this.db.open(function(){});
8   -};
9   -
10   -ProfileDAO.prototype.getCollection = function(callback) {
11   - this.db.collection('whoville_timeline', function(error, profile_collection) {
12   - if (error) callback(error);
13   - else callback(null, profile_collection);
14   - });
15   -};
16   -
17   -/**
18   - * returns array of ALL profiles in JSON form
19   - */
20   -ProfileDAO.prototype.findAll = function(callback) {
21   - this.getCollection(function(error, profile_collection) {
22   - if (error) callback(error);
23   - else {
24   - profile_collection.find().toArray(function(error, results) {
25   - if (error) callback(error);
26   - else callback(null, results);
27   - });
28   - }
29   - });
30   -};
31   -
32   -/**
33   - * returns array of user profiles in JSON form
34   - * requires valid id
35   - */
36   -ProfileDAO.prototype.findById = function(id, callback) {
37   - this.getCollection(function(error, profile_collection) {
38   - if (error) callback(error);
39   - else {
40   - profile_collection.find({id: id}).toArray(function(error, result) {
41   - if (error) callback(error);
42   - else callback(null, result);
43   - });
44   - }
45   - });
46   -};
47   -
48   -exports.ProfileDAO = ProfileDAO;
3  public/javascripts/views/graph.js
@@ -13,7 +13,8 @@ App.Views.Graph = Backbone.View.extend({
13 13 },
14 14
15 15 render: function() {
16   - this.drawGraph( this.computeData() );
  16 + // draw graph with reversed data so Date will be descending
  17 + this.drawGraph( this.computeData().reverse() );
17 18 },
18 19
19 20 computeData: function() {
6 views/timeline.jade
... ... @@ -1,6 +0,0 @@
1   -h1= title
2   -- each profile in profiles
3   - div.profile
4   - div.date= profile.date
5   - div.id
6   - p #{profile.id}

No commit comments for this range

Something went wrong with that request. Please try again.