Repository navigation
Conversation
Parse factsheet dose ranges with parseDoseRangeMg: convert ng, ug/µg, mg and g to milligrams, require two explicit endpoints, and leave open-ended doses, rates (ug/hr), per-kg doses and reversed ranges out of the chart. The table still shows every dose as written, and the chart is hidden when nothing can be plotted. Closes #303. Remove branches that could never run: the null guards in addDurations and the duration tooltip (durationTiming only holds defined entries), the "unknown" ban-status fallback, the redundant status checks in canReappeal and canShowReminder (their callers already filter by status), and the "Appeal Accepted" card in the has_appeal view. Simplify the appeal token refresh to share one pending refresh promise and keep the refresh interval in the effect's scope. Add tests so statements, branches, functions and lines reach 100%. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
Closes #303.
Dose chart (#303).
addDosagesnow parses each dose with a newparseDoseRangeMgutil:800-1500ug(0.8–1.5) and1.5-3mgshare one axis.325mg-650mg).3mg+), rates (25-50ug/hr), per-kg doses, single values, unitless and reversed ranges. Open-ended doses are no longer drawn with an invented 1.5× upper bound.Unreachable code removed (to keep branch coverage meaningful under the 90% CI gate from #311):
DrugInfo.tsx: null guards inaddDurationsand the duration tooltip.durationTimingonly ever holds defined entries.appeal.tsx: the"unknown"ban-status fallback (hasAppealimpliesappealis set), and the status checks incanReappeal/canShowReminder(callers already filter byDENIED/RECEIVED).appeal.tsx: the "Appeal Accepted!" card inside thehas_appealview. Reviewer note: it could only appear for a moment right after submitting a new appeal, whilelatestAppealstill held the previous accepted one and beforecheckBan()refreshed it. Showing "Appeal Accepted / Join Discord" there was misleading. Accepted appeals still show in the not-banned view.Appeal token refresh. Concurrent callers share one pending refresh promise (dropped the separate
isRefreshingRefflag), and the refresh interval lives in the effect's scope rather than a ref. Behavior is unchanged; new tests cover a slow ban check overlapping a refresh, and a submission sharing a background refresh.Tests. New and extended tests bring statements, branches, functions and lines to 100%.
DrugInfo.test.tsxkeeps the literal tooltip assertion style from d391a7c, updated for the mg values.Type of change
Checklist
uat(this PR targetsuat, notmain)npx eslint .) (0 errors; 1 existing warning tracked in Tworeact-hooks/set-state-in-effectwarnings (WEB-025) #286)npx next buildsucceeds locally (also type-checks).envvalues, or user data includedTest plan
npm run test:coverage: 29 suites, 152 tests pass; 100% statements, branches, functions and lines.parseDoseRangeMghas fixtures for every form in Factsheet dose chart compares incompatible units and misparses ranges #303 (800-1500ug,1.5-3mg,325mg-650mg,ug/hr) plus mixed µg/mg, open-ended, per-kg, reversed and overflow cases.npx eslint .andnpx next buildpass.🤖 Generated with Claude Code