fixes issue sorter not recognizing issues as "equal" if their ETAs are both null

Sat, 31 Oct 2020 09:56:00 +0100

author
Mike Becker <universe@uap-core.de>
date
Sat, 31 Oct 2020 09:56:00 +0100
changeset 155
3ace475224f7
parent 154
3d10f2a390a1
child 156
c5d6820d884e

fixes issue sorter not recognizing issues as "equal" if their ETAs are both null

src/main/java/de/uapcore/lightpit/viewmodel/util/IssueSorter.java file | annotate | diff | comparison | revisions
--- a/src/main/java/de/uapcore/lightpit/viewmodel/util/IssueSorter.java	Sat Oct 31 09:50:15 2020 +0100
+++ b/src/main/java/de/uapcore/lightpit/viewmodel/util/IssueSorter.java	Sat Oct 31 09:56:00 2020 +0100
@@ -37,6 +37,9 @@
     }
 
     private int compare(Issue left, Issue right, Criteria criteria) {
+        if (left.equals(right))
+            return 0;
+
         int result;
         switch (criteria.field) {
             case DONE:
@@ -47,6 +50,8 @@
             case ETA:
                 if (left.getEta() != null && right.getEta() != null)
                     result = left.getEta().compareTo(right.getEta());
+                else if (left.getEta() == null && right.getEta() == null)
+                    result = 0;
                 else
                     result = left.getEta() != null ? -1 : 1;
                 break;

mercurial