Skip to content

Commit bbe18b0

Browse files
committed
add voteResults
1 parent 2054dca commit bbe18b0

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/models/Procedure.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ const ProcedureSchema = new Schema(
2121
lastUpdateDate: Date,
2222
subjectGroups: [String],
2323
importantDocuments: [Document],
24+
voteResults: {
25+
yes: { type: Number, required: true },
26+
no: { type: Number, required: true },
27+
abstination: { type: Number, required: true },
28+
},
2429
},
2530
{ timestamps: true },
2631
);

src/scripts/import.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,20 @@ export default async (procedureIds) => {
2121
} else if (newBIoProcedure.currentStatus === 'Zurückgezogen') {
2222
newBIoProcedure.voteDate = lastHistory.date;
2323
}
24+
let voteResults = false;
25+
procedures.history.forEach((h) => {
26+
if (h.decision) {
27+
return h.decision.forEach((decision) => {
28+
if (decision.type === 'Namentliche Abstimmung') {
29+
return (voteResults = {
30+
yes: decision.comment,
31+
no: decision.comment,
32+
abstination: decision.comment,
33+
});
34+
}
35+
});
36+
}
37+
});
2438

2539
newBIoProcedure.lastUpdateDate = lastHistory.date;
2640

0 commit comments

Comments
 (0)