Skip to content

Commit 3754fbd

Browse files
committed
add proceduretype "Antrag"
1 parent 31e1009 commit 3754fbd

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/scripts/importAll.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ const deputiesNumber = {
1919
19: 709,
2020
};
2121

22-
export default async () => {
22+
const pastStatus = ['Zurückgezogen', 'Abgelehnt', 'Angenommen'];
23+
24+
export default async (req, res) => {
2325
const client = createClient();
2426
console.log('Start Importing');
2527
const { data: { allProcedures } } = await client.query({
@@ -36,7 +38,7 @@ export default async () => {
3638
const btWithDecisions = bIoProcedure.history.filter(({ assignment, initiator }) => assignment === 'BT' && initiator === '2. Beratung');
3739
if (btWithDecisions.length > 0) {
3840
newBIoProcedure.voteDate = new Date(btWithDecisions.pop().date);
39-
} else if (newBIoProcedure.currentStatus === 'Zurückgezogen') {
41+
} else if (pastStatus.some(status => status === newBIoProcedure.currentStatus)) {
4042
newBIoProcedure.voteDate = lastHistory.date;
4143
}
4244
let voteResults;
@@ -80,4 +82,5 @@ export default async () => {
8082
);
8183
});
8284
console.log('Imported everything!'); // eslint-disable-line
85+
res.send('Imported everything!');
8386
};

src/scripts/webhook.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export default async (data) => {
3131
const update = [];
3232
await Promise.all(data.map(async (d) => {
3333
const period = parseInt(d.period, 10);
34-
const { type, countBefore, changedIds } = d.types.find(t => t.type === 'Gesetzgebung');
34+
const { type, countBefore, changedIds } = d.types.find(t => t.type === 'Gesetzgebung', 'Antrag');
3535
const group = groups.find(c => c.period === period);
3636
const localCount = group ? group.types.find(ct => ct.type === type).count : 0;
3737
// Append Changed IDs

0 commit comments

Comments
 (0)