summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2018-03-06 16:21:17 +0000
committerDouwe Maan <douwe@gitlab.com>2018-03-06 16:21:17 +0000
commit76658d06b4dcc48497a604b00e8870359790d1bc (patch)
tree1326f0c4ec3064131e430fc7fcfc261f5a0e1dd3 /app
parent12bc2d8df0890fad3296b47395fb7279a11e43c1 (diff)
parent9cb7e93f09b1ff0c1c889a004479a8ef21abbae2 (diff)
downloadgitlab-ce-76658d06b4dcc48497a604b00e8870359790d1bc.tar.gz
Merge branch 'sh-dashboard-sort-fix' into 'master'
Fix project dashboard showing the wrong timestamps Closes #27181 See merge request gitlab-org/gitlab-ce!17504
Diffstat (limited to 'app')
-rw-r--r--app/models/project.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 934b226f46b..7a6abf2e643 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -276,7 +276,8 @@ class Project < ActiveRecord::Base
scope :without_storage_feature, ->(feature) { where('storage_version < :version OR storage_version IS NULL', version: HASHED_STORAGE_FEATURES[feature]) }
scope :with_unmigrated_storage, -> { where('storage_version < :version OR storage_version IS NULL', version: LATEST_STORAGE_VERSION) }
- scope :sorted_by_activity, -> { reorder(last_activity_at: :desc) }
+ # last_activity_at is throttled every minute, but last_repository_updated_at is updated with every push
+ scope :sorted_by_activity, -> { reorder("GREATEST(COALESCE(last_activity_at, '1970-01-01'), COALESCE(last_repository_updated_at, '1970-01-01')) DESC") }
scope :sorted_by_stars, -> { reorder('projects.star_count DESC') }
scope :in_namespace, ->(namespace_ids) { where(namespace_id: namespace_ids) }
@@ -778,7 +779,7 @@ class Project < ActiveRecord::Base
end
def last_activity_date
- last_repository_updated_at || last_activity_at || updated_at
+ [last_activity_at, last_repository_updated_at, updated_at].compact.max
end
def project_id