Fixed formatting for the pushover serivice
This commit is contained in:
@@ -204,10 +204,23 @@ class PushoverService:
|
|||||||
start = period.get("start", "")
|
start = period.get("start", "")
|
||||||
end = period.get("end", "")
|
end = period.get("end", "")
|
||||||
if start and end:
|
if start and end:
|
||||||
# Extract just the time portion
|
# Parse the datetime strings to check if they're on different days
|
||||||
start_time = start.split(" ")[1] if " " in start else start
|
if " " in start and " " in end:
|
||||||
end_time = end.split(" ")[1] if " " in end else end
|
start_date, start_time = start.split(" ")
|
||||||
lines.append(f"Period: {start_time} - {end_time}")
|
end_date, end_time = end.split(" ")
|
||||||
|
|
||||||
|
# If same day, just show times
|
||||||
|
if start_date == end_date:
|
||||||
|
lines.append(f"Period: {start_time} - {end_time}")
|
||||||
|
else:
|
||||||
|
# Different days, show date + time in compact format
|
||||||
|
# Format: "MM-DD HH:MM - MM-DD HH:MM"
|
||||||
|
start_compact = f"{start_date[5:]} {start_time[:5]}"
|
||||||
|
end_compact = f"{end_date[5:]} {end_time[:5]}"
|
||||||
|
lines.append(f"Period: {start_compact} - {end_compact}")
|
||||||
|
else:
|
||||||
|
# Fallback if format is unexpected
|
||||||
|
lines.append(f"Period: {start} - {end}")
|
||||||
|
|
||||||
# Total reservations
|
# Total reservations
|
||||||
total = stats.get("total_reservations", 0)
|
total = stats.get("total_reservations", 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user