From ecb38024be39937c6c1ebe1430c80b8bb33443e3 Mon Sep 17 00:00:00 2001 From: John Giannelos Date: Thu, 5 Jun 2014 14:21:25 +0300 Subject: [PATCH] [Fix bug 1011744] Disable report reminders for new Reps and their mentors --- remo/reports/tasks.py | 12 ++++++------ remo/reports/tests/test_tasks.py | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/remo/reports/tasks.py b/remo/reports/tasks.py index c40155d0a..a8cc17b90 100644 --- a/remo/reports/tasks.py +++ b/remo/reports/tasks.py @@ -67,9 +67,9 @@ def send_first_report_notification(): userprofile__first_report_notification__isnull=True) # Exclude users with a report filed between start and end period # and users who joined the program less than one month - inactive_users = users.exclude( - ng_reports__report_date__range=[start, end], - userprofile__date_joined_program__gt=start) + inactive_users = (users + .exclude(ng_reports__report_date__range=[start, end]) + .exclude(userprofile__date_joined_program__gt=start)) send_report_notification(inactive_users, weeks=4) for user in inactive_users: @@ -91,9 +91,9 @@ def send_second_report_notification(): userprofile__second_report_notification__isnull=True) # Exclude users with a report filed between start and end period # and users who joined the program less than one month - inactive_users = users.exclude( - ng_reports__report_date__range=[start, end], - userprofile__date_joined_program__gt=start) + inactive_users = (users + .exclude(ng_reports__report_date__range=[start, end]) + .exclude(userprofile__date_joined_program__gt=start)) send_report_notification(inactive_users, weeks=8) for user in inactive_users: diff --git a/remo/reports/tests/test_tasks.py b/remo/reports/tests/test_tasks.py index 3d5622226..a3a78b24d 100644 --- a/remo/reports/tests/test_tasks.py +++ b/remo/reports/tests/test_tasks.py @@ -86,7 +86,8 @@ def test_base(self): mentor = UserFactory.create(groups=['Mentor']) today = now().date() rep = UserFactory.create( - groups=['Rep'], userprofile__mentor=mentor) + groups=['Rep'], userprofile__mentor=mentor, + userprofile__date_joined_program=get_date(days=-100)) NGReportFactory.create(user=rep, report_date=today - timedelta(weeks=5))