Skip to content

Commit

Permalink
Fix docs falsely showing as modified (#1535)
Browse files Browse the repository at this point in the history
  • Loading branch information
kwahlin authored and olovy committed Dec 10, 2024
1 parent 954cffa commit fbed58b
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions whelktool/src/main/resources/bulk-change-scripts/update.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@ selectByForm(transform.matchForm) {
}

private static boolean modify(Transform tf, Document doc, Whelk whelk) {
Map<String, Object> thing = doc.getThing();
thing.put(RECORD_KEY, doc.getRecord());
Map thing = doc.getThing()
thing.put(RECORD_KEY, doc.getRecord())

var m = new ModifiedThing(thing, tf, whelk.getJsonld().repeatableTerms);
var m = new ModifiedThing(thing, tf, whelk.getJsonld().repeatableTerms)

((List<Map<?,?>>) doc.data.get(GRAPH_KEY)).set(0, (Map<?, ?>) m.getAfter().remove(RECORD_KEY));
((List<Map<?,?>>) doc.data.get(GRAPH_KEY)).set(1, m.getAfter());
Map after = new HashMap<>(m.after)

return m.isModified();
((List) doc.data.get(GRAPH_KEY)).set(0, after.remove(RECORD_KEY))
((List) doc.data.get(GRAPH_KEY)).set(1, after)

return m.isModified()
}

0 comments on commit fbed58b

Please sign in to comment.