From 4dc5c030774a254beba76ce375973fd2a17c7759 Mon Sep 17 00:00:00 2001 From: Lisa P Date: Tue, 15 Sep 2015 15:39:36 +0200 Subject: [PATCH] sort branches by date --- app/controllers/branches.coffee | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/app/controllers/branches.coffee b/app/controllers/branches.coffee index 9a80c996..d5630011 100644 --- a/app/controllers/branches.coffee +++ b/app/controllers/branches.coffee @@ -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`