From 35dd189c05ae5d3d31fce360261fdd7f0c596534 Mon Sep 17 00:00:00 2001 From: Robert Boyd III Date: Mon, 15 Jun 2020 15:03:01 -0400 Subject: [PATCH] Fix unintuitive sorting edge cases --- app/src/main/java/com/todoroo/astrid/core/SortHelper.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/todoroo/astrid/core/SortHelper.java b/app/src/main/java/com/todoroo/astrid/core/SortHelper.java index 1b3a8f9b4..07fa2e373 100644 --- a/app/src/main/java/com/todoroo/astrid/core/SortHelper.java +++ b/app/src/main/java/com/todoroo/astrid/core/SortHelper.java @@ -114,7 +114,8 @@ public class SortHelper { + ADJUSTED_DUE_DATE + ") END) " + // else due time - "+ 172800000 * importance"); // add 2 days * importance + // add slightly less than 2 days * importance to give due date priority over importance in case of tie + "+ 172799999 * importance"); } if (sortType != SORT_ALPHA) { order.addSecondaryExpression(ORDER_TITLE); @@ -174,7 +175,8 @@ public class SortHelper { + ADJUSTED_DUE_DATE.replace("dueDate", "tasks.dueDate") + ") END) " + // else due time - "+ 172800000 * tasks.importance AS sort_smart"; // add 2 days * importance + // add slightly less than 2 days * importance to give due date priority over importance in case of tie + "+ 172799999 * tasks.importance AS sort_smart"; } return select;