travis-web/assets/scripts/app/utils/duration_calculations.coffee
2015-01-20 12:15:12 +01:00

19 lines
523 B
CoffeeScript

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