first version of autojoin (just collecting workouts)
This commit is contained in:
22
rowers/management/commands/autojoin.py
Normal file
22
rowers/management/commands/autojoin.py
Normal file
@@ -0,0 +1,22 @@
|
||||
import sys
|
||||
import os
|
||||
|
||||
import requests
|
||||
import datetime
|
||||
import arrow
|
||||
from django.utils import timezone
|
||||
|
||||
from django.core.management.base import BaseCommand
|
||||
from rowers.models import Rower,Workout
|
||||
|
||||
class Command(BaseCommand):
|
||||
def handle(self, *args, **options):
|
||||
rs = (r for r in Rower.objects.all() if r.ispaid and r.autojoin)
|
||||
now = timezone.now()
|
||||
|
||||
for r in rs:
|
||||
workouts = Workout.objects.filter(user=r,
|
||||
startdatetime__gte=timezone.now()-datetime.timedelta(days=2))
|
||||
|
||||
|
||||
print('ready autojoin')
|
||||
Reference in New Issue
Block a user