Commit 431b542ee44950d566b0b4ccf1ae9e6aca2d33ae
1 parent
88d734ea
Exists in
master
and in
3 other branches
report view of data, still has no restriction about user but all the data is her…
…e and the parameters are sent via GET request
Showing
2 changed files
with
19 additions
and
4 deletions
Show diff stats
api/templates/api/report.html
| @@ -13,4 +13,19 @@ | @@ -13,4 +13,19 @@ | ||
| 13 | 13 | ||
| 14 | {% block content %} | 14 | {% block content %} |
| 15 | 15 | ||
| 16 | + | ||
| 17 | + {% for user, datum in data.items %} | ||
| 18 | + | ||
| 19 | + | ||
| 20 | + <p> | ||
| 21 | + <ul> | ||
| 22 | + | ||
| 23 | + {{user}} : | ||
| 24 | + {% for key, value in datum.items %} | ||
| 25 | + <li>{{key}}: {{value}}</li> | ||
| 26 | + {% endfor %} | ||
| 27 | + </ul> | ||
| 28 | + | ||
| 29 | + </p> | ||
| 30 | + {% endfor %} | ||
| 16 | {% endblock content %} | 31 | {% endblock content %} |
| 17 | \ No newline at end of file | 32 | \ No newline at end of file |
api/views.py
| @@ -28,7 +28,7 @@ class ReportView(LoginRequiredMixin, generic.TemplateView): | @@ -28,7 +28,7 @@ class ReportView(LoginRequiredMixin, generic.TemplateView): | ||
| 28 | end_date = datetime.strptime(params['end_date'], fmt) | 28 | end_date = datetime.strptime(params['end_date'], fmt) |
| 29 | except ValueError: | 29 | except ValueError: |
| 30 | pass | 30 | pass |
| 31 | - | 31 | + |
| 32 | for student in students: | 32 | for student in students: |
| 33 | interactions = {} | 33 | interactions = {} |
| 34 | #first columns | 34 | #first columns |
| @@ -36,7 +36,7 @@ class ReportView(LoginRequiredMixin, generic.TemplateView): | @@ -36,7 +36,7 @@ class ReportView(LoginRequiredMixin, generic.TemplateView): | ||
| 36 | interactions['username'] = student.social_name | 36 | interactions['username'] = student.social_name |
| 37 | interactions['init_date'] = init_date | 37 | interactions['init_date'] = init_date |
| 38 | interactions['end_date'] = end_date | 38 | interactions['end_date'] = end_date |
| 39 | - print(datetime.now()) | 39 | + |
| 40 | #number of help posts created by the student | 40 | #number of help posts created by the student |
| 41 | interactions['doubts_count'] = SubjectPost.objects.filter(action="help", create_date__range=(init_date, end_date), | 41 | interactions['doubts_count'] = SubjectPost.objects.filter(action="help", create_date__range=(init_date, end_date), |
| 42 | space__id=subject_id, user=student).count() | 42 | space__id=subject_id, user=student).count() |
| @@ -79,11 +79,11 @@ class ReportView(LoginRequiredMixin, generic.TemplateView): | @@ -79,11 +79,11 @@ class ReportView(LoginRequiredMixin, generic.TemplateView): | ||
| 79 | #Number of student visualizations on the mural of the subject | 79 | #Number of student visualizations on the mural of the subject |
| 80 | interactions['mural_visualizations_count'] = MuralVisualizations.objects.filter(post__in = SubjectPost.objects.filter(space__id=subject.id), | 80 | interactions['mural_visualizations_count'] = MuralVisualizations.objects.filter(post__in = SubjectPost.objects.filter(space__id=subject.id), |
| 81 | user = student).count() | 81 | user = student).count() |
| 82 | - print(datetime.now()) | 82 | + |
| 83 | 83 | ||
| 84 | data[student] = interactions | 84 | data[student] = interactions |
| 85 | 85 | ||
| 86 | - print(data) | 86 | + context["data"] = data |
| 87 | 87 | ||
| 88 | 88 | ||
| 89 | return context | 89 | return context |