Seasonal (yearly) dosing for allergy/pollen meds
Add a recurring month-day season window to DoseTime (seasonStartMmdd/ seasonEndMmdd): a med rests outside its window and re-arms automatically every year. The pure ScheduleEngine gains a season filter plus one-year overrides -- startEpochDay/endEpochDay act as early-start/extend brackets for seasonal rows while staying hard bounds for tapers. - Daily SupplyCheck nudges before a season opens (Start naa) and before it closes (Forleng), handled by the new SeasonActionReceiver. - Med list lists resting seasonal meds in a "Sesong (hviler)" section. - Dose-time editor gains a season block and a "scroll for more" hint so cyclic/season below the time picker are discoverable. - Room migration v3->v4 (additive), backup DTO extended, engine/text tests. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
b4c929eca2
commit
d81a4fd926
15 changed files with 1098 additions and 103 deletions
|
|
@ -20,7 +20,7 @@ object ScheduleText {
|
|||
|
||||
fun describe(doseTime: DoseTime): String =
|
||||
"${"%02d:%02d".format(doseTime.minuteOfDay / 60, doseTime.minuteOfDay % 60)} " +
|
||||
"${daysText(doseTime)}${cycleText(doseTime)}${windowText(doseTime)}"
|
||||
"${daysText(doseTime)}${cycleText(doseTime)}${windowText(doseTime)}${seasonText(doseTime)}"
|
||||
|
||||
/** " · syklus 21/28" when cyclic, else "". */
|
||||
fun cycleText(doseTime: DoseTime): String {
|
||||
|
|
@ -41,6 +41,21 @@ object ScheduleText {
|
|||
}
|
||||
}
|
||||
|
||||
/** " · sesong 1. mar–31. mai" for a yearly seasonal window (month×100+day). */
|
||||
fun seasonText(doseTime: DoseTime): String {
|
||||
val start = doseTime.seasonStartMmdd
|
||||
val end = doseTime.seasonEndMmdd
|
||||
if (start <= 0 || end <= 0) return ""
|
||||
return " · sesong ${mmddText(start)}–${mmddText(end)}"
|
||||
}
|
||||
|
||||
/** Formats a month×100+day mark as "1. mar". A leap-year-safe MonthDay so 0229 renders. */
|
||||
private fun mmddText(mmdd: Int): String =
|
||||
java.time.MonthDay.of(mmdd / 100, mmdd % 100).format(dateFmt)
|
||||
|
||||
/** A single date as "1. mar" (nb-pinned), e.g. for "next season starts …". */
|
||||
fun dateLabel(date: LocalDate): String = dateFmt.format(date)
|
||||
|
||||
fun daysText(doseTime: DoseTime): String {
|
||||
if (doseTime.intervalDays > 1) {
|
||||
return "(hver ${doseTime.intervalDays}. dag)"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue