Skip to content

Commit

Permalink
imports Tile.bulk_save_edits in Resource proxy bulk_save method after…
Browse files Browse the repository at this point in the history
… bulk_creating Tile instances re #10770
  • Loading branch information
whatisgalen committed Apr 14, 2024
1 parent 801a0b7 commit de56b34
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions arches/app/models/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ def bulk_save(resources, transaction_id=None):
transaction_id -- a uuid identifing the save of these instances as belonging to a collective load or process
"""
from arches.app.models.tile import Tile

datatype_factory = DataTypeFactory()
node_datatypes = {str(nodeid): datatype for nodeid, datatype in models.Node.objects.values_list("nodeid", "datatype")}
Expand All @@ -294,6 +295,14 @@ def bulk_save(resources, transaction_id=None):
Resource.objects.bulk_create(resources)
TileModel.objects.bulk_create(tiles)

Tile.bulk_save_edits(
tiles=tiles,
note=f"Bulk created in Resource.bulk_save",
edit_type="bulk_create",
transaction_id=transaction_id,
new_resource_created=True
)

print(f"Time to bulk create tiles and resources: {datetime.timedelta(seconds=time() - start)}")

start = time()
Expand Down

0 comments on commit de56b34

Please sign in to comment.