mirror of
https://github.com/SpudGunMan/meshing-around.git
synced 2026-07-21 09:02:33 +02:00
refactor Alerts 🚨
This commit is contained in:
@@ -254,6 +254,8 @@ def get_overdue_checkins():
|
|||||||
return []
|
return []
|
||||||
|
|
||||||
def format_overdue_alert():
|
def format_overdue_alert():
|
||||||
|
header = "⚠️ OVERDUE CHECK-INS:\n"
|
||||||
|
alert = ''
|
||||||
try:
|
try:
|
||||||
"""Format overdue check-ins as an alert message"""
|
"""Format overdue check-ins as an alert message"""
|
||||||
overdue = get_overdue_checkins()
|
overdue = get_overdue_checkins()
|
||||||
@@ -261,8 +263,6 @@ def format_overdue_alert():
|
|||||||
logger.debug(f"Overdue check-ins: {overdue}")
|
logger.debug(f"Overdue check-ins: {overdue}")
|
||||||
if not overdue:
|
if not overdue:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
alert = "⚠️ OVERDUE CHECK-INS:\n"
|
|
||||||
for entry in overdue:
|
for entry in overdue:
|
||||||
hours = entry['overdue_minutes'] // 60
|
hours = entry['overdue_minutes'] // 60
|
||||||
minutes = entry['overdue_minutes'] % 60
|
minutes = entry['overdue_minutes'] % 60
|
||||||
@@ -275,8 +275,8 @@ def format_overdue_alert():
|
|||||||
if entry['checkin_notes']:
|
if entry['checkin_notes']:
|
||||||
alert += f" 📝{entry['checkin_notes']}"
|
alert += f" 📝{entry['checkin_notes']}"
|
||||||
alert += "\n"
|
alert += "\n"
|
||||||
|
if alert:
|
||||||
return alert.rstrip()
|
return header + alert.rstrip()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Checklist: Error formatting overdue alert: {e}")
|
logger.error(f"Checklist: Error formatting overdue alert: {e}")
|
||||||
return None
|
return None
|
||||||
|
|||||||
Reference in New Issue
Block a user