Store when a game was last updated
This commit is contained in:
parent
dd8ffa052d
commit
2b133d3ed6
|
@ -168,6 +168,7 @@ Game.prototype.init = function () {
|
|||
this.remainingLetters = this.bag.length;
|
||||
this.racks = {};
|
||||
this.scores = {};
|
||||
this.lastUpdated = new Date();
|
||||
};
|
||||
|
||||
Game.prototype.toJSON = function () {
|
||||
|
@ -176,7 +177,8 @@ Game.prototype.toJSON = function () {
|
|||
board: this.board,
|
||||
bag: this.bag,
|
||||
racks: this.racks,
|
||||
scores: this.scores
|
||||
scores: this.scores,
|
||||
lastUpdated: this.lastUpdated.toISOString()
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -187,6 +189,7 @@ Game.fromJSON = function (obj) {
|
|||
game.remainingLetters = obj.remainingLetters || game.bag.length;
|
||||
game.racks = obj.racks || {};
|
||||
game.scores = obj.scores || {};
|
||||
game.lastUpdated = obj.lastUpdated ? new Date(obj.lastUpdated) : new Date();
|
||||
return game;
|
||||
};
|
||||
|
||||
|
@ -407,6 +410,8 @@ function handleCommand(cmd, gameNumber, playerName, response) {
|
|||
return;
|
||||
}
|
||||
|
||||
game.lastUpdated = new Date();
|
||||
|
||||
var rack = null;
|
||||
|
||||
switch (cmd.cmd) {
|
||||
|
|
Loading…
Reference in New Issue