Compare commits

...

3 commits

Author SHA1 Message Date
Adam Moussa
702f1fd9a2 Apply ruff formatting to app.py 2026-05-12 18:31:28 -04:00
Cursor Agent
fa563338f0
Include weekend shift type in command confirmations
Co-authored-by: Adam Moussa <amoussa1229@users.noreply.github.com>
2026-05-12 22:17:50 +00:00
Cursor Agent
6f6cdd94e8
Fix weekly schedule fallback start date
Co-authored-by: Adam Moussa <amoussa1229@users.noreply.github.com>
2026-05-12 22:00:04 +00:00
2 changed files with 23 additions and 4 deletions

View file

@ -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,9 @@ 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 +493,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 +583,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:

View file

@ -206,7 +206,7 @@ def handler(event, context):
result = slack.chat_postMessage(
channel=channel_id,
blocks=blocks,
text=f"After-Hours Schedule — {now.strftime('%b %-d')} to {end_date.strftime('%b %-d')}",
text=f"After-Hours Schedule — {this_monday.strftime('%b %-d')} to {end_date.strftime('%b %-d')}",
)
schedule.save_schedule_post(