Skip to content

Commit 4767a27

Browse files
authored
fix bed allocation overlap (#1526)
Signed-off-by: Aakash Singh <[email protected]>
1 parent 60ade09 commit 4767a27

File tree

1 file changed

+3
-1
lines changed
  • care/facility/api/serializers

1 file changed

+3
-1
lines changed

care/facility/api/serializers/bed.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,9 @@ def validate(self, attrs):
227227
)
228228

229229
# Conflict checking logic
230-
existing_qs = ConsultationBed.objects.filter(consultation=consultation)
230+
existing_qs = ConsultationBed.objects.filter(bed=bed).exclude(
231+
consultation=consultation
232+
)
231233
if existing_qs.filter(start_date__gt=start_date).exists():
232234
raise ValidationError({"start_date": "Cannot create conflicting entry"})
233235
if end_date:

0 commit comments

Comments
 (0)