From 4ea3eb568af83099bd14da37a7cd5988d274c6b3 Mon Sep 17 00:00:00 2001 From: pandavenger Date: Fri, 1 Nov 2024 11:09:44 -0400 Subject: [PATCH] trying something --- frontend/host/pages/Allocations.vue | 2 +- routes/preferences.js | 6 +++++- util/allocations.js | 16 ++++++++++++---- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/frontend/host/pages/Allocations.vue b/frontend/host/pages/Allocations.vue index ebf5fdd8..d60afcc3 100644 --- a/frontend/host/pages/Allocations.vue +++ b/frontend/host/pages/Allocations.vue @@ -231,7 +231,7 @@ export default { await this.getAnswers(); } if (!this.applicants) { - await this.getApplicantsByApp(4); + await this.getApplicantsByApp(5); } // Check if any jurors are allocated. If so, simply render them out. if (this.jurors.length > 0) { diff --git a/routes/preferences.js b/routes/preferences.js index 79ff6d97..c6d25751 100644 --- a/routes/preferences.js +++ b/routes/preferences.js @@ -198,7 +198,11 @@ apiApp.get('/', async (request, response) => { // Add cats they are a juror in categoryJurors.forEach(juror => { - prefTable.get(juror.user.id).jurorIn.push(catMap.get(juror.categoryId)); + try { + prefTable.get(juror.user.id).jurorIn.push(catMap.get(juror.categoryId)); + } catch (e) { + + } }); // Add scores diff --git a/util/allocations.js b/util/allocations.js index e59dab07..91bc2582 100644 --- a/util/allocations.js +++ b/util/allocations.js @@ -2,9 +2,9 @@ const { all } = require("../routes/complain"); const {yuuko} = require('../bot/index'); const JUROR_MIN = 11; -const FILL_MAX = 11; -const JUROR_MAX = 11; -const AOTY_MAX = 11; +const FILL_MAX = 13; +const JUROR_MAX = 99; +const AOTY_MAX = 13; function shuffle (array) { let currentIndex = array.length; let temporaryValue; let randomIndex; @@ -292,7 +292,7 @@ class Allocations { } const catJurors = this.allocatedJurors.filter(juror => juror.catid == catid); - if (category.name == "Anime of the Year"){ + if (category.awardsGroup == 'main'){ return catJurors.length >= AOTY_MAX; } else { if (fill){ @@ -314,6 +314,11 @@ class Allocations { return (jurorAllocations.length >= juror.wantedCats); } + jurorIsFullMain(juror){ + const jurorAllocations = this.allocatedJurors.filter(aj => aj.name == juror.name && [59,58,57,54].includes(aj.catid)); + return (jurorAllocations.length >= 2); + } + jurorInCat(juror, catid){ let allocatedJuror = this.allocatedJurors.find(aj => aj.name == juror.name && aj.catid == catid); @@ -347,6 +352,9 @@ class Allocations { if (this.jurorInCat(juror, catid)){ return false; } + if ([59,58,57,54].includes(catid)){ + return this.jurorIsFullMain(juror); + } return juror.qualifiesFor(this.categories, catid, threshold); });