Private
Public Access
1
0

added calcdps routine

This commit is contained in:
Sander Roosendaal
2017-09-20 11:18:42 +02:00
parent d95ac01172
commit e689955802
5 changed files with 225 additions and 63 deletions

View File

@@ -24,9 +24,10 @@ from django_rq import job
from utils import serialize_list,deserialize_list
from rowers.dataprepnodjango import update_strokedata
from rowers.dataprepnodjango import new_workout_from_file
from rowers.dataprepnodjango import getsmallrowdata_db
from rowers.dataprepnodjango import (
update_strokedata, new_workout_from_file,
getsmallrowdata_db,read_df_sql,columndict,
)
from django.core.mail import send_mail, BadHeaderError,EmailMessage
@@ -49,6 +50,27 @@ def handle_new_workout_from_file(r,f2,
return new_workout_from_file(r,f2,workouttype,
title,makeprivate,notes)
# process and update workouts
@app.task
def handle_updatedps(useremail,workoutids,debug=False):
for wid,f1 in workoutids:
havedata = 1
try:
rowdata = rdata(f1)
except IOError:
try:
rowdata = rdata(f1+'.csv')
except IOError:
try:
rowdata = rdata(f1+'.gz')
except IOError:
havedata = 0
if havedata:
update_strokedata(wid,rowdata.df,debug=debug)
return 1
# send email when a breakthrough workout is uploaded
@app.task
def handle_sendemail_breakthrough(workoutid,useremail,