Private
Public Access
1
0

adding poll for next week sessions

This commit is contained in:
2025-07-20 16:15:15 +02:00
parent 5b6e87fedd
commit 01d4cf659e
8 changed files with 253 additions and 2 deletions

View File

@@ -0,0 +1,44 @@
#!/srv/venv/bin/python
import sys
import os
from django.core.management.base import BaseCommand
from rowers.models import Rower
from rowers.tasks import handle_loadnextweek
from rowers.utils import myqueue, dologging
import django_rq
PY3K = sys.version_info >= (3, 0)
queue = django_rq.get_queue('default')
queuelow = django_rq.get_queue('low')
queuehigh = django_rq.get_queue('low')
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument(
'--testing',
action='store_true',
dest='testing',
default=False,
help="Run in testing mode, don't send emails", )
def handle(self, *args, **options):
if 'testing' in options:
testing = options['testing']
else:
testing = False
rowers = Rower.objects.filter(training_plan_code__isnull=False).exclude(training_plan_code__exact='')
rowers = rowers.filter(training_plan_secret__isnull=False).exclude(training_plan_secret__exact='')
for rower in rowers:
_ = myqueue(queue, handle_loadnextweek,
rower)
self.stdout.write(self.style.SUCCESS(
'Successfully loaded next week plans'
))