Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Production release v24.34.2 #2378

Merged
merged 6 commits into from
Aug 21, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion care/facility/api/serializers/patient_consultation.py
Original file line number Diff line number Diff line change
@@ -555,7 +555,9 @@ def validate_create_symptoms(self, value):
if item in counter:
# Reject if duplicate symptoms are provided
raise ValidationError("Duplicate symptoms are not allowed")
counter.add(item)
if not obj.get("cure_date"):
# skip duplicate symptom check for ones that has cure date
counter.add(item)

current_time = now()
for obj in value:
31 changes: 31 additions & 0 deletions care/facility/tests/test_encounter_symptom_api.py
Original file line number Diff line number Diff line change
@@ -114,6 +114,37 @@ def test_create_consultation_with_duplicate_symptoms(self):
{"create_symptoms": ["Duplicate symptoms are not allowed"]},
)

def test_create_consultation_with_duplicate_cured_symptoms(self):
data = self.consultation_data.copy()
data["create_symptoms"] = [
{
"symptom": Symptom.FEVER,
"onset_date": now(),
"cure_date": now(),
},
{
"symptom": Symptom.FEVER,
"onset_date": now(),
},
{
"symptom": Symptom.OTHERS,
"other_symptom": "Other Symptom",
"onset_date": now(),
"cure_date": now(),
},
{
"symptom": Symptom.OTHERS,
"other_symptom": "Other Symptom",
"onset_date": now(),
},
]
response = self.client.post(
"/api/v1/consultation/",
data,
format="json",
)
self.assertEqual(response.status_code, status.HTTP_201_CREATED)

def test_create_consultation_with_no_symptom(self):
data = self.consultation_data.copy()