mirror of
https://github.com/Sea-Haven-Industries/afterhours-shift-manager.git
synced 2026-09-30 06:43:12 +00:00
Compare commits
3 commits
e14eeaa17f
...
702f1fd9a2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
702f1fd9a2 | ||
|
|
fa563338f0 | ||
|
|
6f6cdd94e8 |
2 changed files with 23 additions and 4 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,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:
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue