Merge branch 'release/v18.6.20'
This commit is contained in:
@@ -211,11 +211,17 @@ def alert_get_stats(alert, nperiod=0): # pragma: no cover
|
||||
# run alert report
|
||||
|
||||
# check alert permission
|
||||
|
||||
from django.utils import timezone
|
||||
|
||||
def checkalertowner(alert, user):
|
||||
if alert.manager == user:
|
||||
return True
|
||||
if alert.rower.user == user: # pragma: no cover
|
||||
return True
|
||||
coaches = alert.manager.rower.get_coaches()
|
||||
for coach in coaches:
|
||||
if coach.rowerplan == 'coach':
|
||||
return True
|
||||
if coach.coachtrialexpires >= timezone.now().date():
|
||||
return True
|
||||
return False # pragma: no cover
|
||||
|
||||
@@ -980,6 +980,13 @@ def checkbreakthrough(w, r):
|
||||
r.user.first_name,
|
||||
r.user.last_name,
|
||||
btvalues=btvalues.to_json())
|
||||
for coach in r.get_coaches():
|
||||
_ = myqueue(queuehigh, handle_sendemail_breakthrough,
|
||||
w.id,
|
||||
coach.user.email,
|
||||
r.user.first_name,
|
||||
r.user.last_name,
|
||||
btvalues=btvalues.to_json())
|
||||
|
||||
# submit email task to send email about breakthrough workout
|
||||
if ishard: # pragma: no cover
|
||||
@@ -993,6 +1000,13 @@ def checkbreakthrough(w, r):
|
||||
r.user.first_name,
|
||||
r.user.last_name,
|
||||
btvalues=btvalues.to_json())
|
||||
for coach in r.get_coaches():
|
||||
_ = myqueue(queuehigh, handle_sendemail_hard,
|
||||
w.id,
|
||||
coach.user.email,
|
||||
r.user.first_name,
|
||||
r.user.last_name,
|
||||
btvalues=btvalues.to_json())
|
||||
|
||||
return isbreakthrough, ishard
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ class Command(BaseCommand):
|
||||
alert.manager.first_name,
|
||||
alert.manager.last_name,
|
||||
alert.rower.user.first_name,
|
||||
alert.rower.user.last_name,
|
||||
alert.name,
|
||||
stats, debug=True,
|
||||
othertexts=othertexts)
|
||||
|
||||
@@ -1304,7 +1304,8 @@ def sigdig(value, digits=3):
|
||||
|
||||
@app.task
|
||||
def handle_send_email_alert(
|
||||
useremail, userfirstname, userlastname, rowerfirstname, alertname, stats, **kwargs):
|
||||
useremail, userfirstname, userlastname, rowerfirstname, rowerlastname,
|
||||
alertname, stats, **kwargs):
|
||||
|
||||
if 'othertexts' in kwargs: # pragma: no cover
|
||||
othertexts = kwargs['othertexts']
|
||||
@@ -1356,6 +1357,7 @@ def handle_send_email_alert(
|
||||
'enddate': stats['enddate'],
|
||||
'siteurl': siteurl,
|
||||
'rowerfirstname': rowerfirstname,
|
||||
'rowerlastname': rowerlastname,
|
||||
'alertname': alertname,
|
||||
'othertexts': othertexts,
|
||||
}
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
<p>Dear <strong>{{ first_name }}</strong>,</p>
|
||||
|
||||
<p>
|
||||
Here is the report for your alert <strong>{{ alertname }}</strong> on <a href="{{ siteurl }}">rowsandall.com</a>. This is a report for your athlete {{ rowerfirstname }}, covering the period from
|
||||
Here is the report for your alert <strong>{{ alertname }}</strong> on <a href="{{ siteurl }}">rowsandall.com</a>.
|
||||
This is a report for your athlete {{ rowerfirstname }} {{ rowerlastname }}, covering the period from
|
||||
{{ startdate }} to {{ enddate }}.
|
||||
</p>
|
||||
|
||||
@@ -24,4 +25,3 @@
|
||||
Best Regards, the Rowsandall Team
|
||||
</p>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user