Skip to content

Commit

Permalink
update post_tile_save to only apply to updated, non-deleted resource-…
Browse files Browse the repository at this point in the history
…instance tiles, re #11730
  • Loading branch information
whatisgalen committed Feb 10, 2025
1 parent 25ce71d commit c332dd1
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions arches/app/datatypes/datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2099,20 +2099,22 @@ def post_tile_save(self, tile, nodeid, request):
""" % (
tile.pk
)
delete_sql = """
DELETE FROM resource_x_resource WHERE tileid = '%s' AND resourcexid NOT IN (%s);
""" % (
tile.pk,
",".join(
[
"'%s'" % relationship["resourceXresourceId"]
for relationship in tile.data[nodeid]
]
),
)
if tile.data[nodeid] and len(tile.data[nodeid]) > 0:
delete_sql = """
DELETE FROM resource_x_resource WHERE tileid = '%s' AND resourcexid NOT IN (%s);
""" % (
tile.pk,
",".join(
[
"'%s'" % relationship["resourceXresourceId"]
for relationship in tile.data[nodeid]
]
),
)

with connection.cursor() as cursor:
cursor.execute(delete_sql)
if tile.data[nodeid] and len(tile.data[nodeid]) > 0:
cursor.execute(delete_sql)
cursor.execute(create_sql)
ret = cursor.fetchone()
return ret
Expand Down

0 comments on commit c332dd1

Please sign in to comment.