Experiment table improve due date sorting [SCI-7746][SCI-7704]

This commit is contained in:
Anton 2023-01-12 11:57:48 +01:00
parent b7077b53b7
commit 3dff1b8a8c
2 changed files with 4 additions and 4 deletions

View file

@ -607,9 +607,9 @@ class ExperimentsController < ApplicationController
def sort_my_modules(records, sort)
case sort
when 'due_first'
records.order(:due_date)
records.order(:due_date, :name)
when 'due_last'
records.order(Arel.sql("COALESCE(due_date, DATE '1900-01-01') DESC"))
records.order(Arel.sql("COALESCE(due_date, DATE '2100-01-01') DESC"), :name)
when 'atoz'
records.order(:name)
when 'ztoa'

View file

@ -225,9 +225,9 @@ module Experiments
def sort_records(records)
case @sort
when 'due_first'
records.order(:due_date)
records.order(:due_date, :name)
when 'due_last'
records.order(Arel.sql("COALESCE(due_date, DATE '1900-01-01') DESC"))
records.order(Arel.sql("COALESCE(due_date, DATE '2100-01-01') DESC"), :name)
when 'atoz'
records.order(:name)
when 'ztoa'