diff options
-rw-r--r-- | app/models/project.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index 228ab9e9618..da5f2c2e96e 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -358,6 +358,7 @@ 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_asc, -> { reorder(star_count: :asc) } scope :in_namespace, ->(namespace_ids) { where(namespace_id: namespace_ids) } scope :personal, ->(user) { where(namespace_id: user.namespace_id) } @@ -545,6 +546,8 @@ class Project < ApplicationRecord reorder(last_activity_at: :asc) when 'stars_desc' sorted_by_stars + when 'stars_asc' + sorted_by_stars_asc else order_by(method) end |