values in CP notification email
This commit is contained in:
@@ -52,7 +52,7 @@ def handle_new_workout_from_file(r,f2,
|
||||
@app.task
|
||||
def handle_sendemail_breakthrough(workoutid,useremail,
|
||||
userfirstname,userlastname,
|
||||
btvalues = pd.DataFrame()):
|
||||
btvalues = pd.DataFrame().to_json()):
|
||||
|
||||
# send email with attachment
|
||||
subject = "A breakthrough workout on rowsandall.com"
|
||||
@@ -63,7 +63,7 @@ def handle_sendemail_breakthrough(workoutid,useremail,
|
||||
message += " Critical Power (CP) is the power that you can "
|
||||
message += "sustain for a given duration. For more, see this "
|
||||
message += " article in the analytics blog:\n\n"
|
||||
message += " [link to article to be written]\n\n"
|
||||
message += " http://analytics.rowsandall.com/2017/06/17/how-do-we-calculate-critical-power/ \n\n"
|
||||
message += "Link to the workout http://rowsandall.com/rowers/workout/"
|
||||
message += str(workoutid)
|
||||
message +="/edit\n\n"
|
||||
@@ -72,6 +72,9 @@ def handle_sendemail_breakthrough(workoutid,useremail,
|
||||
message += str(workoutid)
|
||||
message += "/updatecp\n\n"
|
||||
|
||||
btvalues = pd.read_json(btvalues)
|
||||
btvalues.sort_values('delta',axis=0,inplace=True)
|
||||
|
||||
if not btvalues.empty:
|
||||
message += "These were the breakthrough values:\n"
|
||||
for t in btvalues.itertuples():
|
||||
@@ -79,9 +82,15 @@ def handle_sendemail_breakthrough(workoutid,useremail,
|
||||
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 += "Time: {delta} seconds\n".format(
|
||||
delta=delta
|
||||
)
|
||||
message += "New: {cpvalue:.0f} Watt\n".format(
|
||||
cpvalue=cpvalue
|
||||
)
|
||||
message += "Old: {pwr:.0f} Watt\n\n".format(
|
||||
pwr=pwr
|
||||
)
|
||||
|
||||
|
||||
message += "To opt out of these email notifications, deselect the checkbox on your Profile page under Account Information.\n\n"
|
||||
@@ -237,11 +246,11 @@ def handle_otwsetpower(f1,boattype,weightvalue,
|
||||
update_strokedata(workoutid,rowdata.df,debug=debug)
|
||||
|
||||
delta,cpvalues,avgpower = datautils.getsinglecp(rowdata.df)
|
||||
res,deltas = utils.isbreakthrough(delta,cpvalues,ps[0],ps[1],ps[2],ps[3],ratio)
|
||||
res,btvalues = utils.isbreakthrough(delta,cpvalues,ps[0],ps[1],ps[2],ps[3],ratio)
|
||||
if res:
|
||||
handle_sendemail_breakthrough(workoutid,email,
|
||||
first_name,
|
||||
last_name,deltas)
|
||||
last_name,btvalues=btvalues.to_json())
|
||||
|
||||
# send email
|
||||
fullemail = first_name + " " + last_name + " " + "<" + email + ">"
|
||||
|
||||
Reference in New Issue
Block a user