mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-07 04:12:04 +00:00
Merge pull request #1327 from johnnyrepo026/fix/review-edit-failed-rows
fix(documents): offer the edit control on review rows whose save was refused
This commit is contained in:
commit
a2ce11fec4
3 files changed
+60
-6
No files matched your search
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$comment": "Production functions over 200 lines, keyed \"file :: name\", and their length. Maintained by src/__tests__/source-size-ratchet.test.ts.",
|
||||
"count": 345,
|
||||
"total": 111929,
|
||||
"total": 111930,
|
||||
"entries": {
|
||||
"app/achievements/page.tsx :: AchievementsPage": 206,
|
||||
"app/api/admin/backups/upload/route.ts :: apiHandler(arg)": 275,
|
||||
@@ -93,7 +93,7 @@
|
||||
"components/documents/document-card.tsx :: DocumentCard": 354,
|
||||
"components/documents/document-detail-sheet.tsx :: DocumentDetailSheet": 325,
|
||||
"components/documents/document-facts-review.tsx :: DocumentFactsSection": 242,
|
||||
"components/documents/document-facts-review.tsx :: FactRow": 262,
|
||||
"components/documents/document-facts-review.tsx :: FactRow": 263,
|
||||
"components/documents/document-filter-bar.tsx :: DocumentFilterBar": 348,
|
||||
"components/documents/document-record-links.tsx :: DocumentRecordLinks": 202,
|
||||
"components/documents/document-timeline.tsx :: DocumentTimeline": 314,
|
||||
|
||||
@@ -8,7 +8,7 @@ import type {
|
||||
InboundDocumentDetailDto,
|
||||
} from "@/lib/validations/inbound-documents";
|
||||
|
||||
import { DocumentFactsSection } from "../document-facts-review";
|
||||
import { DocumentFactsSection, FactRow } from "../document-facts-review";
|
||||
|
||||
/**
|
||||
* The staged-facts block's honest states, pinned by static render:
|
||||
@@ -173,3 +173,56 @@ describe("<DocumentFactsSection>", () => {
|
||||
expect(html).toBe("");
|
||||
});
|
||||
});
|
||||
|
||||
describe("<FactRow>", () => {
|
||||
// A confident lab value the last save refused (here a ratio printed without
|
||||
// a unit) gets the same edit control as a low-confidence one: it is the only
|
||||
// way to add the unit and finish the review.
|
||||
const unitless = fact({
|
||||
data: {
|
||||
label: "Ratio",
|
||||
code: null,
|
||||
codeSystem: null,
|
||||
value: 4.2,
|
||||
valueText: null,
|
||||
unit: null,
|
||||
referenceLow: null,
|
||||
referenceHigh: 5,
|
||||
referenceText: "<5.0",
|
||||
effectiveDate: "2026-08-01",
|
||||
},
|
||||
provenance: {
|
||||
sourceText: "Ratio 4.2 <5.0",
|
||||
anchored: true,
|
||||
sourceOffset: 10,
|
||||
page: 0,
|
||||
confidence: 0.95,
|
||||
},
|
||||
});
|
||||
|
||||
const rowProps = {
|
||||
documentId: "doc-1",
|
||||
checked: true,
|
||||
onCheckedChange: () => {},
|
||||
chosenBiomarkerId: null,
|
||||
onChooseBiomarker: () => {},
|
||||
markerName: () => null,
|
||||
};
|
||||
|
||||
it("offers the edit control on a confident row whose save was refused", () => {
|
||||
const html = render(
|
||||
<FactRow
|
||||
{...rowProps}
|
||||
fact={unitless}
|
||||
failure="observation.unitRequired"
|
||||
/>,
|
||||
);
|
||||
expect(html).toContain('data-slot="document-fact-verify-open"');
|
||||
expect(html).toContain("A numeric value needs a unit");
|
||||
});
|
||||
|
||||
it("leaves a confident row without a refusal free of the edit control", () => {
|
||||
const html = render(<FactRow {...rowProps} fact={fact()} failure={null} />);
|
||||
expect(html).not.toContain('data-slot="document-fact-verify-open"');
|
||||
});
|
||||
});
|
||||
@@ -204,8 +204,8 @@ function draftFor(fact: ExtractedFactDto): VerifyDraft {
|
||||
};
|
||||
}
|
||||
|
||||
/** One pending fact: include-toggle, stated values, verify-first when low-confidence. */
|
||||
function FactRow({
|
||||
/** One pending fact: include-toggle, stated values, and the edit control when it is low-confidence or its last save was refused. */
|
||||
export function FactRow({
|
||||
documentId,
|
||||
fact,
|
||||
checked,
|
||||
@@ -319,9 +319,10 @@ function FactRow({
|
||||
</p>
|
||||
) : null}
|
||||
</div>
|
||||
{fact.needsReview && !verifying ? (
|
||||
{(fact.needsReview || failure !== null) && !verifying ? (
|
||||
<Button
|
||||
type="button"
|
||||
data-slot="document-fact-verify-open"
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className="min-h-11 shrink-0 sm:min-h-8"
|
||||
|
||||
Reference in new issue
Block a user