Permalink
Browse files

unifies lap count appearance - no more ghost lap times

  • Loading branch information...
1 parent 69675c1 commit c55f8146c3bd2c965a02854be020b556fbf553ea @tombu tombu committed Apr 29, 2012
View
3 app/assets/javascripts/slotcars/play/controllers/game_controller.js.coffee
@@ -52,6 +52,9 @@ Play.GameController = Shared.BaseGameController.extend
).observes 'car.crossedFinishLine'
onLapChange: (->
+ # prevent taking time when lap number changes from 0 to 1
+ return unless (@car.get 'currentLap') > 1
+
lapTimes = @get 'lapTimes'
sum = lapTimes.reduce (previous, current) ->
previous + current
View
2 app/assets/javascripts/slotcars/shared/models/track.js.coffee
@@ -67,7 +67,7 @@ Shared.Track = DS.Model.extend Shared.IdObservable,
# clamp return value to maximum number of laps
if lap > numberOfLaps then lap = numberOfLaps
- if lap is 0 then return 1 else return lap
+ return lap
rasterize: (finishCallback) ->
@set 'isRasterizing', true

0 comments on commit c55f814

Please sign in to comment.