aboutsummaryrefslogtreecommitdiff
path: root/utils.mjs
diff options
context:
space:
mode:
authorKaran Jayachandra <karan.jayachandra@nxp.com>2025-11-13 11:58:42 +0100
committerKaran Jayachandra <karan.jayachandra@nxp.com>2025-11-13 11:58:42 +0100
commit05d2f2f943921d6b5c921686c5edce6eb39d23b8 (patch)
treeaa49a02006d88f44a57864a51e680f87ef341a7c /utils.mjs
parent367dacb5057c945027775f992edf69884c8fb650 (diff)
Cleaned up the code quite a bit
Diffstat (limited to 'utils.mjs')
-rw-r--r--utils.mjs32
1 files changed, 10 insertions, 22 deletions
diff --git a/utils.mjs b/utils.mjs
index b8e5222..62569e4 100644
--- a/utils.mjs
+++ b/utils.mjs
@@ -29,28 +29,16 @@ export class Manager {
});
}
}
-}
-
-export function getMatchCount(regulars, courts) {
- const activeCourts = courts.filter(function (c) {
- return c.status;
- });
- console.log(
- "There are a total of " + activeCourts.length + " courts available."
- );
- console.log(regulars);
- const activePlayers = regulars.filter(function (p) {
- return p.status;
- });
- console.log(
- "There are a total of " + activePlayers.length + " players available."
- );
- var possibleMatches = Math.floor(activePlayers.length / 4);
- possibleMatches =
- possibleMatches > activeCourts.length
- ? activeCourts.length
- : possibleMatches;
- return possibleMatches;
+ active() {
+ return this.listData.filter(function (c) {
+ return c.status;
+ });
+ }
+ inactive() {
+ return this.listData.filter(function (c) {
+ return !c.status;
+ });
+ }
}
export function shuffle(array) {