diff options
author | Kushal Pandya <kushalspandya@gmail.com> | 2019-05-07 09:45:11 +0300 |
---|---|---|
committer | Kushal Pandya <kushalspandya@gmail.com> | 2019-05-07 09:45:11 +0300 |
commit | e33a8baff5b185d7a705607f9148fb64b7f5561f (patch) | |
tree | 57fb9cef5d5b582b48ea18922d16acdb936d4993 /app/models | |
parent | 552e9f748b7dc38c83d1c2fafdb0e5f07ac830f5 (diff) | |
parent | ffa9266a27486357d5edb36e8973a9e869f3db58 (diff) |
Merge branch '56992-add-filtering-to-project-dashboard-fe' into 'master'
Resolve "Add filtering to project dashboard [FE]"
Closes #56992
See merge request gitlab-org/gitlab-ce!25231
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/project.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index 228ab9e9618..da72186c8a0 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -357,7 +357,8 @@ class Project < ApplicationRecord # 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(star_count: :desc) } + scope :sorted_by_stars_desc, -> { reorder(star_count: :desc) } + scope :sorted_by_stars_asc, -> { reorder(star_count: :asc) } scope :in_namespace, ->(namespace_ids) { where(namespace_id: namespace_ids) } scope :personal, ->(user) { where(namespace_id: user.namespace_id) } @@ -544,7 +545,9 @@ class Project < ApplicationRecord when 'latest_activity_asc' reorder(last_activity_at: :asc) when 'stars_desc' - sorted_by_stars + sorted_by_stars_desc + when 'stars_asc' + sorted_by_stars_asc else order_by(method) end |