Merge pull request #4806 from aignatov-bio/ai-sci-7746-fix-due-date-ordering

Experiment table improve due date sorting [SCI-7746][SCI-7704]
This commit is contained in:
aignatov-bio 2023-01-12 12:58:18 +01:00 committed by GitHub
commit abaf8d9e07
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View file

@ -613,9 +613,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'