Skip to content

Commit

Permalink
Record number of games played.
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmycuadra committed Nov 4, 2012
1 parent 207e10c commit 1f1b8b3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion source/javascripts/models/store.js.coffee
Expand Up @@ -8,6 +8,7 @@ class ph.Store extends Backbone.Model


initialize: -> initialize: ->
@set(currentTime: 0) @set(currentTime: 0)
@set(gamesPlayed: @get("gamesPlayed") + 1)
@on("change", @persist, this) @on("change", @persist, this)
@timer = new Timer @timer = new Timer
@timer.every(1, @addTick) @timer.every(1, @addTick)
Expand All @@ -25,7 +26,7 @@ class ph.Store extends Backbone.Model
resetStats: -> resetStats: ->
if confirm "Are you sure you want to permanently reset your stats?" if confirm "Are you sure you want to permanently reset your stats?"
@timer.reset() @timer.reset()
@set(highScore: 0, gamesPlayed: 0, currentTime: 0, totalTime: 0) @set(highScore: 0, gamesPlayed: 1, currentTime: 0, totalTime: 0)
@timer.start() @timer.start()


addTick: => addTick: =>
Expand Down
2 changes: 1 addition & 1 deletion source/javascripts/templates/stats.hamlc
Expand Up @@ -24,4 +24,4 @@
%td 0 %td 0
%td 0 %td 0
%td= @formatTime(@totalTime) %td= @formatTime(@totalTime)
%td 0 %td= @gamesPlayed

0 comments on commit 1f1b8b3

Please sign in to comment.