File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff 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" :
You can’t perform that action at this time.
0 commit comments