added delta values to breakthrough email
This commit is contained in:
@@ -18,6 +18,7 @@ import matplotlib.pyplot as plt
|
|||||||
from matplotlib import figure
|
from matplotlib import figure
|
||||||
|
|
||||||
import stravalib
|
import stravalib
|
||||||
|
import pandas as pd
|
||||||
|
|
||||||
from django_rq import job
|
from django_rq import job
|
||||||
|
|
||||||
@@ -49,7 +50,9 @@ def handle_new_workout_from_file(r,f2,
|
|||||||
|
|
||||||
# send email when a breakthrough workout is uploaded
|
# send email when a breakthrough workout is uploaded
|
||||||
@app.task
|
@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
|
# send email with attachment
|
||||||
subject = "A breakthrough workout on rowsandall.com"
|
subject = "A breakthrough workout on rowsandall.com"
|
||||||
@@ -69,6 +72,18 @@ def handle_sendemail_breakthrough(workoutid,useremail,userfirstname,userlastname
|
|||||||
message += str(workoutid)
|
message += str(workoutid)
|
||||||
message += "/updatecp\n\n"
|
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 += "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"
|
message += "Best Regards, the Rowsandall Team"
|
||||||
@@ -222,10 +237,11 @@ def handle_otwsetpower(f1,boattype,weightvalue,
|
|||||||
update_strokedata(workoutid,rowdata.df,debug=debug)
|
update_strokedata(workoutid,rowdata.df,debug=debug)
|
||||||
|
|
||||||
delta,cpvalues,avgpower = datautils.getsinglecp(rowdata.df)
|
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,
|
handle_sendemail_breakthrough(workoutid,email,
|
||||||
first_name,
|
first_name,
|
||||||
last_name)
|
last_name,deltas)
|
||||||
|
|
||||||
# send email
|
# send email
|
||||||
fullemail = first_name + " " + last_name + " " + "<" + email + ">"
|
fullemail = first_name + " " + last_name + " " + "<" + email + ">"
|
||||||
|
|||||||
@@ -7,17 +7,19 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
<div id="workouts" class="grid_6 alpha">
|
<div id="workouts" class="grid_6 alpha">
|
||||||
|
|
||||||
|
<div class="grid_6 alpha">
|
||||||
<h1>Stream Editor</h1>
|
<h1>Stream Editor</h1>
|
||||||
|
</div>
|
||||||
|
<div class="grid_6 alpha">
|
||||||
<div class="grid_2 alpha">
|
<div class="grid_2 alpha">
|
||||||
<p>
|
<p>
|
||||||
<a class="button gray small" href="/rowers/workout/{{ workout.id }}/edit">Edit Workout</a>
|
<a class="button gray small" href="/rowers/workout/{{ workout.id }}/edit">Edit Workout</a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid_2">
|
<div class="grid_2">
|
||||||
<p>
|
<p>
|
||||||
<a class="button gray small" href="/rowers/workout/{{ workout.id }}/advanced">Advanced Edit</a>
|
<a class="button gray small" href="/rowers/workout/{{ workout.id }}/advanced">Advanced Edit</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="grid_2 omega tooltip">
|
<div class="grid_2 omega tooltip">
|
||||||
@@ -25,6 +27,12 @@
|
|||||||
<span class="tooltiptext">Run calculations to get power values for your row.</span>
|
<span class="tooltiptext">Run calculations to get power values for your row.</span>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="grid_6 alpha">
|
||||||
|
<div class="grid_2 prefix_4 alpha">
|
||||||
|
<p><a class="button blue small" href="/rowers/workout/{{ workout.id }}/wind">Wind Edit</a></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="grid_6 alpha">
|
<div class="grid_6 alpha">
|
||||||
<p>
|
<p>
|
||||||
Edit river Stream between turning points in your row.
|
Edit river Stream between turning points in your row.
|
||||||
|
|||||||
@@ -6,17 +6,19 @@
|
|||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div id="workouts" class="grid_6 alpha">
|
<div id="workouts" class="grid_6 alpha">
|
||||||
|
<div class="grid_6 alpha">
|
||||||
<h1>Wind Editor</h1>
|
<h1>Wind Editor</h1>
|
||||||
|
</div>
|
||||||
|
<div class="grid_6 alpha">
|
||||||
<div class="grid_2 alpha">
|
<div class="grid_2 alpha">
|
||||||
<p>
|
<p>
|
||||||
<a class="button gray small" href="/rowers/workout/{{ workout.id }}/edit">Edit Workout</a>
|
<a class="button gray small" href="/rowers/workout/{{ workout.id }}/edit">Edit Workout</a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid_2">
|
<div class="grid_2">
|
||||||
<p>
|
<p>
|
||||||
<a class="button gray small" href="/rowers/workout/{{ workout.id }}/advanced">Advanced Edit</a>
|
<a class="button gray small" href="/rowers/workout/{{ workout.id }}/advanced">Advanced Edit</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="grid_2 omega tooltip">
|
<div class="grid_2 omega tooltip">
|
||||||
@@ -24,6 +26,12 @@
|
|||||||
<span class="tooltiptext">Run calculations to get power values for your row.</span>
|
<span class="tooltiptext">Run calculations to get power values for your row.</span>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="grid_6 alpha">
|
||||||
|
<div class="grid_2 prefix_4 alpha">
|
||||||
|
<p><a class="button blue small" href="/rowers/workout/{{ workout.id }}/stream">Stream Edit</a></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="grid_6 alpha">
|
<div class="grid_6 alpha">
|
||||||
<p>
|
<p>
|
||||||
Update wind between distance 1 and distance 2. Submit wind strength
|
Update wind between distance 1 and distance 2. Submit wind strength
|
||||||
@@ -69,7 +77,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<img src="http://cliparts.co/cliparts/rTn/KaR/rTnKaRrxc.gif" width="400">
|
<img src="http://cliparts.co/cliparts/rTn/KaR/rTnKaRrxc.gif" width="400">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="advancedplots" class="grid_6 omega">
|
<div id="advancedplots" class="grid_6 omega">
|
||||||
|
|
||||||
@@ -103,16 +111,16 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
<div id="interactiveplot" class="grid_6 omega">
|
<div id="interactiveplot" class="grid_6 omega">
|
||||||
<div class="grid_6 alpha">
|
<div class="grid_6 alpha">
|
||||||
{{ the_div |safe }}
|
{{ the_div |safe }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="interactiveplot" class="grid_6 omega">
|
<div id="interactiveplot" class="grid_6 omega">
|
||||||
<div class="grid_6 alpha">
|
<div class="grid_6 alpha">
|
||||||
{{ gmapdiv |safe }}
|
{{ gmapdiv |safe }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import math
|
import math
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
import pandas as pd
|
||||||
|
|
||||||
lbstoN = 4.44822
|
lbstoN = 4.44822
|
||||||
|
|
||||||
@@ -85,4 +85,11 @@ def isbreakthrough(delta,cpvalues,p0,p1,p2,p3,ratio):
|
|||||||
|
|
||||||
res = np.sum(cpvalues>pwr)
|
res = np.sum(cpvalues>pwr)
|
||||||
|
|
||||||
return res>1
|
btdf = pd.DataFrame(
|
||||||
|
{
|
||||||
|
'delta':delta[cpvalues>pwr],
|
||||||
|
'cpvalues':cpvalues[cpvalues>pwr],
|
||||||
|
'pwr':pwr[cpvalues>pwr],
|
||||||
|
}
|
||||||
|
)
|
||||||
|
return res>1,btdf
|
||||||
|
|||||||
@@ -4403,8 +4403,9 @@ def workout_otwsetpower_view(request,id=0,message="",successmessage=""):
|
|||||||
rowdata.write_csv(f1,gzip=True)
|
rowdata.write_csv(f1,gzip=True)
|
||||||
|
|
||||||
# do power calculation (asynchronous)
|
# do power calculation (asynchronous)
|
||||||
u = request.user
|
r = row.user
|
||||||
r = Rower.objects.get(user=u)
|
u = r.user
|
||||||
|
|
||||||
first_name = u.first_name
|
first_name = u.first_name
|
||||||
last_name = u.last_name
|
last_name = u.last_name
|
||||||
emailaddress = u.email
|
emailaddress = u.email
|
||||||
|
|||||||
BIN
rowsanda_107501
BIN
rowsanda_107501
Binary file not shown.
Reference in New Issue
Block a user