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 | 13 | |
| 14 | 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 | 31 | {% endblock content %} |
| 17 | 32 | \ No newline at end of file | ... | ... |
api/views.py
| ... | ... | @@ -28,7 +28,7 @@ class ReportView(LoginRequiredMixin, generic.TemplateView): |
| 28 | 28 | end_date = datetime.strptime(params['end_date'], fmt) |
| 29 | 29 | except ValueError: |
| 30 | 30 | pass |
| 31 | - | |
| 31 | + | |
| 32 | 32 | for student in students: |
| 33 | 33 | interactions = {} |
| 34 | 34 | #first columns |
| ... | ... | @@ -36,7 +36,7 @@ class ReportView(LoginRequiredMixin, generic.TemplateView): |
| 36 | 36 | interactions['username'] = student.social_name |
| 37 | 37 | interactions['init_date'] = init_date |
| 38 | 38 | interactions['end_date'] = end_date |
| 39 | - print(datetime.now()) | |
| 39 | + | |
| 40 | 40 | #number of help posts created by the student |
| 41 | 41 | interactions['doubts_count'] = SubjectPost.objects.filter(action="help", create_date__range=(init_date, end_date), |
| 42 | 42 | space__id=subject_id, user=student).count() |
| ... | ... | @@ -79,11 +79,11 @@ class ReportView(LoginRequiredMixin, generic.TemplateView): |
| 79 | 79 | #Number of student visualizations on the mural of the subject |
| 80 | 80 | interactions['mural_visualizations_count'] = MuralVisualizations.objects.filter(post__in = SubjectPost.objects.filter(space__id=subject.id), |
| 81 | 81 | user = student).count() |
| 82 | - print(datetime.now()) | |
| 82 | + | |
| 83 | 83 | |
| 84 | 84 | data[student] = interactions |
| 85 | 85 | |
| 86 | - print(data) | |
| 86 | + context["data"] = data | |
| 87 | 87 | |
| 88 | 88 | |
| 89 | 89 | return context | ... | ... |