Commit 3be7ec9df59de75dc8407049e5e04206af610ebe
1 parent
ed70024a
Exists in
master
and in
3 other branches
fixed breadcrumbs and variable names
Showing
4 changed files
with
26 additions
and
17 deletions
Show diff stats
reports/forms.py
| ... | ... | @@ -5,7 +5,7 @@ import datetime |
| 5 | 5 | |
| 6 | 6 | |
| 7 | 7 | class CreateInteractionReportForm(forms.Form): |
| 8 | - topic = forms.ChoiceField( label= _("topics to select data from")) | |
| 8 | + topic = forms.ChoiceField( label= _("Topics to select data from")) | |
| 9 | 9 | init_date = forms.DateField() |
| 10 | 10 | end_date = forms.DateField() |
| 11 | 11 | |
| ... | ... | @@ -22,4 +22,4 @@ class CreateInteractionReportForm(forms.Form): |
| 22 | 22 | topics = list(initial['topic']) |
| 23 | 23 | |
| 24 | 24 | self.fields['topic'].choices = [(topic.id, topic.name) for topic in topics] |
| 25 | - self.fields['topic'].choices.append((_("all"), _("all"))) | |
| 25 | + self.fields['topic'].choices.append((_("All"), _("All"))) | ... | ... |
reports/templates/reports/create.html
reports/templates/reports/view.html
| ... | ... | @@ -6,7 +6,8 @@ |
| 6 | 6 | |
| 7 | 7 | {% block breadcrumbs %} |
| 8 | 8 | {{ block.super }} |
| 9 | - | |
| 9 | + {% breadcrumb view.subject.category 'subjects:cat_view' view.subject.category.slug %} | |
| 10 | + {% breadcrumb view.subject 'subjects:view' view.subject.slug %} | |
| 10 | 11 | {% breadcrumb 'analytics' '' %} |
| 11 | 12 | {% endblock %} |
| 12 | 13 | ... | ... |
reports/views.py
| ... | ... | @@ -34,6 +34,13 @@ class ReportView(LoginRequiredMixin, generic.FormView): |
| 34 | 34 | initial['end_date'] = date.today() |
| 35 | 35 | return initial |
| 36 | 36 | |
| 37 | + def get_context_data(self, **kwargs): | |
| 38 | + context = super(ReportView, self).get_context_data(**kwargs) | |
| 39 | + subject = Subject.objects.get(id=self.request.GET['subject_id']) | |
| 40 | + | |
| 41 | + context['subject'] = subject | |
| 42 | + | |
| 43 | + return context | |
| 37 | 44 | |
| 38 | 45 | def get_success_url(self): |
| 39 | 46 | |
| ... | ... | @@ -93,7 +100,7 @@ class ViewReportView(LoginRequiredMixin, generic.TemplateView): |
| 93 | 100 | except ValueError: |
| 94 | 101 | pass |
| 95 | 102 | |
| 96 | - header = ['social_name'] | |
| 103 | + header = ['User'] | |
| 97 | 104 | |
| 98 | 105 | for student in students: |
| 99 | 106 | data[student] = [] |
| ... | ... | @@ -107,22 +114,22 @@ class ViewReportView(LoginRequiredMixin, generic.TemplateView): |
| 107 | 114 | create_date__range=(init_date, end_date)) |
| 108 | 115 | |
| 109 | 116 | #number of help posts created by the student |
| 110 | - interactions['doubts_count'] = help_posts_made_by_user.count() | |
| 117 | + interactions['v01'] = help_posts_made_by_user.count() | |
| 111 | 118 | |
| 112 | 119 | help_posts = SubjectPost.objects.filter(action="help", create_date__range=(init_date, end_date), |
| 113 | 120 | space__id=subject.id) |
| 114 | 121 | |
| 115 | 122 | #comments count on help posts created by the student |
| 116 | - interactions['comments_count'] = Comment.objects.filter(post__in = help_posts.filter(user=student), | |
| 123 | + interactions['v02'] = Comment.objects.filter(post__in = help_posts.filter(user=student), | |
| 117 | 124 | create_date__range=(init_date, end_date)).count() |
| 118 | 125 | |
| 119 | 126 | |
| 120 | 127 | #count the amount of comments made by the student on posts made by one of the professors |
| 121 | - interactions['comments_professor_count'] = Comment.objects.filter(post__in = help_posts.filter(user__in= subject.professor.all()), create_date__range=(init_date, end_date), | |
| 128 | + interactions['v03'] = Comment.objects.filter(post__in = help_posts.filter(user__in= subject.professor.all()), create_date__range=(init_date, end_date), | |
| 122 | 129 | user=student).count() |
| 123 | 130 | |
| 124 | 131 | #comments made by the user on other users posts |
| 125 | - interactions['comments_on_others_count'] = Comment.objects.filter(post__in = help_posts.exclude(user=student), | |
| 132 | + interactions['v04'] = Comment.objects.filter(post__in = help_posts.exclude(user=student), | |
| 126 | 133 | create_date__range=(init_date, end_date), |
| 127 | 134 | user= student).count() |
| 128 | 135 | |
| ... | ... | @@ -133,7 +140,7 @@ class ViewReportView(LoginRequiredMixin, generic.TemplateView): |
| 133 | 140 | for comment in comments_by_teacher: |
| 134 | 141 | help_posts_ids.append(comment.post.id) |
| 135 | 142 | #number of help posts created by the user that the teacher commented on |
| 136 | - interactions['help_posts_commented_by_teacher'] = help_posts.filter(user=student, id__in = help_posts_ids).count() | |
| 143 | + interactions['v05'] = help_posts.filter(user=student, id__in = help_posts_ids).count() | |
| 137 | 144 | |
| 138 | 145 | |
| 139 | 146 | comments_by_others = Comment.objects.filter(user__in=subject.students.exclude(id = student.id)) |
| ... | ... | @@ -141,33 +148,33 @@ class ViewReportView(LoginRequiredMixin, generic.TemplateView): |
| 141 | 148 | for comment in comments_by_teacher: |
| 142 | 149 | help_posts_ids.append(comment.post.id) |
| 143 | 150 | #number of help posts created by the user others students commented on |
| 144 | - interactions['help_posts_commented_by_others'] = help_posts.filter(user=student, id__in = help_posts_ids).count() | |
| 151 | + interactions['v06'] = help_posts.filter(user=student, id__in = help_posts_ids).count() | |
| 145 | 152 | |
| 146 | 153 | #Number of student visualizations on the mural of the subject |
| 147 | - interactions['mural_visualizations_count'] = MuralVisualizations.objects.filter(post__in = SubjectPost.objects.filter(space__id=subject.id), | |
| 154 | + interactions['v07'] = MuralVisualizations.objects.filter(post__in = SubjectPost.objects.filter(space__id=subject.id), | |
| 148 | 155 | user = student).count() |
| 149 | 156 | |
| 150 | 157 | |
| 151 | 158 | #VAR20 - number of access to mural between 6 a.m to 12a.m. |
| 152 | - interactions['access_subject_between_6_to_12_am'] = Log.objects.filter(action="access", resource="subject", | |
| 159 | + interactions['v20'] = Log.objects.filter(action="access", resource="subject", | |
| 153 | 160 | user_id= student.id, context__contains = {'subject_id' : subject.id}, datetime__hour__range = (5, 11)).count() |
| 154 | 161 | |
| 155 | 162 | #VAR21 - number of access to mural between 6 a.m to 12a.m. |
| 156 | - interactions['access_subject_between_0_to_6_pm'] = Log.objects.filter(action="access", resource="subject", | |
| 163 | + interactions['v21'] = Log.objects.filter(action="access", resource="subject", | |
| 157 | 164 | user_id= student.id, context__contains = {'subject_id' : subject.id}, datetime__hour__range = (11, 17)).count() |
| 158 | 165 | #VAR22 |
| 159 | - interactions['access_subject_between_6_to_12_pm'] = Log.objects.filter(action="access", resource="subject", | |
| 166 | + interactions['v22'] = Log.objects.filter(action="access", resource="subject", | |
| 160 | 167 | user_id= student.id, context__contains = {'subject_id' : subject.id}, datetime__hour__range = (17, 23)).count() |
| 161 | 168 | |
| 162 | 169 | #VAR23 |
| 163 | - interactions['access_subject_between_0_to_6_am'] = Log.objects.filter(action="access", resource="subject", | |
| 170 | + interactions['v23'] = Log.objects.filter(action="access", resource="subject", | |
| 164 | 171 | user_id= student.id, context__contains = {'subject_id' : subject.id}, datetime__hour__range = (23, 5)).count() |
| 165 | 172 | |
| 166 | 173 | #VAR24 through 30 |
| 167 | 174 | day_numbers = [0, 1, 2, 3, 4, 5, 6] |
| 168 | 175 | day_names = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"] |
| 169 | 176 | for day_num in day_numbers: |
| 170 | - interactions['access_subject_'+day_names[day_num]] = Log.objects.filter(action="access", resource="subject", | |
| 177 | + interactions['v'+ str(24+day_num)] = Log.objects.filter(action="access", resource="subject", | |
| 171 | 178 | user_id= student.id, context__contains = {'subject_id' : subject.id}, datetime__week_day = day_num).count() |
| 172 | 179 | |
| 173 | 180 | for value in interactions.values(): | ... | ... |