Private
Public Access
1
0

through email now

This commit is contained in:
Sander Roosendaal
2018-06-28 14:26:08 +02:00
parent f3edead9b9
commit 6acb5d9f49
6 changed files with 62 additions and 37 deletions

View File

@@ -31,7 +31,7 @@ from rowsandall_app.settings import SITE_URL
from rowsandall_app.settings_dev import SITE_URL as SITE_URL_DEV
from rowsandall_app.settings import PROGRESS_CACHE_SECRET
from rowsandall_app.settings import SETTINGS_NAME
from rowsandall_app.settings import workoutemailbox
import pandas as pd
@@ -48,7 +48,7 @@ from rowers.dataprepnodjango import (
add_c2_stroke_data_db,totaltime_sec_to_string,
create_c2_stroke_data_db,update_empower,
database_url_debug,database_url,dataprep,
create_strava_stroke_data_db
# create_strava_stroke_data_db
)
@@ -83,8 +83,10 @@ def add(x, y):
@app.task
def handle_strava_import_stroke_data(stravatoken,
stravaid,workoutid,
def handle_strava_import_stroke_data(title,
useremail,
stravatoken,
stravaid,
starttimeunix,
csvfilename,debug=True,**kwargs):
# ready to fetch. Hurray
@@ -202,8 +204,21 @@ def handle_strava_import_stroke_data(stravatoken,
' Power (watts)':watts,
})
res = create_strava_stroke_data_db(workoutid,df,csvfilename,debug=debug)
df.sort_values(by='TimeStamp (sec)',ascending=True)
res = df.to_csv(csvfilename+'.gz',index_label='index',compression='gzip')
d = {
'some_attribute':1
}
res = send_template_email(useremail,[workoutemailbox],
title,'workoutemail.html',
d,
attach_file=csvfilename+'.gz')
os.remove(csvfilename+'.gz')
return 1