From 7e8c3a10b6d572eb8063054bd4280c78125bbac7 Mon Sep 17 00:00:00 2001 From: fbormann Date: Tue, 14 Mar 2017 13:23:47 -0300 Subject: [PATCH] added one more variable to report, still missing to solve problem with forms --- reports/views.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/reports/views.py b/reports/views.py index 9e2b3d5..425eb21 100644 --- a/reports/views.py +++ b/reports/views.py @@ -224,10 +224,15 @@ class ViewReportView(LoginRequiredMixin, generic.TemplateView): #VAR24 through 30 day_numbers = [0, 1, 2, 3, 4, 5, 6] day_names = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"] + distinct_days = 0 for day_num in day_numbers: interactions['number of access to the subject on '+ day_names[day_num]] = Log.objects.filter(action="access", resource="subject", user_id= student.id, context__contains = {'subject_id' : subject.id}, datetime__week_day = day_num).count() - + #to save the distinct days the user has accessed + if interactions['number of access to the subject on '+ day_names[day_num]] > 0: + distinct_days += 1 + + interactions['number of distinct days the user access the subject'] = distinct_days for value in interactions.values(): data[student].append(value) -- libgit2 0.21.2