From 05d2f2f943921d6b5c921686c5edce6eb39d23b8 Mon Sep 17 00:00:00 2001 From: Karan Jayachandra Date: Thu, 13 Nov 2025 11:58:42 +0100 Subject: Cleaned up the code quite a bit --- utils.mjs | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) (limited to 'utils.mjs') 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) { -- cgit v1.3.1