Skip to content

Fix/jst dates and recipe duplicates - #2

Merged
shim369 merged 3 commits into
mainfrom
fix/jst-dates-and-recipe-duplicates
Sep 27, 2026
Merged

shim369 merged 3 commits into
mainfrom
fix/jst-dates-and-recipe-duplicates

Conversation

@shim369

@shim369 shim369 commented Sep 27, 2026

Copy link
Copy Markdown
Owner

No description provided.

shim369 and others added 3 commits September 26, 2026 16:49
The Today page took its default date/time from the server clock (UTC on
Streamlit Community Cloud) while combine_jst_to_utc interprets the input
as JST, so entries saved with the default time were recorded 9 hours
early and the page opened on the previous day between 0:00 and 8:59 JST.

Daily features, ML real-data loading and RecommendationService also
bucketed logs by UTC date, counting morning JST logs toward the previous
day and disagreeing with the dashboard's JST day boundary.

Add health_intelligence.local_time as the single source of the app
timezone and route both paths through it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
recipe_ingredients is keyed by (recipe_id, ingredient_id), so an AI
response listing the same ingredient twice (e.g. salt for seasoning and
finishing) failed on save. Because the AI result is cached before the
save, retrying with the same ingredients kept failing until restart.

Merge ingredients case-insensitively (trimmed) before get-or-create,
summing amounts when units match and keeping the first otherwise.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add a unique index on lower(ingredients.name) (migration 0010 merges
existing duplicates first). IngredientRepository.add flushes inside a
SAVEPOINT and raises DuplicateKeyError on conflict, so RecipeService can
re-fetch the winning row within the same transaction.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@shim369
shim369 merged commit f77d22a into main Sep 27, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant