
Because of our partial loading implementation we need to specify finishedAt and startedAt differently than we would normally do. For some reason duration was not recalculated while loading record and specifying raw attributes helps here.
15 lines
467 B
CoffeeScript
15 lines
467 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', '_finishedAt', '_startedAt')
|
|
|
|
updateTimes: ->
|
|
unless @get('isFinished')
|
|
@notifyPropertyChange '_duration'
|
|
@notifyPropertyChange 'finished_at'
|