Skip to content

Commit

Permalink
fix bed allocation overlap (#1526)
Browse files Browse the repository at this point in the history
Signed-off-by: Aakash Singh <[email protected]>
  • Loading branch information
sainak authored Aug 19, 2023
1 parent 60ade09 commit 4767a27
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion care/facility/api/serializers/bed.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,9 @@ def validate(self, attrs):
)

# Conflict checking logic
existing_qs = ConsultationBed.objects.filter(consultation=consultation)
existing_qs = ConsultationBed.objects.filter(bed=bed).exclude(
consultation=consultation
)
if existing_qs.filter(start_date__gt=start_date).exists():
raise ValidationError({"start_date": "Cannot create conflicting entry"})
if end_date:
Expand Down

0 comments on commit 4767a27

Please sign in to comment.