Bring better sortOrder for my repos back
This commit is contained in:
parent
708c738e5d
commit
cbbd555fdd
|
@ -107,7 +107,7 @@ Repo = Model.extend
|
|||
duration
|
||||
).property('_lastBuildDuration', 'lastBuildStartedAt', 'lastBuildFinishedAt')
|
||||
|
||||
sortOrder: (->
|
||||
sortOrderForLandingPage: (->
|
||||
state = @get('lastBuildState')
|
||||
if state != 'passed' && state != 'failed'
|
||||
0
|
||||
|
@ -115,6 +115,14 @@ Repo = Model.extend
|
|||
parseInt(@get('lastBuildId'))
|
||||
).property('lastBuildId', 'lastBuildState')
|
||||
|
||||
sortOrder: (->
|
||||
# cuz sortAscending seems buggy when set to false
|
||||
if lastBuildFinishedAt = @get('lastBuildFinishedAt')
|
||||
- new Date(lastBuildFinishedAt).getTime()
|
||||
else
|
||||
- new Date('9999').getTime() - parseInt(@get('lastBuildId'))
|
||||
).property('lastBuildFinishedAt', 'lastBuildId')
|
||||
|
||||
stats: (->
|
||||
if @get('slug')
|
||||
@get('_stats') || $.get("https://api.github.com/repos/#{@get('slug')}", (data) =>
|
||||
|
|
|
@ -16,7 +16,7 @@ Route = BasicRoute.extend
|
|||
withExternal: Ember.computed.union('repos', 'external')
|
||||
sorted: Ember.computed.sort('withExternal', 'sortedReposKeys')
|
||||
content: limit('sorted', 'limit')
|
||||
sortedReposKeys: ['sortOrder:desc']
|
||||
sortedReposKeys: ['sortOrderForLandingPage:desc']
|
||||
limit: 3
|
||||
).create()
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user