fix(medications): say what attributing a dose to a slot counts as

The confirmation promised that an attributed dose always counts as taken
late. It counts as on time when it falls inside the slot's on-time window,
which also covers a dose taken shortly before the slot's clock time, and
as late otherwise. The copy now says so in every locale, and a test pins
the split it describes.

Refs #1028
This commit is contained in:
Marc-André Bombeck committed 2026-09-24 19:40:28 +02:00
1 parent fe7cccfd46
commit fa86c9e46c
8 files changed
+31 -7

No files matched your search

+1 -1
View File
@@ -1795,7 +1795,7 @@
"unpinnedToast": "Zuordnung gelöst",
"dueContext": "fällig gewesen: {time} ({delta})",
"confirmTitle": "Slot {time} zuordnen?",
"confirmBody": "Die Einnahme zählt für diesen Slot als verspätet — die Quote wird nicht geschönt. Die Zuordnung lässt sich jederzeit wieder lösen.",
"confirmBody": "Die Einnahme zählt für diesen Slot: pünktlich, wenn sie im Zeitfenster des Slots lag, sonst als verspätet. Die Quote wird also nicht geschönt. Die Zuordnung lässt sich jederzeit wieder lösen.",
"confirmCancel": "Abbrechen",
"confirmAction": "Zuordnen"
}
+1 -1
View File
@@ -1795,7 +1795,7 @@
"unpinnedToast": "Attribution released",
"dueContext": "was due: {time} ({delta})",
"confirmTitle": "Attribute to slot {time}?",
"confirmBody": "The intake counts as taken late for this slot – the rate is never flattered. You can release the attribution at any time.",
"confirmBody": "The intake counts for this slot: on time if it was taken inside the slot's on-time window, otherwise as late, so the rate is never flattered. You can release the attribution at any time.",
"confirmCancel": "Cancel",
"confirmAction": "Attribute"
}
+1 -1
View File
@@ -1795,7 +1795,7 @@
"unpinnedToast": "Asignación quitada",
"dueContext": "prevista: {time} ({delta})",
"confirmTitle": "¿Asignar al horario de las {time}?",
"confirmBody": "La toma contará como tomada con retraso para este horario; el porcentaje no se maquilla. Puedes quitar la asignación en cualquier momento.",
"confirmBody": "La toma contará para este horario: a tiempo si se tomó dentro de su ventana puntual y, si no, con retraso, así que el porcentaje no se maquilla. Puedes quitar la asignación en cualquier momento.",
"confirmCancel": "Cancelar",
"confirmAction": "Asignar"
}
+1 -1
View File
@@ -1795,7 +1795,7 @@
"unpinnedToast": "Prise détachée du créneau",
"dueContext": "prévue à {time} ({delta})",
"confirmTitle": "Rattacher au créneau de {time} ?",
"confirmBody": "La prise comptera comme prise en retard pour ce créneau – le taux n'est pas embelli. Le rattachement peut être retiré à tout moment.",
"confirmBody": "La prise comptera pour ce créneau : à l'heure si elle a eu lieu dans la fenêtre à l'heure du créneau, sinon en retard. Le taux n'est donc pas embelli. Le rattachement peut être retiré à tout moment.",
"confirmCancel": "Annuler",
"confirmAction": "Rattacher"
}
+1 -1
View File
@@ -1795,7 +1795,7 @@
"unpinnedToast": "Attribuzione rimossa",
"dueContext": "prevista alle {time} ({delta})",
"confirmTitle": "Attribuire allo slot delle {time}?",
"confirmBody": "L'assunzione conterà come in ritardo per questo slot – la percentuale non viene abbellita. L'attribuzione può essere rimossa in qualsiasi momento.",
"confirmBody": "L'assunzione conterà per questo slot: puntuale se è avvenuta nella finestra puntuale dello slot, altrimenti in ritardo, quindi la percentuale non viene abbellita. L'attribuzione può essere rimossa in qualsiasi momento.",
"confirmCancel": "Annulla",
"confirmAction": "Attribuisci"
}
+1 -1
View File
@@ -1795,7 +1795,7 @@
"unpinnedToast": "배정을 해제했어요",
"dueContext": "예정 시각: {time} ({delta})",
"confirmTitle": "{time} 시간대에 배정할까요?",
"confirmBody": "이 복용은 해당 시간대에 늦게 복용한 것으로 계산돼요 – 순응도가 부풀려지지 않아요. 배정은 언제든 해제할 수 있어요.",
"confirmBody": "이 복용은 해당 시간대로 계산돼요. 시간대의 정시 범위 안에 복용했다면 제시간, 아니면 늦게 복용한 것으로 계산되어 순응도가 부풀려지지 않아요. 배정은 언제든 해제할 수 있어요.",
"confirmCancel": "취소",
"confirmAction": "배정"
}
+1 -1
View File
@@ -1795,7 +1795,7 @@
"unpinnedToast": "Przypisanie usunięte",
"dueContext": "termin: {time} ({delta})",
"confirmTitle": "Przypisać do slotu {time}?",
"confirmBody": "Dawka zostanie policzona jako przyjęta z opóźnieniem dla tego slotu – wskaźnik nie jest zawyżany. Przypisanie można w każdej chwili usunąć.",
"confirmBody": "Dawka zostanie policzona dla tego slotu: jako przyjęta na czas, jeśli mieści się w oknie punktualności slotu, a w przeciwnym razie jako przyjęta z opóźnieniem, więc wskaźnik nie jest zawyżany. Przypisanie można w każdej chwili usunąć.",
"confirmCancel": "Anuluj",
"confirmAction": "Przypisz"
}
@@ -284,6 +284,30 @@ describe("reconstructDoseHistory", () => {
expect(morning?.pinned).toBe(true);
});
// The pin confirm dialog promises exactly this split: on time inside the
// slot's on-time window (also ahead of the slot's clock time), late
// otherwise.
it("an early pin inside the on-time window reads on time, one before it reads late", () => {
const early = reconstructDoseHistory(
bands,
[intake({ takenAt: at(6, 15), scheduledFor: at(7, 0), pinned: true })],
nowEvening,
null,
);
expect(early.find((r) => r.timeOfDay === "07:00")?.status).toBe(
"taken_on_time",
);
const tooEarly = reconstructDoseHistory(
bands,
[intake({ takenAt: at(5, 30), scheduledFor: at(7, 0), pinned: true })],
nowEvening,
null,
);
expect(tooEarly.find((r) => r.timeOfDay === "07:00")?.status).toBe(
"taken_late",
);
});
it("a pin inside the late tail reads taken_late, never flattered", () => {
const rows = reconstructDoseHistory(
bands,