feat(events): formal end date for recurring series
Add EventSeries.until: an explicit series end that caps occurrence generation (whichever comes first — it, the generation horizon, or the rule's own COUNT/UNTIL). Blank means open-ended. Surface it in the admin. 100% coverage. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -218,6 +218,15 @@ class OccurrenceExpansionTests(RecurrenceTestBase):
|
||||
self.assertNotIn(skipped, dts)
|
||||
self.assertEqual(len(dts), 3)
|
||||
|
||||
def test_series_until_caps_expansion(self):
|
||||
series = self.make_series(rrule="FREQ=WEEKLY", until=self.anchor + timedelta(days=10))
|
||||
|
||||
dts = occurrence_datetimes(series, self.anchor + timedelta(days=90))
|
||||
|
||||
# Only the anchor and the first weekly repeat fall on/before `until`.
|
||||
self.assertEqual(dts, [self.anchor, self.anchor + timedelta(weeks=1)])
|
||||
self.assertTrue(all(dt <= series.until for dt in dts))
|
||||
|
||||
|
||||
class GenerateOccurrencesTests(RecurrenceTestBase):
|
||||
def test_materialises_occurrences_with_template_and_attendance(self):
|
||||
@@ -245,6 +254,13 @@ class GenerateOccurrencesTests(RecurrenceTestBase):
|
||||
|
||||
self.assertEqual(series.occurrences.count(), 4)
|
||||
|
||||
def test_generation_stops_at_series_until(self):
|
||||
series = self.make_series(rrule="FREQ=WEEKLY", until=self.anchor + timedelta(days=10))
|
||||
|
||||
generate_occurrences(series)
|
||||
|
||||
self.assertEqual(series.occurrences.count(), 2)
|
||||
|
||||
def test_gathering_and_deadline_come_from_offsets(self):
|
||||
series = self.make_series(gathering_offset=timedelta(minutes=30), deadline_offset=timedelta(days=1))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user