Skip to content

Commit 00f933e

Browse files
committed
refactor: reduce cognitive complexity to 5
1 parent 57b3f5b commit 00f933e

File tree

1 file changed

+0
-29
lines changed

1 file changed

+0
-29
lines changed

webapp/src/ts/reducers/tasks.ts

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -14,35 +14,6 @@ const initialState = {
1414
},
1515
};
1616

17-
18-
const orderByDueDateAndPriority1 = (t1, t2) => {
19-
const lhs = t1?.dueDate;
20-
const rhs = t2?.dueDate;
21-
22-
const lhsPriority = t1?.priority;
23-
const rhsPriority = t2?.priority;
24-
25-
if ((lhsPriority && !rhsPriority) || lhsPriority > rhsPriority) {
26-
return -1;
27-
}
28-
29-
if ((!lhsPriority && rhsPriority) || lhsPriority < rhsPriority) {
30-
return 1;
31-
}
32-
33-
if (!lhs && !rhs) {
34-
return 0;
35-
}
36-
if (!lhs) {
37-
return 1;
38-
}
39-
if (!rhs) {
40-
return -1;
41-
}
42-
43-
return lhs < rhs ? -1 : 1;
44-
};
45-
4617
/**
4718
* Task prioritization algorithm that combines:
4819
* 1. Overdue status (most urgent)

0 commit comments

Comments
 (0)