Commit 25d2f68c authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Use CURRENT_DATE instead of Date.current

parent c83caa94
...@@ -123,7 +123,7 @@ class Milestone < ApplicationRecord ...@@ -123,7 +123,7 @@ class Milestone < ApplicationRecord
def self.sort_with_expired_last(method) def self.sort_with_expired_last(method)
# NOTE: this is a custom ordering of milestones # NOTE: this is a custom ordering of milestones
# to prioritize displaying non-expired milestones and milestones without due dates # 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 >= '#{Date.current}' THEN 0 ELSE 2 END) ASC")) sorted = reorder(Arel.sql("(CASE WHEN due_date IS NULL THEN 1 WHEN due_date >= CURRENT_DATE THEN 0 ELSE 2 END) ASC"))
sorted = if method.to_s == 'expired_last_due_date_desc' sorted = if method.to_s == 'expired_last_due_date_desc'
sorted.order(due_date: :desc) sorted.order(due_date: :desc)
else else
......
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