Skip to content

Commit

Permalink
Do not sync empty contacts not having URNs set
Browse files Browse the repository at this point in the history
  • Loading branch information
norkans7 committed Sep 9, 2024
1 parent 8eea669 commit b3319a7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ureport/backend/rapidpro.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ def local_kwargs(self, org, remote):
if reporter_group.lower() not in contact_groups_names:
return None

if not remote.urns:
return None

org_state_boundaries_data, org_district_boundaries_data, org_ward_boundaries_data = self.get_boundaries_data(
org
)
Expand Down
19 changes: 19 additions & 0 deletions ureport/backend/tests/test_rapidpro.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,25 @@ def test_local_kwargs(self):

self.assertIsNone(self.syncer.local_kwargs(self.nigeria, temba_contact))

temba_contact = TembaContact.create(
uuid="C-006",
name="Jan",
urns=[],
groups=[ObjectRef.create(uuid="G-001", name="ureporters"), ObjectRef.create(uuid="G-007", name="Actors")],
fields={
"registration_date": None,
"state": None,
"lga": None,
"occupation": None,
"born": None,
"gender": None,
},
language="eng",
created_on=json_date_to_datetime("2013-01-02T03:04:05.000"),
)

self.assertIsNone(self.syncer.local_kwargs(self.nigeria, temba_contact))

temba_contact = TembaContact.create(
uuid="C-006",
name="Jan",
Expand Down

0 comments on commit b3319a7

Please sign in to comment.