Fix expressed feeds showing duration instead of ml amount#1
Closed
Fix expressed feeds showing duration instead of ml amount#1
Conversation
The display logic checked duration_seconds before amount_ml regardless of feed type. When an expressed feed was edited and times changed, the backend recalculated duration_seconds (intended only for breast feeds), causing the UI to show a duration instead of the ml amount. - Frontend: use entry.type to decide display format (breast → duration, formula/expressed → ml) - Backend: only recalculate duration_seconds for breast feed entries https://claude.ai/code/session_01HMNC1Vw48E32d6qkNrWzke
Formula and expressed feeds are instant events where started_at and ended_at are set to the same timestamp on creation. When editing the time, only started_at was updated, leaving ended_at stale. Now the backend keeps them in sync for non-breast feed types. https://claude.ai/code/session_01HMNC1Vw48E32d6qkNrWzke
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.
Summary
entry.typeto decide format — breast feeds show duration, formula/expressed feeds always show ml amountduration_secondsfrom being set on expressed/formula entriesRoot cause
The display conditional checked
duration_secondsbeforeamount_mlregardless of feed type. When an expressed feed was edited (changing times), the backend recalculatedduration_seconds— which was intended only for breast feeds. Once set, the UI prioritized duration over the ml amount.Test plan
bun test src/pages/Feed.test.tsx— 16 tests passbun test worker/test/http/feed.http.test.ts— 10 tests passhttps://claude.ai/code/session_01HMNC1Vw48E32d6qkNrWzke