Skip to content
This repository has been archived by the owner on Jul 18, 2023. It is now read-only.

Commit

Permalink
Ensure PCR Replicate invalid is never recalculated when invalid_overr…
Browse files Browse the repository at this point in the history
…ide is not null (this was already guarded against withinin the calc_invalid method, but this update prevents that method from even being called, thus improving response time)
  • Loading branch information
aaronstephenson committed Jul 31, 2019
1 parent 9b3cef8 commit c01745e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion code.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "lide",
"organization": "U.S. Geological Survey",
"description": "Web services for LILI (LIDE (Laboratory for Infectious Disease and the Environment) Information Management System)",
"version": "v0.114.0",
"version": "v0.114.1",
"status": "Release Candidate",

"permissions": {
Expand Down
2 changes: 1 addition & 1 deletion lideservices/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def recalc_reps(level, level_id, target=None, recalc_rep_conc=True, recalc_inval
for rep in reps:
if recalc_rep_conc:
rep.replicate_concentration = rep.calc_rep_conc()
if recalc_invalid:
if recalc_invalid and rep.invalid_override is None:
rep.invalid = rep.calc_invalid()
if recalc_rep_conc or recalc_invalid:
rep.save()
Expand Down
10 changes: 6 additions & 4 deletions lideservices/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1187,8 +1187,9 @@ def update(self, instance, validated_data):
self.child.pcrreplicate_batch.target.id)
# calculate the invalidity
for rep in reps:
rep.invalid = rep.calc_invalid()
rep.save()
if rep.invalid_override is None:
rep.invalid = rep.calc_invalid()
rep.save()

return ret

Expand Down Expand Up @@ -1244,8 +1245,9 @@ def update(self, instance, validated_data):
pcrreplicate_batch__target__exact=instance.pcrreplicate_batch.target.id)
# calculate the invalidity
for rep in reps:
rep.invalid = rep.calc_invalid()
rep.save()
if rep.invalid_override is None:
rep.invalid = rep.calc_invalid()
rep.save()

instance.save()

Expand Down
5 changes: 3 additions & 2 deletions lideservices/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1069,8 +1069,9 @@ def bulk_load_negatives(self, request):
# recalc the child rep validity
reps = PCRReplicate.objects.filter(pcrreplicate_batch=item.data['id'])
for rep in reps:
rep.invalid = rep.calc_invalid()
rep.save()
if rep.invalid_override is None:
rep.invalid = rep.calc_invalid()
rep.save()
response_data.append(item.data)
return JsonResponse(response_data, safe=False, status=200)
else:
Expand Down

0 comments on commit c01745e

Please sign in to comment.