From 3dff1b8a8c068b000dc3f3840e4e4ae125fbaacd Mon Sep 17 00:00:00 2001 From: Anton Date: Thu, 12 Jan 2023 11:57:48 +0100 Subject: [PATCH] Experiment table improve due date sorting [SCI-7746][SCI-7704] --- app/controllers/experiments_controller.rb | 4 ++-- app/services/experiments/table_view_service.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/experiments_controller.rb b/app/controllers/experiments_controller.rb index cba004713..1f4e92274 100644 --- a/app/controllers/experiments_controller.rb +++ b/app/controllers/experiments_controller.rb @@ -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' diff --git a/app/services/experiments/table_view_service.rb b/app/services/experiments/table_view_service.rb index fddfba067..e355efa89 100644 --- a/app/services/experiments/table_view_service.rb +++ b/app/services/experiments/table_view_service.rb @@ -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'