Commit f4bf7be9 authored by Eulyeon Ko's avatar Eulyeon Ko

Apply backend maintainer suggestions

- Convert the sort argument to string so symbol can be
additionally used.
parent 3f30232f
......@@ -120,11 +120,11 @@ class Milestone < ApplicationRecord
sorted.with_order_id_desc
end
def self.sort_with_expired_last(sort_by)
def self.sort_with_expired_last(method)
# NOTE: this is a custom ordering of milestones
# to prioritize displaying non-expired milestones and milestones without due dates
sorted = reorder(Arel.sql('(CASE WHEN due_date IS NULL THEN 1 WHEN due_date > now() THEN 0 ELSE 2 END) ASC'))
sorted = if sort_by == :expired_last_due_date_desc
sorted = if method.to_s == 'expired_last_due_date_desc'
sorted.order(due_date: :desc)
else
sorted.order(due_date: :asc)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment