diff --git a/rowers/alerts.py b/rowers/alerts.py index 5d8106c5..f1c73fdb 100644 --- a/rowers/alerts.py +++ b/rowers/alerts.py @@ -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