Skip to content

Commit

Permalink
(HP-1470): handle case of negative limit from small total
Browse files Browse the repository at this point in the history
  • Loading branch information
george42-ctds committed Apr 25, 2024
1 parent a36283f commit 1779979
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion files/scripts/healdata/heal-cedar-data-ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def get_related_studies(serial_num, guid, hostname):

# the query result key is the record of the metadata. If it doesn't return anything then our query failed.
if len(list(mds_res.keys())) == 0 or len(list(mds_res.keys())) > 1:
print("Query returned nothing for", cedar_instance_id, "CEDAR instance id")
print(f"Query returned nothing for template_instance_ID={cedar_instance_id}&data=true")
continue

# get the key for our mds record
Expand Down Expand Up @@ -394,3 +394,6 @@ def get_related_studies(serial_num, guid, hostname):
offset = offset + limit
if (offset + limit) > total:
limit = total - offset

if limit < 0:
break

0 comments on commit 1779979

Please sign in to comment.