Skip to content

Commit

Permalink
refs #43 Add push message type for RESET.
Browse files Browse the repository at this point in the history
  • Loading branch information
truedat101 committed Oct 23, 2013
1 parent fdcb197 commit fb623e4
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,8 @@ exports.handleAllMessagesGet = function(req, res) {

reset = function() {
oldGame = game;
game = new Game();
game = new Game(); // XXX Point to ponder, do we need to save before we destroy the server?
game.setCurrentMessage(message);
};

exports.handleResetGet = function(req, res) {
Expand Down Expand Up @@ -413,21 +414,24 @@ exports.handlePushMessage = function(req, res) {
// Ignoring the message does not have a type
console.warn("Unrecognized type: " + type);
break;
case 'RE_TAKE':
game.setCurrentMessage(message);
error = game.retake();
break;
case 'QUESTION':
error = game.addQuestion(message);
break;
case 'QUESTION_PIC':
error = game.addQuestion(message);
break;
case 'ANSWER':
error = game.registerAnswerByMessage(message);
break;
case 'HAIL':
error = game.studentsWrapper.addStudent(message);
break;
case 'ANSWER':
error = game.registerAnswerByMessage(message);
case 'RE_TAKE':
game.setCurrentMessage(message);
error = game.retake();
break;
case 'RESET':
game.setCurrentMessage({ TYPE: 'RESET'});
break;
default:
error = new Error("Unrecognized type: " + type);
Expand Down

0 comments on commit fb623e4

Please sign in to comment.