Add recurring series to events
A Series checkbox under When opens a panel for the schedule: weekly on chosen weekdays, monthly by date, or monthly by weekday position, every N weeks or months, with meeting times and an optional meeting count. starts_on anchors the schedule and ends_on bounds it, so effective_status needs no change. Occurrences are derived, not stored. src/lib/eventSeries.ts builds the schedule label shown on cards and the event page, and the upcoming dates listed on the event page. Migration 016 adds the columns; the CRUD engine gains a time type. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
aebc1c302b
commit
5ed7994a64
11 changed files with 500 additions and 3 deletions
|
|
@ -108,6 +108,25 @@ function shapeHost(row) {
|
|||
};
|
||||
}
|
||||
|
||||
/* The repeating schedule, or null for a one-off. Weekdays collapse
|
||||
from seven flags to a list of the ticked ones, Sunday first; an
|
||||
empty list means "starts_on's weekday", which the client resolves
|
||||
since it already holds starts_on. Occurrences are not sent — they
|
||||
are derived, and the client derives them against its own today. */
|
||||
const SERIES_WEEKDAYS = ["sun", "mon", "tue", "wed", "thu", "fri", "sat"];
|
||||
|
||||
function shapeSeries(row) {
|
||||
if (!asBool(row.is_series)) return null;
|
||||
return {
|
||||
frequency: row.series_frequency,
|
||||
interval: row.series_interval,
|
||||
weekdays: SERIES_WEEKDAYS.filter((day) => asBool(row[`series_${day}`])),
|
||||
start_time: row.series_start_time,
|
||||
end_time: row.series_end_time,
|
||||
count: row.series_count,
|
||||
};
|
||||
}
|
||||
|
||||
function shapeEvent(row, links, cardBlocks, hosts = []) {
|
||||
const { actions, instagram } = splitLinks(links);
|
||||
|
||||
|
|
@ -124,6 +143,7 @@ function shapeEvent(row, links, cardBlocks, hosts = []) {
|
|||
ends_on: row.ends_on,
|
||||
date_label: row.date_label,
|
||||
status: row.effective_status,
|
||||
series: shapeSeries(row),
|
||||
|
||||
location_label: row.location_label,
|
||||
locality: row.locality,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue