Commit 746fea4a7f50f35393bc959fbefe500277b5bd6a

Authored by Zambom
1 parent 959899f1

Adjusting subject count per cactegory

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,8 +6,11 @@ register = template.Library()
6 def subject_count(category, user): 6 def subject_count(category, user):
7 total = 0 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 return total 16 return total
14 \ No newline at end of file 17 \ No newline at end of file