mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-15 23:12:04 +00:00
fix(labs): call the date filter "Last measured"
The filter compares only the day of a marker's newest reading, so a marker measured inside the range and again later drops out. "Date range" promised more than that. The pill now reads "Last measured" in every locale, and the from/to semantics are written down where the filter is defined.
This commit is contained in:
1 parent
2e2a0ac4a1
commit
82ad1e2b45
14 files changed
+23
-8
No files matched your search
@@ -44,7 +44,7 @@ describe("<LabFilterRail> layout", () => {
|
||||
const { screen } = await renderWithApp(<LabFilterRail {...props()} />);
|
||||
|
||||
const search = screen.getByRole("searchbox", { name: "Search biomarkers" });
|
||||
const dateRange = screen.getByRole("button", { name: "Date range" });
|
||||
const dateRange = screen.getByRole("button", { name: "Last measured" });
|
||||
const searchRect = search.element().getBoundingClientRect();
|
||||
const dateRect = dateRange.element().getBoundingClientRect();
|
||||
|
||||
@@ -75,7 +75,7 @@ describe("<LabFilterRail> layout", () => {
|
||||
|
||||
const controls = [
|
||||
search.element(),
|
||||
screen.getByRole("button", { name: "Date range" }).element(),
|
||||
screen.getByRole("button", { name: "Last measured" }).element(),
|
||||
screen.getByRole("combobox", { name: "Status: Out of range" }).element(),
|
||||
screen.getByRole("combobox", { name: "Category" }).element(),
|
||||
screen.getByRole("button", { name: "Reset" }).element(),
|
||||
@@ -108,7 +108,7 @@ describe("<LabFilterRail> layout", () => {
|
||||
|
||||
const controls = [
|
||||
screen.getByRole("searchbox", { name: "Biomarker suchen" }).element(),
|
||||
screen.getByRole("button", { name: "Zeitraum" }).element(),
|
||||
screen.getByRole("button", { name: "Zuletzt gemessen" }).element(),
|
||||
screen
|
||||
.getByRole("combobox", {
|
||||
name: "Status: Außerhalb des Bereichs",
|
||||
@@ -130,7 +130,7 @@ describe("<LabFilterRail> layout", () => {
|
||||
const { screen } = await renderWithApp(<LabFilterRail {...props()} />);
|
||||
const controls = [
|
||||
screen.getByRole("searchbox", { name: "Search biomarkers" }).element(),
|
||||
screen.getByRole("button", { name: "Date range" }).element(),
|
||||
screen.getByRole("button", { name: "Last measured" }).element(),
|
||||
screen.getByRole("combobox", { name: "Status" }).element(),
|
||||
screen.getByRole("combobox", { name: "Category" }).element(),
|
||||
];
|
||||
|
||||
@@ -43,7 +43,7 @@ describe("<LabFilterRail>", () => {
|
||||
|
||||
// The shared rail keeps search and all filter dimensions in one ordered row.
|
||||
const searchIdx = html.indexOf('placeholder="Search biomarkers..."');
|
||||
const dateRangeIdx = html.indexOf("Date range");
|
||||
const dateRangeIdx = html.indexOf("Last measured");
|
||||
const statusIdx = html.indexOf("Status");
|
||||
const categoryIdx = html.indexOf("Category");
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ export function LabFilterRail({
|
||||
</div>
|
||||
|
||||
<FilterBarDateRange
|
||||
label={t("dataList.dateRange")}
|
||||
label={t("labs.filter.lastMeasured")}
|
||||
from={filters.fromDay ?? ""}
|
||||
to={filters.toDay ?? ""}
|
||||
onFromChange={onFromDayChange}
|
||||
|
||||
@@ -39,7 +39,12 @@ export interface LabListFilters {
|
||||
status?: LabStatusFilter;
|
||||
/** Category key (matches category.key) or ALL. */
|
||||
category?: string;
|
||||
/** Inclusive day bounds, YYYY-MM-DD for newest reading (latest.takenAt). */
|
||||
/**
|
||||
* "Last measured": inclusive day bounds (`?from` / `?to`, YYYY-MM-DD) on
|
||||
* the marker's newest reading (`latest.takenAt`), in the display zone.
|
||||
* Older readings are not looked at, so a marker measured inside the range
|
||||
* and again after it drops out, which is why the pill reads "Last measured".
|
||||
*/
|
||||
fromDay?: string;
|
||||
toDay?: string;
|
||||
}
|
||||
@@ -179,7 +184,7 @@ export function filterMarkerRows(
|
||||
if (markerCategory !== category) return false;
|
||||
}
|
||||
|
||||
// 4. Date bounds on latest reading
|
||||
// 4. "Last measured": the newest reading's day, never an older one
|
||||
if (fromDay || toDay) {
|
||||
const takenDate = dayKeyOf(row.latest.takenAt);
|
||||
if (fromDay && takenDate < fromDay) return false;
|
||||
|
||||
Reference in new issue
Block a user