Skip to content

Commit 77b1462

Browse files
committed
fixed importing vote results
1 parent bb93c0c commit 77b1462

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/scripts/import.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,15 @@ export default async (procedureIds) => {
4444
return h.decision.some((decision) => {
4545
if (decision.type === 'Namentliche Abstimmung') {
4646
const voteResultsRegEx = /(\d{1,3}:\d{1,3}:\d{1,3})/;
47-
const vResults = decision.comment.match(voteResultsRegEx)[0].split(':');
47+
const voteResultsProto = decision.comment.match(voteResultsRegEx);
48+
const vResults = voteResultsProto ? voteResultsProto[0].split(':') : null;
4849
voteResults = {
49-
yes: vResults[0],
50-
no: vResults[1],
51-
abstination: vResults[2],
50+
yes: vResults ? vResults[0] : null,
51+
no: vResults ? vResults[1] : null,
52+
abstination: vResults ? vResults[2] : null,
5253
notVote:
5354
deputiesNumber[bIoProcedure.period] -
54-
vResults.reduce((pv, cv) => pv + parseInt(cv, 10), 0),
55+
(vResults ? vResults.reduce((pv, cv) => pv + parseInt(cv, 10), 0) : 0),
5556
};
5657
return true;
5758
}

0 commit comments

Comments
 (0)