Skip to content

Commit

Permalink
re-orgs into single query, assigns bar count to delete_count, rm incr…
Browse files Browse the repository at this point in the history
…ement operation, re #10781
  • Loading branch information
whatisgalen committed Apr 18, 2024
1 parent c8b2fcf commit 4e2c3b5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions arches/app/models/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,12 +568,12 @@ def delete_instances(self, verbose=False):
deletes all associated resource instances
"""
resources_to_delete = list(Resource.objects.filter(graph_id=self.graphid))
delete_count = len(resources_to_delete)
if verbose is True:
bar = pyprind.ProgBar(Resource.objects.filter(graph_id=self.graphid).count())
delete_count = 0
for resource in Resource.objects.filter(graph_id=self.graphid):
bar = pyprind.ProgBar(delete_count)
for resource in resources_to_delete:
resource.delete()
delete_count += 1
if verbose is True:
bar.update()
if verbose is True:
Expand Down

0 comments on commit 4e2c3b5

Please sign in to comment.