feat(recurrence): add daily recurrence support

- Add `simple_daily` type and `daily` field to `rem`
- Implement `render_daily`, `add_interval_daily`, and `add_until_daily`
- Extend `simple_recurrence` collector to handle `FREQ=DAILY` alongside
  `FREQ=WEEKLY`
- Remove dead `expand_recurrence` collector
- Mark P06 pattern as implemented ()
This commit is contained in:
2026-05-17 00:25:01 +02:00
parent 98d57826fe
commit fafdd8c142
2 changed files with 62 additions and 24 deletions

View File

@@ -50,7 +50,7 @@ open Utils
snippet: 'REM Mon Wed FROM 2025-09-01 UNTIL 2025-10-31 AT 09:00 MSG Standup'
priorita: Subito
- id: P06
- id: P06
pattern: Ricorrenza giornaliera semplice
ics: "RRULE:FREQ=DAILY;[UNTIL|COUNT]"
remind_support: nativo
@@ -226,9 +226,6 @@ let collect_exdates rem ev : (Remind.rem, error) result =
let exdates = Utils.get_exdates ev in
Ok { rem with Remind.exdate = exdates }
let expand_recurrence rem _ev : (Remind.rem, error) result =
if List.length rem.Remind.recurring > 0 then skip else Ok rem
let yearly_simple_date rem ev : (Remind.rem, error) result =
match ev.rrule with
| Some (_, (`Yearly, None, None, [])) ->
@@ -292,11 +289,12 @@ RRULE: (`Weekly, (Some `Until (`Utc (2026-07-01 09:00:00 +00:00))), None, [])
*)
match ev.rrule with
| Some (_, (`Yearly, None, None, [])) -> Ok rem (* handled in yearly_simple_date *)
| Some (_, (`Weekly, count_or_until, interval, recurs)) ->
| Some (_, ((`Weekly as freq), count_or_until, interval, recurs))
| Some (_, ((`Daily as freq), count_or_until, interval, recurs)) ->
begin if List.length rem.recurring > 0 || List.length rem.exdate > 0 then (
Printf.eprintf "Warning: skipping complex recurrence with EXDATE/RDATE/overrides, not supported\t\t\tUID: %s\n"
(Utils.get_uid ev);
debug_print_of_recurrence_and_skip ev (`Weekly, count_or_until, interval, recurs))
debug_print_of_recurrence_and_skip ev (freq, count_or_until, interval, recurs))
else
let days =
ListLabels.filter_map recurs ~f:(function
@@ -310,21 +308,21 @@ RRULE: (`Weekly, (Some `Until (`Utc (2026-07-01 09:00:00 +00:00))), None, [])
| `Weekday `Monday -> Some `Monday
| _ -> None)
in
Ok { rem with Remind.weekly = Some { count_or_until; interval; byday = days; week_start } }
match freq with
| `Daily -> Ok { rem with Remind.weekly = None; Remind.daily = Some { count_or_until; interval; week_start } }
| `Weekly ->
Ok
{
rem with
Remind.daily = None;
Remind.weekly = Some { count_or_until; interval; byday = days; week_start };
}
end
| Some (_, recurs) -> debug_print_of_recurrence_and_skip ev recurs
| None -> Ok rem
let all_collectors : collector list =
[
collect_uuid;
collect_summary;
collect_start_end_duration;
collect_exdates;
expand_recurrence;
yearly_simple_date;
simple_recurrence;
]
[ collect_uuid; collect_summary; collect_start_end_duration; collect_exdates; yearly_simple_date; simple_recurrence ]
let remind_of_event (source : string) (ev : Icalendar.event list) : (Remind.rem, error) result =
let () = if List.length ev = 0 then failwith "No events provided" in