• Eulyeon Ko's avatar
    Add a custom ordering option for milestones · 976dacef
    Eulyeon Ko authored
    A new method is added to the milestone model
    to support fetching milestones in this particular order:
    1. Current milestones (due date > current date)
    2. Milestones without due dates
    3. Milestones that are expired (due date <= current_date)
    
    The milestones are then sorted by due date (asc or desc)
    and ties are broken by id in descending order.
    
    The milestone finder is also updated to accept
    a new Boolean parameter 'expired_last' to utilize the
    newly added custom ordering to fetch milestones.
    
    When 'expired_last' is specified, order param must be
    one of 'due_date_asc' or 'due_date_desc'. For non-supported
    order param values (including when it's not provided),
    the default is 'due_date_asc'.
    976dacef
milestoneish.rb 3.47 KB