Skip to content

Commit

Permalink
Skip counting votes for fully banned members.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ubuntu committed Nov 24, 2024
1 parent b7e4a13 commit 9f80389
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions presidential-election.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ async function CountVotesAndAwardPresidency() {
const voteList = {};
const voteSum = {};
let voteCount = 0;
let validVoteCount = 0;
let maxSum = 0;
const users = UserCache.GetAllUsersAsFlatList();
for (const user of users) {
Expand All @@ -265,13 +266,16 @@ async function CountVotesAndAwardPresidency() {
voteSum[v] = 0;
voteList[v] = [];
}
voteSum[v] += weight;
voteList[v].push({ color, weight });
voteCount++;
maxSum = Math.max(voteSum[v], maxSum);
if (!user.ban_conviction_time) {
validVoteCount++;
voteSum[v] += weight;
voteList[v].push({ color, weight });
maxSum = Math.max(voteSum[v], maxSum);
}
}
}
if (!voteCount) {
if (!validVoteCount) {
return;
}
const sortableCandidates = [];
Expand Down

0 comments on commit 9f80389

Please sign in to comment.