Skip to content

Commit

Permalink
fix validation
Browse files Browse the repository at this point in the history
  • Loading branch information
sainak committed May 21, 2024
1 parent c2f22fc commit 3cf9d34
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions care/facility/api/serializers/patient_consultation.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ def validate_create_symptoms(self, value):

current_time = now()
for obj in value:
if "onset_date" not in obj:
if not obj.get("onset_date"):
raise ValidationError(
{"onset_date": "This field is required for all symptoms"}
)
Expand All @@ -558,8 +558,8 @@ def validate_create_symptoms(self, value):
{"onset_date": "Onset date cannot be in the future"}
)

if "cure_date" in obj:
if obj["cure_date"] < obj["onset_date"]:
if cure_date := obj.get("cure_date"):
if cure_date < obj["onset_date"]:
raise ValidationError(
{"cure_date": "Cure date should be after onset date"}
)
Expand Down

0 comments on commit 3cf9d34

Please sign in to comment.