Repository navigation
Show the marks for a vial that is past its date - #143
Merged
Merged
Conversation
Reported with screenshots: marks disappear from the daily overview the day a vial goes past its beyond-use date, while the Stock page goes on showing them correctly. Reported as patronising, and it is, but nobody decided it. vialUsable means two things at once. There is nothing here to take, which is finished, discarded, on order or empty. And this is past its date, which is a warning. Every reader inherits both meanings whether it wants them or not, and marksForDose wanted only the first: marks are what the syringe would read, they follow from the concentration, and a date does not change a concentration. Stock was right by accident. A row calls marksFromVial on its own vial and never asks the picker, so it never inherited the second meaning. The marks now fall back to the freshest made-up vial that is only disqualified by its date, which is the one in the fridge door. Only reconstituted vials, since marksFromVial answers for no other kind: a sealed powder has no concentration to read. An expired vial with nothing left in it, or one that was finished or thrown away, still says nothing. Deliberately narrow. What the app will draw from, what it counts as stock, and what a logged dose is attributed to are all untouched. Those are the same predicate read for its other meaning, and whether a vial past its date should still supply a dose is the owner's decision rather than a bug fix. Worth saying that the complaint will return one step later: the reporter can now read the dose and still cannot log it against that vial. The general shape is in 06-traps.md: a predicate that combines a capability with a warning will be read by somebody who wanted only one of them.
|
Someone is attempting to deploy a commit to the Arun's projects Team on Vercel. A member of the Team first needs to authorize it. |
suskozaver
pushed a commit
that referenced
this pull request
Oct 3, 2026
#143 did not work, and the way it failed is worth more than the fix. It gave the marks a fallback of their own: when no vial is drawable, read the freshest open one past its date. It passed every test and did nothing on the screen it was written for, because the person checking it had four sealed vials of the same compound in the fridge. Sealed vials are drawable, so the picker returned one, the fallback never ran, and a sealed vial has no concentration to read. Worse, that same picker had been drawing his one-tap dose that morning out of a sealed vial nobody had made up. An existing test required it: "skips an expired open vial and reaches for the sealed one". It is reversed here, deliberately, and says why. The owner's decision, given in as many words: the dose comes out of the open vial in his hand, and the marks show. So it is now one rule in one place. drawableVials is the list the log form offers and the picker chooses from. It holds anything with something left to take that is either within its date or already open. An open vial past its beyond-use date is still the one in the fridge door; a sealed one past the manufacturer's date stays out, because nobody is midway through it and breaking into one is not the app's call. pickVialForDose reaches for an open vial within date first, then an open one past its date, the freshest by the date it passed, and only then a sealed one. marksForDose reads whatever the picker returns and has no rule of its own any more; the fallback from #143 is gone. The log form lists the same vials the picker chooses from, so it can never pre-select something its own dropdown does not contain, and a vial past its date says so in its option. Stock figures are unchanged in meaning: available is what is within date, and the rest is reported as expired. Only the nudge to reconstitute stops firing when an open vial past its date is what the next dose will come from, since it would otherwise contradict the picker. Checked against the reporter's own export: the picker now returns his open Retatrutide vial, and the marks read 30, which is 1.5 mg at 5000 mcg/mL on a U-100 barrel.
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.
Reported with screenshots: marks disappear from the daily overview the day a vial goes past its beyond-use date, while the Stock page goes on showing them correctly. Reported as patronising, and it is, but nobody decided it.
One predicate answering two questions
vialUsablemeans two things at once:The first is a fact about whether a vial can supply anything. The second is a warning. Every reader of that predicate inherits both meanings whether it wants them or not, and
marksForDosewanted only the first. Marks are what the syringe would read; they follow from the concentration; a date does not change a concentration.Stock was right by accident. A row calls
marksFromVialon its own vial and never asks the picker, so it never inherited the second meaning. Two screens answering the same question by different paths is how the disagreement became visible at all.The fix
The marks fall back to the freshest made-up vial that is only disqualified by its date, which is the one in the fridge door. Only reconstituted vials, since
marksFromVialanswers for no other kind: a sealed powder has no concentration to read. An expired vial with nothing left in it, or one that was finished or thrown away, still says nothing.Deliberately narrow, and worth your decision
What the app will draw from, what it counts as stock, and what a logged dose is attributed to are untouched. They read the same predicate for its other meaning.
So the complaint will come back one step later: the reporter can now read the dose off the overview and still cannot select that vial in the log form, which means logging it moves no stock. Whether a vial past its beyond-use date should still be allowed to supply a dose is your call rather than a bug fix, which is why it is not in here. Say the word and it is a small change in two places.
06-traps.mdhas the general shape: a predicate that combines a capability with a warning will be read by somebody who wanted only one of them.Checks
npx tsc --noEmitclean,npx next lintclean, 1736 tests pass (10 new).