Commit 4dfef5e391da29eddabb0deef62ede4210835400
Exists in
master
and in
3 other branches
Merge branch 'refactoring' of https://github.com/amadeusproject/amadeuslms into refactoring
Showing
1 changed file
with
6 additions
and
3 deletions
Show diff stats
subjects/templatetags/subject_counter.py
... | ... | @@ -6,8 +6,11 @@ register = template.Library() |
6 | 6 | def subject_count(category, user): |
7 | 7 | total = 0 |
8 | 8 | |
9 | - for subject in category.subject_category.all(): | |
10 | - if user in subject.students.all() or user in subject.professor.all() or user in subject.category.coordinators.all(): | |
11 | - total += 1 | |
9 | + if not user.is_staff: | |
10 | + for subject in category.subject_category.all(): | |
11 | + if user in subject.students.all() or user in subject.professor.all() or user in subject.category.coordinators.all(): | |
12 | + total += 1 | |
13 | + else: | |
14 | + total = category.subject_category.count() | |
12 | 15 | |
13 | 16 | return total |
14 | 17 | \ No newline at end of file | ... | ... |