Skip to content

Commit 030251b

Browse files
committed
fix import all on wrong procedure number
1 parent 3f3e8f9 commit 030251b

File tree

5 files changed

+11
-4
lines changed

5 files changed

+11
-4
lines changed

src/graphql/queries/getAllProcedures.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export default gql`
1010
currentStatus
1111
abstract
1212
tags
13+
bioUpdateAt
1314
subjectGroups
1415
history {
1516
assignment

src/graphql/queries/getProcedureUpdates.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default gql`
44
query procedureUpdates($period: [Int!], $type: [String!]) {
55
procedureUpdates(period: $period, type: $type) {
66
procedureId
7-
updatedAt
7+
bioUpdateAt
88
}
99
}
1010
`;

src/graphql/queries/getProcedures.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export default gql`
1111
abstract
1212
tags
1313
subjectGroups
14+
bioUpdateAt
1415
history {
1516
assignment
1617
initiator

src/models/Procedure.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ const ProcedureSchema = new Schema(
1818
},
1919
voteDate: Date,
2020
submissionDate: Date,
21-
lastUpdateDate: Date,
21+
lastUpdateDate: Date, // date of last dip21 history element for sorting in App
22+
bioUpdateAt: Date, // Date of last dip21 changes on bundestag.io
2223
subjectGroups: [String],
2324
importantDocuments: [Document],
2425
voteResults: {

src/scripts/webhook.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,16 @@ export default async (data) => {
4646
// Find local Procedure Updates
4747
const localProcedureUpdates = await ProcedureModel.find(
4848
{ period, type },
49-
{ procedureId: 1, lastUpdateDate: 1 },
49+
{ procedureId: 1, bioUpdateAt: 1 },
5050
);
5151
// Compare
5252
procedureUpdates.forEach((pu) => {
5353
const localData = localProcedureUpdates.find(ld => ld.procedureId === pu.procedureId);
54-
if (!localData || new Date(localData.lastUpdateDate) < new Date(pu.updatedAt)) {
54+
if (
55+
!localData ||
56+
(pu.bioUpdateAt &&
57+
new Date(localData.bioUpdateAt).getTime() !== new Date(pu.bioUpdateAt).getTime())
58+
) {
5559
update.push(pu.procedureId);
5660
}
5761
});

0 commit comments

Comments
 (0)