Skip to content

Commit 7f6dfaa

Browse files
authored
Merge pull request #185 from MaryamZi/master
Fix cumulative votes
2 parents 54351ff + 0ab28f2 commit 7f6dfaa

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

distributor/src/distributor/save.bal

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -380,9 +380,9 @@ function addToParliamentaryCumulativeVotes(map<json> jm) returns ParliamentaryCu
380380
if res is () {
381381
accum.by_party.push(checkpanic ParliamentaryPartyResult.constructFrom(currentPartyRes));
382382
} else {
383-
int accumVoteCount = <int> accum.by_party[i]?.vote_count + <int>pr[i].vote_count;
384-
accum.by_party[i].vote_count = accumVoteCount;
385-
accum.by_party[i].vote_percentage = (accum.summary.valid == 0) ? "0.00%" : string `${io:sprintf ("%.2f", ((accumVoteCount*100.0)/accum.summary.valid))}%`;
383+
int accumVoteCount = <int> res?.vote_count + <int>pr[i].vote_count;
384+
res.vote_count = accumVoteCount;
385+
res.vote_percentage = (accum.summary.valid == 0) ? "0.00%" : string `${io:sprintf ("%.2f", ((accumVoteCount*100.0)/accum.summary.valid))}%`;
386386
}
387387
}
388388
}

0 commit comments

Comments
 (0)