Skip to content

Commit

Permalink
Merge pull request #185 from MaryamZi/master
Browse files Browse the repository at this point in the history
Fix cumulative votes
  • Loading branch information
MaryamZi committed Aug 6, 2020
2 parents 54351ff + 0ab28f2 commit 7f6dfaa
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions distributor/src/distributor/save.bal
Original file line number Diff line number Diff line change
Expand Up @@ -380,9 +380,9 @@ function addToParliamentaryCumulativeVotes(map<json> jm) returns ParliamentaryCu
if res is () {
accum.by_party.push(checkpanic ParliamentaryPartyResult.constructFrom(currentPartyRes));
} else {
int accumVoteCount = <int> accum.by_party[i]?.vote_count + <int>pr[i].vote_count;
accum.by_party[i].vote_count = accumVoteCount;
accum.by_party[i].vote_percentage = (accum.summary.valid == 0) ? "0.00%" : string `${io:sprintf ("%.2f", ((accumVoteCount*100.0)/accum.summary.valid))}%`;
int accumVoteCount = <int> res?.vote_count + <int>pr[i].vote_count;
res.vote_count = accumVoteCount;
res.vote_percentage = (accum.summary.valid == 0) ? "0.00%" : string `${io:sprintf ("%.2f", ((accumVoteCount*100.0)/accum.summary.valid))}%`;
}
}
}
Expand Down

0 comments on commit 7f6dfaa

Please sign in to comment.