Skip to content

Commit c922a99

Browse files
authored
Merge pull request #28 from AfricasVoices/skip-missing-uuids
Skip missing uuids
2 parents a72704c + 5e50286 commit c922a99

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

fetch_runs/fetch_runs.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,13 @@
9696
# Convert the RapidPro run objects to TracedData.
9797
traced_runs = []
9898
for run in runs:
99+
if run.contact.uuid not in contact_runs:
100+
# Sometimes contact uuids which appear in `runs` do not appear in `contact_runs`.
101+
# I have only observed this happen for contacts which were created very recently.
102+
# This test skips the run in this case; it should be included next time this script is executed.
103+
print("Warning: Run found with uuid '{}', but this id is not present in contacts".format(run.contact.uuid))
104+
continue
105+
99106
contact_urns = contact_runs[run.contact.uuid].urns
100107
# assert len(contact_urns) == 1, "Contact has multiple URNs" TODO: Re-enable once AVF test runs are ignored.
101108
run_dict = {"avf_phone_id": phone_uuids.add_phone(contact_urns[0])}

0 commit comments

Comments
 (0)