From b348ee0e4057534abdd885235ee3124a5ae4a1ab Mon Sep 17 00:00:00 2001 From: Sven Fuchs Date: Tue, 14 Oct 2014 15:20:14 +0200 Subject: [PATCH] Revert "Make sorting more in line with what we will do on a server" This makes the timeline ordering odd when restarting: The repo will be sorted to be bottom of the timeline while in :created state, and then pops back up to the top when :started. One weird thing is that it only seems to behave this way on com (staging) and enterprise, but not on org (staging). This reverts commit ce8237b4e75de8a6136123751abc4ceb7b262966. --- assets/scripts/app/models/repo.coffee | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/assets/scripts/app/models/repo.coffee b/assets/scripts/app/models/repo.coffee index a26d093c..aa8c1e99 100644 --- a/assets/scripts/app/models/repo.coffee +++ b/assets/scripts/app/models/repo.coffee @@ -108,17 +108,12 @@ require 'travis/model' ).property('_lastBuildDuration', 'lastBuildStartedAt', 'lastBuildFinishedAt') sortOrder: (-> - # this is prepared for ascending sort - if Ember.isNone(@get('lastBuildFinishedAt')) && @get('lastBuildStartedAt') - # 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) + # cuz sortAscending seems buggy when set to false + if lastBuildFinishedAt = @get('lastBuildFinishedAt') + - new Date(lastBuildFinishedAt).getTime() else - # if it's not started nor it was ran before, sort with newest id first - new Date('9999').getTime() - @get('id') - ).property('lastBuildFinishedAt', 'id', 'lastBuildStartedAt') + - new Date('9999').getTime() - parseInt(@get('lastBuildId')) + ).property('lastBuildFinishedAt', 'lastBuildId') stats: (-> if @get('slug')