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'