Improve sorting by storage in project model
Follow-up from !151979 (comment 1897265053).
We have this Project#order_by_storage_size scope.
We can reuse the same scope in Project#sort_by_attribute which I think is only used in https://gdk.test:3000/admin/projects?sort=storage_size_desc and add a new case for sorting by storage in ascending order.
Implementation plan
- Create two new scopes:
scope :sorted_by_storage_asc, -> { order_by_storage_size(:asc) }
scope :sorted_by_storage_desc, -> { order_by_storage_size(:desc) }
- Use these scopes in Project#sort_by_attribute to sort by storage in ascending and descending order.
- Remove the usage of order_by_storage_size from the finder as we can now rely on
Project#sort_by_attribute
. - Add these storage sort options to the ProjectSortEnum introduced in !151979 (diffs).
- Add/update the specs.