Commit 16df6da4a46ca401e0e2c289bc459519a1cb1a16
1 parent
b9b8b0e7
Exists in
master
and in
5 other branches
Change answer poll log function
[Issue: #244]
Showing
1 changed file
with
0 additions
and
10 deletions
Show diff stats
poll/views.py
@@ -285,12 +285,6 @@ class AnswerStudentPoll(LoginRequiredMixin, LogMixin, generic.CreateView): | @@ -285,12 +285,6 @@ class AnswerStudentPoll(LoginRequiredMixin, LogMixin, generic.CreateView): | ||
285 | context_object_name = 'answer' | 285 | context_object_name = 'answer' |
286 | template_name = 'poll/answer_student.html' | 286 | template_name = 'poll/answer_student.html' |
287 | 287 | ||
288 | - def dispatch(self, *args, **kwargs): | ||
289 | - if self.request.method == 'GET': | ||
290 | - self.request.session['time_call'] = datetime.datetime.now() | ||
291 | - | ||
292 | - return super(AnswerStudentPoll, self).dispatch(*args, **kwargs) | ||
293 | - | ||
294 | def form_valid(self, form): | 288 | def form_valid(self, form): |
295 | poll = get_object_or_404(Poll, slug = self.kwargs.get('slug')) | 289 | poll = get_object_or_404(Poll, slug = self.kwargs.get('slug')) |
296 | answers = AnswersStudent( | 290 | answers = AnswersStudent( |
@@ -304,10 +298,6 @@ class AnswerStudentPoll(LoginRequiredMixin, LogMixin, generic.CreateView): | @@ -304,10 +298,6 @@ class AnswerStudentPoll(LoginRequiredMixin, LogMixin, generic.CreateView): | ||
304 | if(key != 'csrfmiddlewaretoken'): | 298 | if(key != 'csrfmiddlewaretoken'): |
305 | answers.answer.add(poll.answers.all().filter(order=key)[0]) | 299 | answers.answer.add(poll.answers.all().filter(order=key)[0]) |
306 | 300 | ||
307 | - time_call = self.request.session.get('time_call') | ||
308 | - time_spent = datetime.datetime.now() - time_call | ||
309 | - | ||
310 | - self.log_context['time_spent'] = time_spent.total_seconds() | ||
311 | self.log_context['poll_id'] = poll.id | 301 | self.log_context['poll_id'] = poll.id |
312 | self.log_context['poll_slug'] = poll.slug | 302 | self.log_context['poll_slug'] = poll.slug |
313 | self.log_context['topic_id'] = poll.topic.id | 303 | self.log_context['topic_id'] = poll.topic.id |