Don't return finishedAt, startedAt, duration for not started jobs/builds
This commit is contained in:
parent
e045ab7481
commit
6cb866408d
|
@ -10,8 +10,8 @@ require 'travis/model'
|
|||
message: Ember.attr('string')
|
||||
_duration: Ember.attr(Number, key: 'duration')
|
||||
_config: Ember.attr('object', key: 'config')
|
||||
startedAt: Ember.attr('string')
|
||||
finishedAt: Ember.attr('string')
|
||||
_startedAt: Ember.attr('string', key: 'started_at')
|
||||
_finishedAt: Ember.attr('string', key: 'finished_at')
|
||||
pullRequest: Ember.attr('boolean')
|
||||
pullRequestTitle: Ember.attr('string')
|
||||
pullRequestNumber: Ember.attr(Number)
|
||||
|
@ -36,6 +36,20 @@ require 'travis/model'
|
|||
@get('state') in ['passed', 'failed', 'errored', 'canceled']
|
||||
).property('state')
|
||||
|
||||
notStarted: (->
|
||||
@get('state') in ['queued', 'created']
|
||||
).property('state')
|
||||
|
||||
startedAt: (->
|
||||
unless @get('notStarted')
|
||||
@get('_startedAt')
|
||||
).property('_startedAt')
|
||||
|
||||
finishedAt: (->
|
||||
unless @get('notStarted')
|
||||
@get('_finishedAt')
|
||||
).property('_finishedAt')
|
||||
|
||||
requiredJobs: (->
|
||||
@get('jobs').filter (data) -> !data.get('allowFailure')
|
||||
).property('jobs.@each.allowFailure')
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
Travis.DurationCalculations = Ember.Mixin.create
|
||||
duration: (->
|
||||
if duration = @get('_duration')
|
||||
if @get('notStarted')
|
||||
null
|
||||
else if duration = @get('_duration')
|
||||
duration
|
||||
else
|
||||
Travis.Helpers.durationFrom(@get('startedAt'), @get('finishedAt'))
|
||||
|
|
|
@ -9,8 +9,8 @@ require 'travis/model'
|
|||
queue: Ember.attr('string')
|
||||
state: Ember.attr('string')
|
||||
number: Ember.attr('string')
|
||||
startedAt: Ember.attr('string')
|
||||
finishedAt: Ember.attr('string')
|
||||
_startedAt: Ember.attr('string', key: 'started_at')
|
||||
_finishedAt: Ember.attr('string', key: 'finished_at')
|
||||
allowFailure: Ember.attr('boolean')
|
||||
|
||||
repositorySlug: Ember.attr('string')
|
||||
|
@ -27,6 +27,16 @@ require 'travis/model'
|
|||
Travis.Log.create(job: this)
|
||||
).property()
|
||||
|
||||
startedAt: (->
|
||||
unless @get('notStarted')
|
||||
@get('_startedAt')
|
||||
).property('_startedAt')
|
||||
|
||||
finishedAt: (->
|
||||
unless @get('notStarted')
|
||||
@get('_finishedAt')
|
||||
).property('_finishedAt')
|
||||
|
||||
repoSlug: (->
|
||||
@get('repositorySlug')
|
||||
).property('repositorySlug')
|
||||
|
@ -39,6 +49,10 @@ require 'travis/model'
|
|||
@get('state') in ['passed', 'failed', 'errored', 'canceled']
|
||||
).property('state')
|
||||
|
||||
notStarted: (->
|
||||
@get('state') in ['queued', 'created']
|
||||
).property('state')
|
||||
|
||||
clearLog: ->
|
||||
# This is needed if we don't want to fetch log just to clear it
|
||||
if @get('isLogAccessed')
|
||||
|
|
Loading…
Reference in New Issue
Block a user