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
|
# run alert report
|
||||||
|
|
||||||
# check alert permission
|
# check alert permission
|
||||||
|
from django.utils import timezone
|
||||||
|
|
||||||
def checkalertowner(alert, user):
|
def checkalertowner(alert, user):
|
||||||
if alert.manager == user:
|
if alert.manager == user:
|
||||||
return True
|
return True
|
||||||
if alert.rower.user == user: # pragma: no cover
|
if alert.rower.user == user: # pragma: no cover
|
||||||
return True
|
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
|
return False # pragma: no cover
|
||||||
|
|||||||
@@ -980,6 +980,13 @@ def checkbreakthrough(w, r):
|
|||||||
r.user.first_name,
|
r.user.first_name,
|
||||||
r.user.last_name,
|
r.user.last_name,
|
||||||
btvalues=btvalues.to_json())
|
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
|
# submit email task to send email about breakthrough workout
|
||||||
if ishard: # pragma: no cover
|
if ishard: # pragma: no cover
|
||||||
@@ -993,6 +1000,13 @@ def checkbreakthrough(w, r):
|
|||||||
r.user.first_name,
|
r.user.first_name,
|
||||||
r.user.last_name,
|
r.user.last_name,
|
||||||
btvalues=btvalues.to_json())
|
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
|
return isbreakthrough, ishard
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ class Command(BaseCommand):
|
|||||||
alert.manager.first_name,
|
alert.manager.first_name,
|
||||||
alert.manager.last_name,
|
alert.manager.last_name,
|
||||||
alert.rower.user.first_name,
|
alert.rower.user.first_name,
|
||||||
|
alert.rower.user.last_name,
|
||||||
alert.name,
|
alert.name,
|
||||||
stats, debug=True,
|
stats, debug=True,
|
||||||
othertexts=othertexts)
|
othertexts=othertexts)
|
||||||
|
|||||||
@@ -1304,7 +1304,8 @@ def sigdig(value, digits=3):
|
|||||||
|
|
||||||
@app.task
|
@app.task
|
||||||
def handle_send_email_alert(
|
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
|
if 'othertexts' in kwargs: # pragma: no cover
|
||||||
othertexts = kwargs['othertexts']
|
othertexts = kwargs['othertexts']
|
||||||
@@ -1356,6 +1357,7 @@ def handle_send_email_alert(
|
|||||||
'enddate': stats['enddate'],
|
'enddate': stats['enddate'],
|
||||||
'siteurl': siteurl,
|
'siteurl': siteurl,
|
||||||
'rowerfirstname': rowerfirstname,
|
'rowerfirstname': rowerfirstname,
|
||||||
|
'rowerlastname': rowerlastname,
|
||||||
'alertname': alertname,
|
'alertname': alertname,
|
||||||
'othertexts': othertexts,
|
'othertexts': othertexts,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,8 @@
|
|||||||
<p>Dear <strong>{{ first_name }}</strong>,</p>
|
<p>Dear <strong>{{ first_name }}</strong>,</p>
|
||||||
|
|
||||||
<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 }}.
|
{{ startdate }} to {{ enddate }}.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@@ -24,4 +25,3 @@
|
|||||||
Best Regards, the Rowsandall Team
|
Best Regards, the Rowsandall Team
|
||||||
</p>
|
</p>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user