Repository navigation
Add update_food_entry tool to edit or move a logged entry - #76
Open
paultristanwagner wants to merge 1 commit into
Open
paultristanwagner wants to merge 1 commit into
paultristanwagner wants to merge 1 commit into
Conversation
The app changes a serving's amount with /api/v2/edit_serving, re-sending the whole serving. The meal group lives in the high bits of `order`, and edit_serving accepts a new order too, so one call changes the amount, the measure and the meal. Claude-Session: https://claude.ai/code/session_01MCJFDo71qoSqTRtcGfkpXJ
9 tasks
This branch has not been deployed
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.
Part of #73.
Adds an
update_food_entrytool: change a logged entry's amount ormeasure, or move it to another meal. Until now the only way was to remove
the entry and log it again.
The app changes an amount with
POST /api/v2/edit_serving, sending the whole serving back with thenew
grams:{"serving": {"servingId": …, "day": …, "order": 65537, "foodId": …, "measureId": …, "grams": 400.0, …}, "auth": {…}, "config": {"call_version": 2}}The meal group lives in the high bits of
order, asadd_servingalreadybuilds it (
(group << 16) | position). The app moves an entry with aseparate
POST /api/v2/update_order{"diaryEntries": [<serving with new order>]}, butedit_servingaccepts a newordertoo, so one call doesboth. Verified against the live API on 1900-01-02: amount, meal and both at
once.
Changes:
update_serving(serving_id, day, *, grams, measure_id, diary_group)reads the serving fromget_diary, changes the givenfields and sends it back. A moved entry goes to the end of its new meal;
staying in the same meal keeps its position. Arguments are validated
before any request.
update_food_entrytool. The meal-name map thatadd_food_entrybuilt inline is now a module constant both tools use.https://claude.ai/code/session_01MCJFDo71qoSqTRtcGfkpXJ