Skip to content

Commit

Permalink
Pop "patient_category" in local validated_data instead of `self.val…
Browse files Browse the repository at this point in the history
…idated_data` (#1471)

fixes #1470, pop in local `validated_data`
  • Loading branch information
rithviknishad authored Jul 22, 2023
1 parent 890eeca commit 79356a1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions care/facility/api/serializers/shifting.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ def update(self, instance, validated_data):
new_instance = super().update(instance, validated_data)

patient = new_instance.patient
patient_category = self.validated_data.pop("patient_category")
patient_category = validated_data.pop("patient_category")
if patient.last_consultation and patient_category is not None:
patient.last_consultation.category = patient_category
patient.last_consultation.save(update_fields=["category"])
Expand Down Expand Up @@ -394,7 +394,7 @@ def create(self, validated_data):
patient.allow_transfer = True
patient.save()

patient_category = self.validated_data.pop("patient_category")
patient_category = validated_data.pop("patient_category")
if patient.last_consultation and patient_category is not None:
patient.last_consultation.category = patient_category
patient.last_consultation.save(update_fields=["category"])
Expand Down

0 comments on commit 79356a1

Please sign in to comment.