mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-15 23:12:04 +00:00
fix(visits): reach every lab result, condition, document and visit from the link pickers
The visit form's lab picker offered the newest 200 results, the condition picker the newest 100 conditions, the document pickers the newest thousand documents and the document sheet's visit picker the newest 100 visits. On a long record everything older could not be linked. Each picker now opens on the records around the date of the thing being linked, pages older and newer from there, and searches through the list route itself. Records already linked always show, from the labels the record's own read carries and from what was picked in the sheet. The lab list takes a q filter over analyte and panel, the condition list from/to/q/offset/sortDir, and the visit list an offset.
This commit is contained in:
1 parent
dad9a7778e
commit
73c4dda224
35 files changed
+1714
-251
No files matched your search
@@ -1,11 +1,11 @@
|
||||
/**
|
||||
* One key, one fetch. The visit form's link pickers read labs and illness
|
||||
* episodes with their own page size (200 results, 100 episodes), the Labs
|
||||
* list and the illness hook with theirs (500, the route's default 50). Under
|
||||
* a shared key whichever read landed first served the other, so the picker
|
||||
* could offer 50 episodes or the Labs list could render a 200-row page as
|
||||
* the whole list. The picker reads carry their own keys, still under the
|
||||
* domain roots so a lab or episode write evicts them.
|
||||
* episodes in their own windows and pages, the Labs list and the illness hook
|
||||
* with theirs. Under a shared key whichever read landed first served the
|
||||
* other, so the picker could offer 50 episodes or the Labs list could render
|
||||
* a picker page as the whole list. The picker reads carry their own keys,
|
||||
* still under the domain roots so a lab or episode write evicts them, and
|
||||
* each direction, split and term is its own key.
|
||||
*/
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
@@ -22,20 +22,36 @@ const LIST_PARAMS = {
|
||||
|
||||
describe("the link pickers' reads have keys of their own", () => {
|
||||
it("labs: differs from the Labs list and sits under the lab root", () => {
|
||||
const key = queryKeys.labResultsPicker(200);
|
||||
const key = queryKeys.labResultsPicker("older", null, "");
|
||||
expect(key).not.toEqual(queryKeys.labResultsList(LIST_PARAMS));
|
||||
expect(key.slice(0, 1)).toEqual(queryKeys.labResults());
|
||||
});
|
||||
|
||||
it("episodes: differs from the illness list and sits under the illness root", () => {
|
||||
const key = queryKeys.illnessEpisodesPicker(100);
|
||||
const key = queryKeys.illnessEpisodesPicker("older", null, "");
|
||||
expect(key).not.toEqual(queryKeys.illnessEpisodes(true));
|
||||
expect(key.slice(0, 1)).toEqual(queryKeys.illness());
|
||||
});
|
||||
|
||||
it("a different page size is a different key", () => {
|
||||
expect(queryKeys.labResultsPicker(200)).not.toEqual(
|
||||
queryKeys.labResultsPicker(500),
|
||||
it("a different direction, split or term is a different key", () => {
|
||||
const base = queryKeys.labResultsPicker("older", "2019-05-17", "");
|
||||
expect(base).not.toEqual(
|
||||
queryKeys.labResultsPicker("newer", "2019-05-17", ""),
|
||||
);
|
||||
expect(base).not.toEqual(
|
||||
queryKeys.labResultsPicker("older", "2020-01-01", ""),
|
||||
);
|
||||
expect(queryKeys.labResultsPicker("search", null, "a")).not.toEqual(
|
||||
queryKeys.labResultsPicker("search", null, "b"),
|
||||
);
|
||||
});
|
||||
|
||||
it("documents and visits: under their roots", () => {
|
||||
expect(
|
||||
queryKeys.inboundDocumentVaultPicker("older", null, "").slice(0, 1),
|
||||
).toEqual(["documents"]);
|
||||
expect(queryKeys.encounterPicker("older", null, "").slice(0, 1)).toEqual(
|
||||
queryKeys.encounters(),
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user