sort branches by date

This commit is contained in:
Lisa P 2015-09-15 15:39:36 +02:00
parent b5648b864b
commit 4dc5c03077

View File

@ -16,26 +16,16 @@ BranchesController = Ember.Controller.extend
repos = repos.filter (item, index) ->
console.log(item)
item if item.exists_on_github == true && item.repository.default_branch.name != undefined
.sort (a, b) ->
# if a.last_build && b.last_build
# if a.last_build.finished_at == null
# return 1
# else
# if a.last_build.finished_at > b.last_build.finished_at
# return -1
# else if a.last_build.finished_at < b.last_build.finished_at
# return 1
# else
# return 0
# else
# return -1
.sortBy('last_build.finished_at')
.reverse()
).property('model')
inactiveBranches: (->
repos = @get('model')
repos = repos.filter (item, index) ->
item if item.exists_on_github == false
.sortBy('last_build.finished_at')
.reverse()
).property('model')
`export default BranchesController`