Skip to content

Commit

Permalink
lmb-gr-tables: remove erroneous mandaat:bekrachtigdAanstellingVan rel…
Browse files Browse the repository at this point in the history
…ationship on kandidaat-schepenen table
  • Loading branch information
elpoelma committed Oct 11, 2024
1 parent c0e1263 commit 9e68b55
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 30 deletions.
5 changes: 5 additions & 0 deletions .changeset/sixty-ears-jam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'frontend-gelinkt-notuleren': patch
---

LMB IV GR tables: remove erroneous 'mandaat:bekrachtigdAanstellingVan' relationship from 'kandidaat schepenen' table
35 changes: 5 additions & 30 deletions app/config/mandatee-table-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -515,18 +515,7 @@ export const mandateeTableConfigIVGR = (meeting) => {
return (state) => {
const { doc, schema } = state;
const $pos = doc.resolve(pos);
const decisionUri = findParentNodeClosestToPos($pos, (node) => {
return hasOutgoingNamedNodeTriple(
node.attrs,
RDF('type'),
BESLUIT('Besluit'),
);
})?.node.attrs.subject;
if (!decisionUri) {
throw new Error(
'Could not find decision to sync mandatee table with',
);
}

const tableHeader = row(
schema,
[schema.text('Schepen'), schema.text('Rang')],
Expand All @@ -544,34 +533,20 @@ export const mandateeTableConfigIVGR = (meeting) => {
return (b1.rangnummer ?? Infinity) - (b2.rangnummer ?? Infinity);
});
const rows = bindings.map((binding) => {
const { mandataris, mandataris_naam, mandataris_rang } =
const { mandataris_naam, mandataris_rang } =
bindingToObject(binding);
return row(schema, [
resourceNode(schema, mandataris, mandataris_naam),
schema.text(mandataris_naam),
schema.text(mandataris_rang),
]);
});
const content = schema.nodes.table.create(null, [
tableHeader,
...rows,
]);
const factory = new SayDataFactory();
const result = transactionCombinator(
state,
replaceContent(state.tr, $pos, content),
)(
bindings.map((binding) => {
return addPropertyToNode({
resource: decisionUri,
property: {
predicate: MANDAAT('bekrachtigtAanstellingVan').full,
object: factory.resourceNode(binding['mandataris'].value),
},
});
}),
);
const transaction = replaceContent(state.tr, $pos, content);
return {
transaction: result.transaction,
transaction,
result: true,
initialState: state,
};
Expand Down

0 comments on commit 9e68b55

Please sign in to comment.