Private
Public Access
1
0

further cleaning up

This commit is contained in:
Sander Roosendaal
2021-04-16 19:32:06 +02:00
parent 8f81c5fc92
commit 6331b4ff4a
5 changed files with 26 additions and 153 deletions

View File

@@ -997,44 +997,6 @@ def updatecpdata_sql(rower_id,delta,cp,table='cpdata',distance=[]):
conn.close()
engine.dispose()
def runcpupdate(
rower,type='water',
startdate=timezone.now()-datetime.timedelta(days=365),
enddate=timezone.now()+datetime.timedelta(days=5)
):
if type == 'water':
theworkouts = Workout.objects.filter(
user=rower,rankingpiece=True,
workouttype='water',
startdatetime__gte=startdate,
startdatetime__lte=enddate
)
table = 'cpdata'
else:
theworkouts = Workout.objects.filter(
user=rower,rankingpiece=True,
workouttype__in=[
'rower',
'dynamic',
'slides'
],
startdatetime__gte=startdate,
startdatetime__lte=enddate
)
table = 'cpergdata'
theids = [w.id for w in theworkouts]
job = myqueue(
queuelow,
handle_updatecp,
rower.id,
theids,
table=table)
return job
def fetchcperg(rower,theworkouts):
theids = [int(w.id) for w in theworkouts]
thefilenames = [w.csvfilename for w in theworkouts]