Difference between revisions of "WebFund 2016W: Tutorial 6"

From Soma-notes
Jump to navigation Jump to search
Line 1: Line 1:
In this tutorial you'll be playing with [http://homeostasis.scs.carleton.ca/~soma/webfund-2016w/code/graph-demo.zip graph-demo].  This code is similar to form-demo; however, now there are survey questions that are being asked with the results graphed.
In this tutorial you'll be playing with [http://homeostasis.scs.carleton.ca/~soma/webfund-2016w/code/graph-demo.zip graph-demo].  This code is similar to form-demo; however, now there are survey questions that are being asked with the results graphed.
To run the code, run "bin/www".


To complete this tutorial successfully, do the following:
To complete this tutorial successfully, do the following:
Line 6: Line 8:


Optional: Make the graphs fancier!
Optional: Make the graphs fancier!
===Hints===
* Object.keys() gives you the "enumerable" keys (properties) of any object.  Note that it does not get the keys from any prototypes.  So
  Object.keys(obj).forEach(function(key) {console.log(key);});
should print out all of the properties of obj.

Revision as of 16:59, 2 March 2016

In this tutorial you'll be playing with graph-demo. This code is similar to form-demo; however, now there are survey questions that are being asked with the results graphed.

To run the code, run "bin/www".

To complete this tutorial successfully, do the following:

  • Fix the /add callback so it saves the answer to all the questions and calcResultsStats() so it reports the results of questions answered rather than the dummy data hard coded into the app.
  • Store the answers in MongoDB. Store them in a database called "graph-demo" in a collection called "answers". Each document should just be an answer object. (MongoDB of course will add an ID field.)

Optional: Make the graphs fancier!

Hints

  • Object.keys() gives you the "enumerable" keys (properties) of any object. Note that it does not get the keys from any prototypes. So
 Object.keys(obj).forEach(function(key) {console.log(key);}); 

should print out all of the properties of obj.