fix(wellness): harden Form/TSB and date rendering from code review
Address findings from the pre-merge review: - Form (TSB) now computes only when ctl/atl are numeric (isinstance guard), so a non-numeric value can no longer raise out of format_wellness_entry and take down the entire wellness render. - The Date line uses `or` chaining so a present-but-null `date` falls back to `id` instead of rendering "Date: None". - update_wellness injects the written date into the API echo when it lacks id/date, so the confirmation body can't read "Date: N/A" under a dated header. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NGzHtDvJur9U7ysgRKRUTN
This commit is contained in:
@@ -180,6 +180,10 @@ async def update_wellness( # pylint: disable=too-many-arguments,too-many-positi
|
||||
return f"Error updating wellness data: {result.get('message')}"
|
||||
|
||||
# Intervals.icu echoes back the full updated record; render it for confirmation.
|
||||
# If the echo omits the date, inject the one we wrote to so the confirmation
|
||||
# body doesn't read "Date: N/A" under a dated header.
|
||||
if isinstance(result, dict):
|
||||
if not result.get("id") and not result.get("date"):
|
||||
result["date"] = date
|
||||
return f"Updated wellness for {date}:\n\n" + format_wellness_entry(result)
|
||||
return f"Updated wellness for {date}."
|
||||
|
||||
Reference in New Issue
Block a user