travis-web/assets/scripts/app/models/extensions.coffee
Piotr Sarnacki e045ab7481 Remove check of model state in DurationCalculation
We no longer need this check, because it was only relevant with Ember
Data. Additionally it was a cause of a travis-ci/travis-ci#1992, because
of wrong syntax:

    unless someFunction false or true

will only check for a result of someFunction with an argument being the
result of `or` expression.
2014-06-20 15:47:37 +02:00

13 lines
382 B
CoffeeScript

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