Repository navigation
Add an optional time to add_food_entry and add_note - #91
Merged
Merged
Conversation
Entries and notes were always stamped with the current time, so logging a meal late put it at the wrong time of day and, with diary_group "auto", in the wrong meal slot. add_food_entry and add_note now take time (HH:MM or HH:MM:SS, account timezone). It sets the stamped time and picks the auto group; omitted, behaviour is unchanged for food entries. Notes now carry time and offset in the /photoupload form, as the app's own notes do (checked against the live API). The offset is the UTC offset in force on the note's own date and time in the account zone, so a note backfilled across a DST change is right. update_note sends the stored time and offset back so an edit keeps them. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
rwestergren
approved these changes
Nov 22, 2026
Contributor
Author
|
Thanks for merging this so quickly, and for #92. I checked it against my own account (DG01 is Breakfast and Uncategorized is group 4): "breakfast" resolves to group 0, "Uncategorized" to group 4, and "auto" picks the right slot by time of day. I also wrote one test note to each group and they read back in the right group, then removed them. Everything worked as expected. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Entries and notes are always stamped with the current time. Logging a meal late therefore puts it at the wrong time of day and, with
diary_group="auto", in the wrong meal slot. This adds an optionaltimeargument.What it does
add_food_entryandadd_notetaketime(24-hourHH:MMorHH:MM:SS, in the account timezone). It sets the stamped time and drives the"auto"slot through the existing_meal_group_for_hour. A bad value returns an error and writes nothing.add_servingandadd_notetake a matchingatargument on the client.timeandoffsetin the/photouploadform, as the app's own notes do. I checked this against the live API: both fields are stored and come back on read.update_notesends the stored time and offset back, so an edit keeps them.Behavior changes
timeis omitted.timeis omitted (the current time).Not included: nothing in this PR changes meal-group handling. That's tracked in #90.
timeonly feeds the existing hour-to-group function, so it works with whatever #90 decides.Tests: 14 new tests, covering time passing through the tools, invalid times,
atdriving the auto group, the offset across DST, andupdate_notekeeping time and offset. Ruff,ruff format --checkand the full suite pass.🤖 Generated with Claude Code