Skip to content

Commit

Permalink
Merge pull request #13 from YujithIsura/master
Browse files Browse the repository at this point in the history
fixed registered votes total issue and polled %ge issue
  • Loading branch information
YujithIsura authored Nov 18, 2019
2 parents 4674152 + 683b8dd commit 17ae150
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 14 deletions.
37 changes: 23 additions & 14 deletions src/elections/ResultsTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ export default class ResultsTable extends Component {
key={keyPrefix + 'header-total-polled'}
text="Total Polled"
/>,
// <CellHeader
// key={keyPrefix + 'header-registed-votes'}
// text="Registered Votes"
// />,
<CellHeader
key={keyPrefix + 'header-registed-votes'}
text="Registered Votes"
/>,
])
}</tr>
);
Expand Down Expand Up @@ -123,7 +123,7 @@ export default class ResultsTable extends Component {
totalValid,
totalRejected,
totalPolled,
totalElectors,
totalElectors
) {
const sortedPartyAndVotes = getSortedPartyAndVotes(votesByParty);
const winningParty = sortedPartyAndVotes[0][0];
Expand Down Expand Up @@ -186,14 +186,12 @@ export default class ResultsTable extends Component {
<CellNumberPercent
key={key + '-total-polled-votes'}
value={totalPolled}
valuePercent={null}
// valuePercent={totalPolled / totalElectors}

valuePercent={totalPolled / totalElectors}
/>,
<CellNumber
key={key + '-total-registered-voters'}
value={totalElectors}
/>,
// <CellNumber
// key={key + '-total-registered-voters'}
// value={totalElectors}
// />,
])}
</tr>
);
Expand All @@ -218,7 +216,7 @@ export default class ResultsTable extends Component {
totalValid,
totalRejected,
totalPolled,
totalElectors,
totalElectors

] = getAggregateStats(
results,
Expand Down Expand Up @@ -281,6 +279,17 @@ export default class ResultsTable extends Component {
);
}.bind(this),
);
var postalVotes = 0;

results.map(
function(result, i) {
if (result.pd_name === "Postal Votes") {
return postalVotes = result.summary.electors;
}
}.bind(this)
);

const totalElectorsWithPostal = totalElectors + postalVotes;

const _totalsRow = (this.props.showTotals) ?
this.renderRow(
Expand All @@ -296,7 +305,7 @@ export default class ResultsTable extends Component {
totalValid,
totalRejected,
totalPolled,
totalElectors,
totalElectorsWithPostal
) : null;


Expand Down
Binary file modified src/elections/images/party_logos/logo_SLPP.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 17ae150

Please sign in to comment.