aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsowgro <tpoke.ferrari@gmail.com>2025-04-04 23:25:54 -0400
committersowgro <tpoke.ferrari@gmail.com>2025-04-04 23:25:54 -0400
commit1dcb3ca5345609fa03e73f58693327cee7ab7cf9 (patch)
tree429eb5843f7d470135160f1b0da6636a9b902633
parent7c49fcd788692a898e985cb156dd9fd910c05790 (diff)
downloadJellySolutions-1dcb3ca5345609fa03e73f58693327cee7ab7cf9.tar.gz
JellySolutions-1dcb3ca5345609fa03e73f58693327cee7ab7cf9.tar.bz2
JellySolutions-1dcb3ca5345609fa03e73f58693327cee7ab7cf9.zip
Add sort by type
-rw-r--r--ufund-ui/src/app/components/cupboard/sorting.ts21
1 files changed, 16 insertions, 5 deletions
diff --git a/ufund-ui/src/app/components/cupboard/sorting.ts b/ufund-ui/src/app/components/cupboard/sorting.ts
index 73a5ba9..5c37019 100644
--- a/ufund-ui/src/app/components/cupboard/sorting.ts
+++ b/ufund-ui/src/app/components/cupboard/sorting.ts
@@ -49,10 +49,21 @@ const sortByLocation: sortAlgo = (a: Need, b: Need): number => {
return 1;
}
+const sortByType: sortAlgo = (a:Need, b:Need): number => {
+ if(a.type == b.type) {
+ return sortByName(a,b);
+ }
+ else if(a.type > b.type) {
+ return -1;
+ }
+ return 1;
+}
+
export const SortingAlgoArrays: {[key: string]: { func: sortAlgo, display: [string, string]}} = {
- sortByPriority: { func: sortByPriority, display: ["Highest Priority", "Lowest Priority" ] },
- sortByName: { func: sortByName, display: ["Name (A to Z)", "Name (Z to A)" ] },
- sortByLocation: { func: sortByLocation, display: ["Location (A to Z)", "Location (Z to A)" ] },
- sortByCompletion: { func: sortByCompletion, display: ["Most Completed", "Least Completed" ] },
- sortByGoal: { func: sortByGoal, display: ["Largest Maximum Goal", "Smallest Maximum Goal" ] },
+ sortByPriority: { func: sortByPriority, display: ["Highest Priority", "Lowest Priority" ] },
+ sortByName: { func: sortByName, display: ["Name (A to Z)", "Name (Z to A)" ] },
+ sortByLocation: { func: sortByLocation, display: ["Location (A to Z)", "Location (Z to A)" ] },
+ sortByCompletion: { func: sortByCompletion, display: ["Most Completed", "Least Completed" ] },
+ sortByGoal: { func: sortByGoal, display: ["Largest Maximum Goal", "Smallest Maximum Goal" ] },
+ sortByType: { func: sortByType, display: ["Type (Physical first)", "Type (Monetary first)" ] },
};