balanceWithGrade method
Balance your proposal tallies so that they all hold the same total amount of judgments, by filling the gaps with the specified grade. This adds judgments of the specified grade (default: "worst" grade), as many as needed (if any) to each proposal to balance the tallies.
Implementation
PollTally balanceWithGrade({int grade = 0}) {
final amountOfProposals = proposals.length;
final missingAmounts = estimateMissingJudgments();
for (var i = 0; i < amountOfProposals; i++) {
final missingAmount = missingAmounts[i];
if (0 == missingAmount) continue;
proposals[i].gradesTallies[grade] += missingAmount;
}
return this;
}