summaryrefslogtreecommitdiff
path: root/app/models/project.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/project.rb')
-rw-r--r--app/models/project.rb11
1 files changed, 4 insertions, 7 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 246479624ee..a793e21f12d 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -231,13 +231,10 @@ class Project < ActiveRecord::Base
end
def sort(method)
- case method.to_s
- when 'newest' then reorder('projects.created_at DESC')
- when 'oldest' then reorder('projects.created_at ASC')
- when 'recently_updated' then reorder('projects.updated_at DESC')
- when 'last_updated' then reorder('projects.updated_at ASC')
- when 'largest_repository' then reorder('projects.repository_size DESC')
- else reorder('namespaces.path, projects.name ASC')
+ if method == 'repository_size_desc'
+ reorder(repository_size: :desc, id: :desc)
+ else
+ order_by(method)
end
end
end