Commit 83d82188d1cff60e393443fbd9774c8dd8353dc3

Authored by fbormann
1 parent 65e07ef0

solved issues in two data queries and template issues as well as some translation

reports/locale/pt_BR/LC_MESSAGES/django.po
@@ -8,7 +8,7 @@ msgid "" @@ -8,7 +8,7 @@ msgid ""
8 msgstr "" 8 msgstr ""
9 "Project-Id-Version: PACKAGE VERSION\n" 9 "Project-Id-Version: PACKAGE VERSION\n"
10 "Report-Msgid-Bugs-To: \n" 10 "Report-Msgid-Bugs-To: \n"
11 -"POT-Creation-Date: 2017-03-20 18:40-0300\n" 11 +"POT-Creation-Date: 2017-03-24 18:33-0300\n"
12 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 12 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 13 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14 "Language-Team: LANGUAGE <LL@li.org>\n" 14 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -50,7 +50,7 @@ msgstr &quot;Mural da disciplina&quot; @@ -50,7 +50,7 @@ msgstr &quot;Mural da disciplina&quot;
50 msgid "Messages" 50 msgid "Messages"
51 msgstr "Mensagens" 51 msgstr "Mensagens"
52 52
53 -#: forms.py:52 53 +#: forms.py:52 views.py:133 views.py:200
54 msgid "All" 54 msgid "All"
55 msgstr "Todos" 55 msgstr "Todos"
56 56
@@ -127,84 +127,88 @@ msgid &quot;register(s)&quot; @@ -127,84 +127,88 @@ msgid &quot;register(s)&quot;
127 msgstr "registro(s)" 127 msgstr "registro(s)"
128 128
129 #: templates/reports/view.html:68 129 #: templates/reports/view.html:68
130 -msgid "Interactions Data"  
131 -msgstr "Dados de interação" 130 +msgid "Interactions Data (.csv)"
  131 +msgstr "Dados de interação (.csv)"
132 132
133 -#: views.py:67 133 +#: templates/reports/view.html:72
  134 +msgid "Interactions Data (.xls)"
  135 +msgstr "Dados de interação (.xls)"
  136 +
  137 +#: views.py:70
134 msgid "Report created successfully" 138 msgid "Report created successfully"
135 msgstr "Relatório criado com sucesso!" 139 msgstr "Relatório criado com sucesso!"
136 140
137 -#: views.py:169 141 +#: views.py:224
138 msgid "Number of help posts created by the user." 142 msgid "Number of help posts created by the user."
139 msgstr "Número de postagens de dúvidas criadas no mural da disciplina." 143 msgstr "Número de postagens de dúvidas criadas no mural da disciplina."
140 144
141 -#: views.py:175 145 +#: views.py:230
142 msgid "Amount of comments on help posts created by the student." 146 msgid "Amount of comments on help posts created by the student."
143 msgstr "" 147 msgstr ""
144 "Número de comentários criados para as próprias postagens de dúvidas no mural " 148 "Número de comentários criados para as próprias postagens de dúvidas no mural "
145 "da disciplina." 149 "da disciplina."
146 150
147 -#: views.py:180 151 +#: views.py:235
148 msgid "Amount of comments made by the student on teachers help posts." 152 msgid "Amount of comments made by the student on teachers help posts."
149 msgstr "" 153 msgstr ""
150 "Número de comentários às postagens de dúvidas no mural da disciplina criadas " 154 "Número de comentários às postagens de dúvidas no mural da disciplina criadas "
151 "pelo professor." 155 "pelo professor."
152 156
153 -#: views.py:184 157 +#: views.py:239
154 msgid "Amount of comments made by the student on other students help posts." 158 msgid "Amount of comments made by the student on other students help posts."
155 msgstr "" 159 msgstr ""
156 "Número de comentários às postagens de dúvidas no mural da disciplina criadas " 160 "Número de comentários às postagens de dúvidas no mural da disciplina criadas "
157 "por outros estudantes." 161 "por outros estudantes."
158 162
159 -#: views.py:195 163 +#: views.py:250
160 msgid "Number of help posts created by the user that the teacher commented on." 164 msgid "Number of help posts created by the user that the teacher commented on."
161 msgstr "" 165 msgstr ""
162 "Número de comentários às postagens de dúvidas no mural da disciplina criadas " 166 "Número de comentários às postagens de dúvidas no mural da disciplina criadas "
163 "por outros estudantes" 167 "por outros estudantes"
164 168
165 -#: views.py:203 169 +#: views.py:258
166 msgid "Number of help posts created by the user others students commented on." 170 msgid "Number of help posts created by the user others students commented on."
167 msgstr "" 171 msgstr ""
168 " Número de postagens de dúvidas criadas no mural da disciplina que foram " 172 " Número de postagens de dúvidas criadas no mural da disciplina que foram "
169 "comentadas por outros estudantes." 173 "comentadas por outros estudantes."
170 174
171 -#: views.py:206 175 +#: views.py:261
172 msgid "Number of student visualizations on the mural of the subject." 176 msgid "Number of student visualizations on the mural of the subject."
173 msgstr "Número de visualizações do mural da disciplina." 177 msgstr "Número de visualizações do mural da disciplina."
174 178
175 -#: views.py:218 179 +#: views.py:273
176 msgid "Number of access to mural between 6 a.m to 12a.m. ." 180 msgid "Number of access to mural between 6 a.m to 12a.m. ."
177 msgstr "" 181 msgstr ""
178 "Número de acessos ao ambiente virtual da disciplina no horário de 06h às 12h." 182 "Número de acessos ao ambiente virtual da disciplina no horário de 06h às 12h."
179 183
180 -#: views.py:222 184 +#: views.py:277
181 msgid "Number of access to mural between 0 p.m to 6p.m. ." 185 msgid "Number of access to mural between 0 p.m to 6p.m. ."
182 msgstr "" 186 msgstr ""
183 "Número de acessos ao ambiente virtual da disciplina no horário de 12h às 18h." 187 "Número de acessos ao ambiente virtual da disciplina no horário de 12h às 18h."
184 188
185 -#: views.py:225 189 +#: views.py:280
186 msgid "Number of access to mural between 6 p.m to 12p.m. ." 190 msgid "Number of access to mural between 6 p.m to 12p.m. ."
187 msgstr "" 191 msgstr ""
188 "Número de acessos ao ambiente virtual da disciplina no horário de 18h às 24h." 192 "Número de acessos ao ambiente virtual da disciplina no horário de 18h às 24h."
189 193
190 -#: views.py:229 194 +#: views.py:284
191 msgid "Number of access to mural between 0 a.m to 6a.m. ." 195 msgid "Number of access to mural between 0 a.m to 6a.m. ."
192 msgstr "" 196 msgstr ""
193 "Número de acessos ao ambiente virtual da disciplina no horário de 24h às 06h." 197 "Número de acessos ao ambiente virtual da disciplina no horário de 24h às 06h."
194 198
195 -#: views.py:237 views.py:240 199 +#: views.py:292 views.py:295
196 msgid "Number of access to the subject on " 200 msgid "Number of access to the subject on "
197 msgstr "Número de acessos ao assunto na(o) " 201 msgstr "Número de acessos ao assunto na(o) "
198 202
199 -#: views.py:243 203 +#: views.py:298
200 msgid "Number of distinct days the user access the subject. " 204 msgid "Number of distinct days the user access the subject. "
201 msgstr "Número de dias distintos que acessou o ambiente virtual da disciplina." 205 msgstr "Número de dias distintos que acessou o ambiente virtual da disciplina."
202 206
203 -#: views.py:244 207 +#: views.py:299
204 msgid "Class" 208 msgid "Class"
205 msgstr "Classe" 209 msgstr "Classe"
206 210
207 -#: views.py:245 211 +#: views.py:300
208 msgid "Performance" 212 msgid "Performance"
209 msgstr "Desempenho" 213 msgstr "Desempenho"
210 214
reports/templates/reports/_form.html
@@ -20,16 +20,16 @@ @@ -20,16 +20,16 @@
20 <div id="general-parameters-div"> 20 <div id="general-parameters-div">
21 <div class="general-parameters-field"> 21 <div class="general-parameters-field">
22 {{form.topic.errors}} 22 {{form.topic.errors}}
23 - <label> {{form.topic.label}} </label> 23 + <label class="form-field-report"> {{form.topic.label}} </label>
24 {% render_field form.topic class="form-control" %} 24 {% render_field form.topic class="form-control" %}
25 </div> 25 </div>
26 <div class="general-parameters-field"> 26 <div class="general-parameters-field">
27 - <label> {{form.init_date.label}} </label> 27 + <label class="form-field-report"> {{form.init_date.label}} </label>
28 {% render_field form.init_date class='form-control date-picker' %} 28 {% render_field form.init_date class='form-control date-picker' %}
29 </div> 29 </div>
30 30
31 <div class="general-parameters-field"> 31 <div class="general-parameters-field">
32 - <label> {{form.end_date.label}} </label> 32 + <label class="form-field-report"> {{form.end_date.label}} </label>
33 {% render_field form.end_date class='form-control date-picker' %} 33 {% render_field form.end_date class='form-control date-picker' %}
34 </div> 34 </div>
35 </div> 35 </div>
reports/views.py
@@ -129,18 +129,22 @@ class ViewReportView(LoginRequiredMixin, generic.TemplateView): @@ -129,18 +129,22 @@ class ViewReportView(LoginRequiredMixin, generic.TemplateView):
129 params_data = self.request.GET 129 params_data = self.request.GET
130 subject = Subject.objects.get(id=params_data['subject_id']) 130 subject = Subject.objects.get(id=params_data['subject_id'])
131 context['subject_name'] = subject.name 131 context['subject_name'] = subject.name
132 - context['topic_name'] = params_data['topic'] 132 +
  133 + if params_data['topic'] == _("All"):
  134 + context['topic_name'] = params_data['topic']
  135 + else:
  136 + context['topic_name'] = Topic.objects.get(id=int(params_data['topic'])).name
133 context['init_date'] = params_data['init_date'] 137 context['init_date'] = params_data['init_date']
134 context['end_date'] = params_data['end_date'] 138 context['end_date'] = params_data['end_date']
135 context['subject'] = subject 139 context['subject'] = subject
136 - 140 +
137 #I used getlist method so it can get more than one tag and one resource class_name 141 #I used getlist method so it can get more than one tag and one resource class_name
138 resources = params_data.getlist('resource') 142 resources = params_data.getlist('resource')
139 tags = params_data.getlist('tag') 143 tags = params_data.getlist('tag')
140 144
141 self.from_mural = params_data['from_mural'] 145 self.from_mural = params_data['from_mural']
142 146
143 - context['data'], context['header'] = self.get_mural_data(subject, context['topic_name'], params_data['init_date'], params_data['end_date'], 147 + context['data'], context['header'] = self.get_mural_data(subject, params_data['topic'], params_data['init_date'], params_data['end_date'],
144 resources, tags ) 148 resources, tags )
145 149
146 150
@@ -254,7 +258,7 @@ class ViewReportView(LoginRequiredMixin, generic.TemplateView): @@ -254,7 +258,7 @@ class ViewReportView(LoginRequiredMixin, generic.TemplateView):
254 interactions[_('Number of help posts created by the user others students commented on.')] = help_posts.filter(user=student, id__in = help_posts_ids).count() 258 interactions[_('Number of help posts created by the user others students commented on.')] = help_posts.filter(user=student, id__in = help_posts_ids).count()
255 259
256 #Number of student visualizations on the mural of the subject 260 #Number of student visualizations on the mural of the subject
257 - interactions[_('Number of student visualizations on the mural of the subject.')] = MuralVisualizations.objects.filter(post__in = SubjectPost.objects.filter(space__id=subject.id), 261 + interactions[_('Number of student visualizations on the mural of the subject.')] = MuralVisualizations.objects.filter(post__in = SubjectPost.objects.filter(space__id=subject.id, create_date__range=(init_date, end_date)),
258 user = student).count() 262 user = student).count()
259 263
260 264
@@ -285,8 +289,9 @@ class ViewReportView(LoginRequiredMixin, generic.TemplateView): @@ -285,8 +289,9 @@ class ViewReportView(LoginRequiredMixin, generic.TemplateView):
285 day_names = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"] 289 day_names = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"]
286 distinct_days = 0 290 distinct_days = 0
287 for day_num in day_numbers: 291 for day_num in day_numbers:
  292 + #day+1 is because the days are started on 1 instead of the lists, which index starts at 0
288 interactions[_('Number of access to the subject on ')+ day_names[day_num]] = Log.objects.filter(action="access", resource="subject", 293 interactions[_('Number of access to the subject on ')+ day_names[day_num]] = Log.objects.filter(action="access", resource="subject",
289 - user_id= student.id, context__contains = {'subject_id' : subject.id}, datetime__week_day = day_num, datetime__range = (init_date, end_date)).count() 294 + user_id= student.id, context__contains = {'subject_id' : subject.id}, datetime__week_day = day_num+1, datetime__range = (init_date, end_date)).count()
290 #to save the distinct days the user has accessed 295 #to save the distinct days the user has accessed
291 if interactions[_('Number of access to the subject on ')+ day_names[day_num]] > 0: 296 if interactions[_('Number of access to the subject on ')+ day_names[day_num]] > 0:
292 distinct_days += 1 297 distinct_days += 1