feat(cli): add new schedule member by name feature
This commit is contained in:
@@ -213,12 +213,12 @@ class ScheduleRepository(BaseRepository[ScheduleModel]):
|
||||
# ------------------------------------------------------------------
|
||||
def has_schedule_on_date(self, member_id: int, service_date: str) -> bool:
|
||||
"""
|
||||
Return ``True`` if *any* schedule (regardless of status) exists for
|
||||
Return ``True`` if any *active* schedule (pending or accepted) exists for
|
||||
``member_id`` on the calendar day ``service_date`` (format YYYY‑MM‑DD).
|
||||
|
||||
This abstracts the “a member can only be scheduled once per day”
|
||||
This abstracts the "a member can only be actively scheduled once per day"
|
||||
rule so the service layer does not need to know the underlying
|
||||
table layout.
|
||||
table layout. Declined schedules do not count as blocking.
|
||||
"""
|
||||
sql = f"""
|
||||
SELECT 1
|
||||
@@ -226,9 +226,10 @@ class ScheduleRepository(BaseRepository[ScheduleModel]):
|
||||
JOIN Services AS sv ON s.ServiceId = sv.ServiceId
|
||||
WHERE s.MemberId = ?
|
||||
AND sv.ServiceDate = ?
|
||||
AND s.Status IN (?, ?)
|
||||
LIMIT 1
|
||||
"""
|
||||
row = self.db.fetchone(sql, (member_id, service_date))
|
||||
row = self.db.fetchone(sql, (member_id, service_date, ScheduleStatus.PENDING.value, ScheduleStatus.ACCEPTED.value))
|
||||
return row is not None
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user