Skip to content

Commit 917944d

Browse files
committed
corrected webhook, allow countBefore to be -1 when it should not be chenged, correct sync of changedIds
1 parent f02e39b commit 917944d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/scripts/webhook.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export default async (data) => {
2828
},
2929
]);
3030

31-
const update = [];
31+
let update = [];
3232
await Promise.all(data.map(async (d) => {
3333
const period = parseInt(d.period, 10);
3434
const types = d.types.filter(t => t.type === 'Gesetzgebung' || t.type === 'Antrag');
@@ -38,9 +38,9 @@ export default async (data) => {
3838
const localGroup = group ? group.types.find(ct => ct.type === type) : null;
3939
const localCount = localGroup ? localGroup.count : 0;
4040
// Append Changed IDs
41-
update.concat(changedIds);
41+
update = update.concat(changedIds);
4242
// Compare Counts Remote & Local
43-
if (countBefore > localCount) {
43+
if (countBefore > localCount && countBefore >= 0) {
4444
// Find remote Procedure Updates
4545
const { data: { procedureUpdates } } = await client.query({
4646
query: getProcedureUpdates,

0 commit comments

Comments
 (0)