mirror of
https://github.com/Sea-Haven-Industries/afterhours-shift-manager.git
synced 2026-10-03 23:43:12 +00:00
Include weekend shift type in command confirmations
Co-authored-by: Adam Moussa <amoussa1229@users.noreply.github.com>
This commit is contained in:
parent
6f6cdd94e8
commit
fa563338f0
1 changed files with 24 additions and 3 deletions
|
|
@ -97,6 +97,13 @@ def _is_active_shift_type(shift_type: str) -> bool:
|
|||
return determine_shift_type() == shift_type
|
||||
|
||||
|
||||
def _shift_type_label(day_name: str, shift_type: str) -> str:
|
||||
if day_name not in WEEKEND_DAYS:
|
||||
return ""
|
||||
label = "Day" if shift_type == "day" else "Night"
|
||||
return f" ({label})"
|
||||
|
||||
|
||||
def _find_employee_shift(schedule, date_str, day_name, employee_ext):
|
||||
"""Find which shift type an employee is assigned to on a given date.
|
||||
|
||||
|
|
@ -423,7 +430,11 @@ def create_app(
|
|||
if is_today(date_str) and _is_active_shift_type(shift_type):
|
||||
_update_3cx_routing(employee["extension"])
|
||||
|
||||
respond(text=f"You picked up the shift for *{date.strftime('%A, %b %-d')}*.")
|
||||
date_label = date.strftime("%A, %b %-d")
|
||||
shift_label = _shift_type_label(day_name, shift_type)
|
||||
respond(
|
||||
text=f"You picked up the shift for *{date_label}*{shift_label}."
|
||||
)
|
||||
|
||||
blocks = build_shift_change_message(
|
||||
user_id,
|
||||
|
|
@ -484,8 +495,13 @@ def create_app(
|
|||
if is_today(date_str) and _is_active_shift_type(shift_type):
|
||||
_update_3cx_routing(FALLBACK_EXTENSION)
|
||||
|
||||
date_label = date.strftime("%A, %b %-d")
|
||||
shift_label = _shift_type_label(day_name, shift_type)
|
||||
respond(
|
||||
text=f"You dropped the shift for *{date.strftime('%A, %b %-d')}*. It's now open for pickup."
|
||||
text=(
|
||||
f"You dropped the shift for *{date_label}*{shift_label}. "
|
||||
"It's now open for pickup."
|
||||
)
|
||||
)
|
||||
|
||||
blocks = build_shift_change_message(
|
||||
|
|
@ -569,8 +585,13 @@ def create_app(
|
|||
target["name"],
|
||||
shift_type=shift_type,
|
||||
)
|
||||
date_label = date.strftime("%A, %b %-d")
|
||||
shift_label = _shift_type_label(day_name, shift_type)
|
||||
respond(
|
||||
text=f"Swapped *{date.strftime('%A, %b %-d')}* to {target['name']} (Ext {target['extension']})."
|
||||
text=(
|
||||
f"Swapped *{date_label}*{shift_label} to {target['name']} "
|
||||
f"(Ext {target['extension']})."
|
||||
)
|
||||
)
|
||||
|
||||
try:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue