travis-web/assets/scripts/app/models/extensions.coffee
Piotr Sarnacki 2ccade46a4 Fix some of the issues with duration sometimes not showing up
* duration was not actually defined in Travis.Job, which may have caused
  bugs when combined with partial record loading (so for example it was
  ok on a refresh, but may have been broken on update)
* notStarted was not a dependency of duration
2014-08-14 22:39:49 +02:00

15 lines
438 B
CoffeeScript

Travis.DurationCalculations = Ember.Mixin.create
duration: (->
if @get('notStarted')
null
else if duration = @get('_duration')
duration
else
Travis.Helpers.durationFrom(@get('startedAt'), @get('finishedAt'))
).property('_duration', 'finishedAt', 'startedAt', 'notStarted')
updateTimes: ->
unless @get('isFinished')
@notifyPropertyChange '_duration'
@notifyPropertyChange 'finished_at'