UPD: change grace period for purging registration and participant data.

This commit is contained in:
2019-06-05 11:33:45 +02:00
parent 61605a205c
commit 4c67995680
5 changed files with 66 additions and 46 deletions

View File

@@ -3,6 +3,7 @@ import datetime
import logging
import re
from django.apps import apps
from django.db.models.functions import Length
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
@@ -286,8 +287,8 @@ class BasicWorkflow(object):
qs = event.__class__.objects.filter(number__isnull=False,
sport=event.sport,
first_day__gte=year_begin,
first_day__lte=year_end).order_by('number')
last = qs.last()
first_day__lte=year_end).annotate(number_length=Length('number'))
last = qs.order_by('number_length', 'number').last()
if last:
match = re.match(r'^(?P<sport>[A-Z])(?P<count>[0-9][0-9]*)/(?P<year>[0-9][0-9]*)', last.number)
if match: