From: yomguy Date: Tue, 12 Feb 2013 11:27:10 +0000 (+0100) Subject: simplify total_progress X-Git-Tag: 0.9-probarreau~69 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=7e198154d92ba4dcbd8d358efccdcb6275d7fb6d;p=teleforma.git simplify total_progress --- diff --git a/teleforma/context_processors.py b/teleforma/context_processors.py index 3f7d467d..96998b2c 100644 --- a/teleforma/context_processors.py +++ b/teleforma/context_processors.py @@ -141,17 +141,7 @@ def total_progress(request): if not user.is_authenticated(): return {'total_progress': 0} - auditor = user.auditor.all() - professor = user.professor.all() - - if auditor and not (user.is_staff or user.is_superuser): - seminars = auditor[0].seminars.all() - elif user.is_superuser or user.is_staff: - seminars = Seminar.objects.all() - elif professor: - seminars = all_seminars(request)['all_seminars'] - else: - seminars = None + seminars = all_seminars(request)['all_seminars'] for seminar in seminars: progress += seminar_progress(user, seminar)