diff --git a/app/controllers/experiments_controller.rb b/app/controllers/experiments_controller.rb index c59f6617f..119ec7d87 100644 --- a/app/controllers/experiments_controller.rb +++ b/app/controllers/experiments_controller.rb @@ -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' diff --git a/app/services/experiments/table_view_service.rb b/app/services/experiments/table_view_service.rb index 9412dd8c6..96d07e0a9 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'