@aneuhold/core-ts-db-lib 1.0.35 → 1.0.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DashboardTaskMap } from '../../../documents/dashboard/Task';
|
|
1
|
+
import DashboardTask, { DashboardTaskMap } from '../../../documents/dashboard/Task';
|
|
2
2
|
import { DashboardTaskListSortSettings } from '../../../embedded-types/dashboard/task/SortSettings';
|
|
3
3
|
import { DashboardTagSettings } from '../../../embedded-types/dashboard/userConfig/Tags';
|
|
4
4
|
/**
|
|
@@ -9,7 +9,10 @@ export default class DashboardTaskSortService {
|
|
|
9
9
|
* Sorts the provided task IDs based on the provided sort settings.
|
|
10
10
|
*/
|
|
11
11
|
static sort(taskMap: DashboardTaskMap, taskIds: string[], sortSettings: DashboardTaskListSortSettings, tagSettings: DashboardTagSettings): string[];
|
|
12
|
+
/**
|
|
13
|
+
* Gets the highest priority tag value for the provided task.
|
|
14
|
+
*/
|
|
15
|
+
static getHighestPriorityTagValue(task: DashboardTask, userId: string, tagSettings: DashboardTagSettings): number;
|
|
12
16
|
private static getTaskSortFunction;
|
|
13
|
-
private static getHighestPriorityTagValue;
|
|
14
17
|
}
|
|
15
18
|
//# sourceMappingURL=TaskSortService.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TaskSortService.d.ts","sourceRoot":"","sources":["../../../../src/services/dashboard/Task/TaskSortService.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"TaskSortService.d.ts","sourceRoot":"","sources":["../../../../src/services/dashboard/Task/TaskSortService.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,EAAE,EACpB,gBAAgB,EACjB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,6BAA6B,EAG9B,MAAM,qDAAqD,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mDAAmD,CAAC;AAEzF;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,wBAAwB;IAC3C;;OAEG;IACH,MAAM,CAAC,IAAI,CACT,OAAO,EAAE,gBAAgB,EACzB,OAAO,EAAE,MAAM,EAAE,EACjB,YAAY,EAAE,6BAA6B,EAC3C,WAAW,EAAE,oBAAoB;IA0BnC;;OAEG;IACH,MAAM,CAAC,0BAA0B,CAC/B,IAAI,EAAE,aAAa,EACnB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,oBAAoB;IAcnC,OAAO,CAAC,MAAM,CAAC,mBAAmB;CA+DnC"}
|
|
@@ -25,6 +25,21 @@ class DashboardTaskSortService {
|
|
|
25
25
|
return 0;
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Gets the highest priority tag value for the provided task.
|
|
30
|
+
*/
|
|
31
|
+
static getHighestPriorityTagValue(task, userId, tagSettings) {
|
|
32
|
+
const tags = task.tags[userId];
|
|
33
|
+
if (!tags || tags.length === 0)
|
|
34
|
+
return 0;
|
|
35
|
+
return tags.reduce((highestPriority, tag) => {
|
|
36
|
+
const priority = tagSettings[tag]?.priority;
|
|
37
|
+
if (priority && priority > highestPriority) {
|
|
38
|
+
return priority;
|
|
39
|
+
}
|
|
40
|
+
return highestPriority;
|
|
41
|
+
}, 0);
|
|
42
|
+
}
|
|
28
43
|
static getTaskSortFunction(sortBy, sortDirection, tagSettings, userId) {
|
|
29
44
|
switch (sortBy) {
|
|
30
45
|
case SortSettings_1.DashboardTaskSortBy.tags:
|
|
@@ -78,17 +93,5 @@ class DashboardTaskSortService {
|
|
|
78
93
|
};
|
|
79
94
|
}
|
|
80
95
|
}
|
|
81
|
-
static getHighestPriorityTagValue(task, userId, tagSettings) {
|
|
82
|
-
const tags = task.tags[userId];
|
|
83
|
-
if (!tags || tags.length === 0)
|
|
84
|
-
return 0;
|
|
85
|
-
return tags.reduce((highestPriority, tag) => {
|
|
86
|
-
const priority = tagSettings[tag]?.priority;
|
|
87
|
-
if (priority && priority > highestPriority) {
|
|
88
|
-
return priority;
|
|
89
|
-
}
|
|
90
|
-
return highestPriority;
|
|
91
|
-
}, 0);
|
|
92
|
-
}
|
|
93
96
|
}
|
|
94
97
|
exports.default = DashboardTaskSortService;
|