Skip to content

Commit 3d29252

Browse files
author
Sanjuro Jogdeo
committed
Fix Ona update
1 parent 4484fd6 commit 3d29252

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

silo/views.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,6 +1022,16 @@ def updateSiloData(request, pk):
10221022
#from ones where we got data delete those records
10231023
unique_field_exist = silo.unique_fields.exists()
10241024
#Unique field means keep the data and update as necessary (which is already implimented so its not necessary to delete anything)
1025+
# Save new records and delete old ones unless it's CommCare. In that
1026+
# case, those functions are handled within the celery tasks.
1027+
if read.type.read_type != 'CommCare':
1028+
if unique_field_exist == False:
1029+
lvs = LabelValueStore.objects(silo_id=silo.pk,__raw__={"read_id" : { "$exists" : "true", "$in" : sources_to_delete }})
1030+
lvs.delete()
1031+
1032+
for x in range(0,len(data[0])):
1033+
for entry in data[1][x]:
1034+
saveDataToSilo(silo,entry,data[0][x],request.user)
10251035

10261036
for read in reads:
10271037
if read.type.read_type == "GSheet Import":

0 commit comments

Comments
 (0)