From 431b542ee44950d566b0b4ccf1ae9e6aca2d33ae Mon Sep 17 00:00:00 2001 From: fbormann Date: Fri, 3 Mar 2017 02:03:07 -0300 Subject: [PATCH] report view of data, still has no restriction about user but all the data is here and the parameters are sent via GET request --- api/templates/api/report.html | 15 +++++++++++++++ api/views.py | 8 ++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/api/templates/api/report.html b/api/templates/api/report.html index d69226e..a712523 100644 --- a/api/templates/api/report.html +++ b/api/templates/api/report.html @@ -13,4 +13,19 @@ {% block content %} + + {% for user, datum in data.items %} + + +

+

+ +

+ {% endfor %} {% endblock content %} \ No newline at end of file diff --git a/api/views.py b/api/views.py index 26d8ef7..3768ad7 100644 --- a/api/views.py +++ b/api/views.py @@ -28,7 +28,7 @@ class ReportView(LoginRequiredMixin, generic.TemplateView): end_date = datetime.strptime(params['end_date'], fmt) except ValueError: pass - + for student in students: interactions = {} #first columns @@ -36,7 +36,7 @@ class ReportView(LoginRequiredMixin, generic.TemplateView): interactions['username'] = student.social_name interactions['init_date'] = init_date interactions['end_date'] = end_date - print(datetime.now()) + #number of help posts created by the student interactions['doubts_count'] = SubjectPost.objects.filter(action="help", create_date__range=(init_date, end_date), space__id=subject_id, user=student).count() @@ -79,11 +79,11 @@ class ReportView(LoginRequiredMixin, generic.TemplateView): #Number of student visualizations on the mural of the subject interactions['mural_visualizations_count'] = MuralVisualizations.objects.filter(post__in = SubjectPost.objects.filter(space__id=subject.id), user = student).count() - print(datetime.now()) + data[student] = interactions - print(data) + context["data"] = data return context -- libgit2 0.21.2