Files
RosterChief/events/tasks.py
Bernard Siebens adf1120358 Checkpoint: management app redesign, onboarding/signup workflow, and events calendar backend
Large uncommitted body of work accumulated across sessions on this branch --
committing as a checkpoint so it's tracked and future worktree-isolated agents
see the real codebase instead of a stale ancestor commit. Covers the
management app's dedicated Tailwind theme and templates, the club onboarding
requirement/signup workflow (club/services/onboarding.py, requirement/status
models, sign-up dashboard), fee/status auto-activation decoupling, referee
management, and the new events calendar grid service layer.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ECGMEwrc2k4D8VQuwjstj9
2026-08-19 23:34:43 +02:00

29 lines
1.2 KiB
Python

"""Celery task behind the `extend-event-series` beat schedule entry (see
rosterchief/settings.CELERY_BEAT_SCHEDULE and features/jobs.py).
Mirrors `manage.py extend_event_series` exactly -- that command still exists, unchanged, for
manual use from a shell (see events/management/commands/extend_event_series.py).
"""
from celery import shared_task
from events.models import EventSeries
from events.services import generate_occurrences, horizon
from features.models import Maintenance
@shared_task(name="events.tasks.extend_event_series")
def extend_event_series():
if Maintenance.is_on():
# Loud, not silent: a job that quietly skips itself while the platform is closed is
# how a rolling horizon quietly runs dry. Raising here is what turns it into a
# Failure on the control panel's Jobs tab instead of nothing happening at all.
raise RuntimeError("Platform is in maintenance mode; this job stood down.")
until = horizon()
total = 0
for series in EventSeries.objects.all():
total += len(generate_occurrences(series, until))
return f"Generated {total} occurrence(s) across {EventSeries.objects.count()} series."