feat: derive event lifecycle status from dates and flags
Replace persisted event statuses with publication and cancellation flags, and compute public lifecycle labels from event timing and registration capacity. Keep filters, registration checks, and profile responses aligned with the derived status.
This commit is contained in:
@@ -117,13 +117,12 @@ def get_page_content(request, response: HttpResponse, slug: str):
|
||||
page = AboutContent.objects.filter(pk=1).first()
|
||||
if page is None:
|
||||
raise HttpError(404, "Page content not found")
|
||||
event_statuses = (Event.StatusChoices.PUBLISHED, Event.StatusChoices.COMPLETED)
|
||||
years_by_label = {}
|
||||
for year in page.years.prefetch_related("members", "events").all():
|
||||
label = year.year_label.strip() or "سال نامشخص"
|
||||
events = year.events.filter(
|
||||
is_deleted=False,
|
||||
status__in=event_statuses,
|
||||
is_published=True,
|
||||
start_time__lte=timezone.now(),
|
||||
).order_by("-start_time", "-pk")
|
||||
years_by_label[label] = {
|
||||
|
||||
Reference in New Issue
Block a user