diff --git a/rowers/tasks.py b/rowers/tasks.py index 03f7ece1..50277880 100644 --- a/rowers/tasks.py +++ b/rowers/tasks.py @@ -18,7 +18,8 @@ import matplotlib.pyplot as plt from matplotlib import figure import stravalib - +import pandas as pd + from django_rq import job from utils import serialize_list,deserialize_list @@ -49,7 +50,9 @@ def handle_new_workout_from_file(r,f2, # send email when a breakthrough workout is uploaded @app.task -def handle_sendemail_breakthrough(workoutid,useremail,userfirstname,userlastname): +def handle_sendemail_breakthrough(workoutid,useremail, + userfirstname,userlastname, + btvalues = pd.DataFrame()): # send email with attachment subject = "A breakthrough workout on rowsandall.com" @@ -69,6 +72,18 @@ def handle_sendemail_breakthrough(workoutid,useremail,userfirstname,userlastname message += str(workoutid) message += "/updatecp\n\n" + if not btvalues.empty: + message += "These were the breakthrough values:\n" + for t in btvalues.itertuples(): + delta = t.delta + cpvalue = t.cpvalues + pwr = t.pwr + + message += "Time: "+str(delta)+" seconds\n" + message += "New: "+str(cpvalue)+" Watt\n" + message += "Old: "+str(pwr)+" Watt\n\n" + + message += "To opt out of these email notifications, deselect the checkbox on your Profile page under Account Information.\n\n" message += "Best Regards, the Rowsandall Team" @@ -222,10 +237,11 @@ def handle_otwsetpower(f1,boattype,weightvalue, update_strokedata(workoutid,rowdata.df,debug=debug) delta,cpvalues,avgpower = datautils.getsinglecp(rowdata.df) - if utils.isbreakthrough(delta,cpvalues,ps[0],ps[1],ps[2],ps[3],ratio): + res,deltas = utils.isbreakthrough(delta,cpvalues,ps[0],ps[1],ps[2],ps[3],ratio) + if res: handle_sendemail_breakthrough(workoutid,email, first_name, - last_name) + last_name,deltas) # send email fullemail = first_name + " " + last_name + " " + "<" + email + ">" diff --git a/rowers/templates/streamedit.html b/rowers/templates/streamedit.html index 56079e4d..1e4ba1a0 100644 --- a/rowers/templates/streamedit.html +++ b/rowers/templates/streamedit.html @@ -7,49 +7,57 @@ {% block content %}
- Edit Workout -
-- Advanced Edit -
- -- Edit river Stream between turning points in your row. - Use positive (+) values to denote rowing with the stream, - negative (-) values to denote rowing against the stream. -
- ++ Edit Workout +
++ Advanced Edit +
+ ++ Edit river Stream between turning points in your row. + Use positive (+) values to denote rowing with the stream, + negative (-) values to denote rowing against the stream. +
+
-
+ {% if form.errors %}
+ + Please correct the error{{ form.errors|pluralize }} below. +
+ {% endif %} + +
+
- Edit Workout -
-- Advanced Edit -
- -- Update wind between distance 1 and distance 2. Submit wind strength - and direction at start and end of segment. Blank the form for values - you want to keep intact. -
- -- Check www.wunderground.com - to find historical weather data from an on-line weather station near - the location of your row. -
- -
+