Make sorting more in line with what we will do on a server
This commit is contained in:
parent
ef9b5d8646
commit
ce8237b4e7
|
@ -107,12 +107,17 @@ require 'travis/model'
|
||||||
).property('_lastBuildDuration', 'lastBuildStartedAt', 'lastBuildFinishedAt')
|
).property('_lastBuildDuration', 'lastBuildStartedAt', 'lastBuildFinishedAt')
|
||||||
|
|
||||||
sortOrder: (->
|
sortOrder: (->
|
||||||
# cuz sortAscending seems buggy when set to false
|
# this is prepared for ascending sort
|
||||||
if lastBuildFinishedAt = @get('lastBuildFinishedAt')
|
if Ember.isNone(@get('lastBuildFinishedAt')) && @get('lastBuildStartedAt')
|
||||||
- new Date(lastBuildFinishedAt).getTime()
|
# if a build is running, it should be at the beginning
|
||||||
|
0
|
||||||
|
else if lastBuildStartedAt = @get('lastBuildStartedAt')
|
||||||
|
# if it's not running, but was already run, put newest builds first
|
||||||
|
new Date('9999').getTime() - Date.parse(lastBuildStartedAt)
|
||||||
else
|
else
|
||||||
- new Date('9999').getTime() - parseInt(@get('lastBuildId'))
|
# if it's not started nor it was ran before, sort with newest id first
|
||||||
).property('lastBuildFinishedAt', 'lastBuildId')
|
new Date('9999').getTime() - @get('id')
|
||||||
|
).property('lastBuildFinishedAt', 'id', 'lastBuildStartedAt')
|
||||||
|
|
||||||
stats: (->
|
stats: (->
|
||||||
if @get('slug')
|
if @get('slug')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user