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 IVGR8-LMB-1-verkozen-schepenen table
  • Loading branch information
elpoelma committed Oct 11, 2024
1 parent 811a8a0 commit e3da7c9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 31 deletions.
6 changes: 6 additions & 0 deletions .changeset/odd-terms-buy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'frontend-gelinkt-notuleren': patch
---

**LMB IV GR tables**
Remove erroneous 'mandaat:bekrachtigdAanstellingVan' relationship from `IVGR8-LMB-1-verkozen-schepenen` table
35 changes: 4 additions & 31 deletions app/config/mandatee-table-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -793,53 +793,26 @@ 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 bindings = queryResult.results.bindings;
const tableHeader = row(
schema,
[schema.text('Schepen'), schema.text('Fractie')],
true,
);
const rows = bindings.map((binding) => {
const { mandataris, mandataris_naam, fractie_naam } =
bindingToObject(binding);
const { mandataris_naam, fractie_naam } = bindingToObject(binding);
return row(schema, [
resourceNode(schema, mandataris, mandataris_naam),
schema.text(mandataris_naam),
schema.text(fractie_naam ?? ''),
]);
});
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 e3da7c9

Please sign in to comment.