Skip to content

Commit

Permalink
trying something
Browse files Browse the repository at this point in the history
  • Loading branch information
pandavenger committed Nov 1, 2024
1 parent c07275b commit 4ea3eb5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion frontend/host/pages/Allocations.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 5 additions & 1 deletion routes/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 12 additions & 4 deletions util/allocations.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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){
Expand All @@ -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);

Expand Down Expand Up @@ -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);
});

Expand Down

0 comments on commit 4ea3eb5

Please sign in to comment.