Pick candidate resources by whether they actually offer the service
findEligible matched on address, type and skills, so two devices of the same type were interchangeable even when only one of them performed the service. It now also consults the offering table. The filter is conditional on purpose: it only applies once the clinic has registered at least one resource for that service. Applying it unconditionally would leave every environment that has not filled the links in yet without a single free slot overnight — a silent outage caused by a feature they never opted into. When rows do exist but all are inactive the result is empty, which is the honest answer: nobody performs this right now. The service comes from the segment template rather than the root service. One appointment's plan can carry segments from several items, and "who can do this" is a per-item question. Five tests: the filter picking one of two identical devices, the no-rows passthrough, the all-inactive empty, the no-service-argument path still untouched, and the filter stacking with the skill filter. Suite 1277 green — including the 27 existing plan and availability tests, which is what proves the backward-compatible path. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -51,11 +51,11 @@
|
||||
|
||||
| # | مورد | وضعیت | یادداشت |
|
||||
|---|---|---|---|
|
||||
| ۳.۱ | `findEligible()` آرگومان `?ServiceItem` گرفت | ⏳ | |
|
||||
| ۳.۲ | سازگاری عقبرو: بدون ردیف = بدون فیلتر | ⏳ | |
|
||||
| ۳.۳ | `AppointmentPlanBuilder` سرویس را پاس میدهد | ⏳ | |
|
||||
| ۳.۴ | تست: دو منبع، یکی وصل → assignment همان یکی | ⏳ | |
|
||||
| ۳.۵ | تست: غیرفعالکردن ردیف → slots خالی با reason | ⏳ | |
|
||||
| ۳.۱ | `findEligible()` آرگومان `?ServiceItem` گرفت | ✅ | `findEligible($address, $type, $skillIds, ?ServiceItem $service)` |
|
||||
| ۳.۲ | سازگاری عقبرو: بدون ردیف = بدون فیلتر | ✅ | `hasAnyFor()` دروازه است: بدون ردیف فیلتری اعمال نمیشود — `testWithoutAnyOfferingTheFilterIsNotAppliedAtAll` |
|
||||
| ۳.۳ | `AppointmentPlanBuilder` سرویس را پاس میدهد | ✅ | سرویس از `$template->getService()` میآید نه سرویس ریشه، چون یک برنامه میتواند بخشهایی از چند آیتم داشته باشد |
|
||||
| ۳.۴ | تست: دو منبع، یکی وصل → assignment همان یکی | ✅ | `testOnlyTheResourceThatOffersTheServiceIsEligible` — از دو دستگاه همنوع، فقط وصلشده |
|
||||
| ۳.۵ | تست: غیرفعالکردن ردیف → slots خالی با reason | ✅ | `testDeactivatingEveryOfferingLeavesNoCandidate` → آرایهٔ خالی؛ بهعلاوه ترکیب با فیلتر مهارت و مسیر بدون سرویس |
|
||||
|
||||
## ۴. منبع و snapshot روی نوبت
|
||||
|
||||
|
||||
Reference in New Issue
Block a user