Commit 7e8c3a10b6d572eb8063054bd4280c78125bbac7

Authored by fbormann
1 parent a844afbd

added one more variable to report, still missing to solve problem with forms

Showing 1 changed file with 6 additions and 1 deletions   Show diff stats
reports/views.py
... ... @@ -224,10 +224,15 @@ class ViewReportView(LoginRequiredMixin, generic.TemplateView):
224 224 #VAR24 through 30
225 225 day_numbers = [0, 1, 2, 3, 4, 5, 6]
226 226 day_names = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"]
  227 + distinct_days = 0
227 228 for day_num in day_numbers:
228 229 interactions['number of access to the subject on '+ day_names[day_num]] = Log.objects.filter(action="access", resource="subject",
229 230 user_id= student.id, context__contains = {'subject_id' : subject.id}, datetime__week_day = day_num).count()
230   -
  231 + #to save the distinct days the user has accessed
  232 + if interactions['number of access to the subject on '+ day_names[day_num]] > 0:
  233 + distinct_days += 1
  234 +
  235 + interactions['number of distinct days the user access the subject'] = distinct_days
231 236  
232 237 for value in interactions.values():
233 238 data[student].append(value)
... ...