Skip to content

Commit

Permalink
feat: make reps inclusive of the user count
Browse files Browse the repository at this point in the history
  • Loading branch information
Sampiiiii committed Apr 25, 2024
1 parent e717749 commit ef76f77
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions apps/anvil/src/sign-in/sign-in.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ export class SignInService implements OnModuleInit {
on_shift += await this.offShiftReps(location);
}
const factor = out_of_hours ? OUT_OF_HOURS_RATIO : IN_HOURS_RATIO;
return Math.min(on_shift * factor, this.maxUsersForLocation(location)) + on_shift;
return Math.min(on_shift * factor, this.maxPeopleForLocation(location));
}

async offShiftReps(location: Location): Promise<number> {
Expand Down Expand Up @@ -317,15 +317,15 @@ export class SignInService implements OnModuleInit {
on_shift += off_shift;
}

if (total_count - on_shift > this.maxUsersForLocation(location)) {
if (total_count >= this.maxPeopleForLocation(location)) {
// the hard cap assuming you're signing in as a user, on shift reps skip this check
return false;
}

return (await this.maxCount(location)) + on_shift - total_count >= 0;
}

maxUsersForLocation(location: Location) {
maxPeopleForLocation(location: Location) {
switch (location.toLowerCase()) {
case "mainspace":
return 45;
Expand Down Expand Up @@ -610,7 +610,7 @@ export class SignInService implements OnModuleInit {
limit: 1,
})),
);
return queuing.length !== 0;
return queuing.length >= 0;
}

async assertHasQueued(location: Location, ucard_number: number) {
Expand Down

0 comments on commit ef76f77

Please sign in to comment.