From: yomguy Date: Thu, 24 Jan 2013 14:02:57 +0000 (+0100) Subject: fix video icon, fix bug validated X-Git-Tag: 0.9-probarreau~112 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=22e4c2732b4ec78a7e8f47deda4b48bdd39a0d2e;p=teleforma.git fix video icon, fix bug validated --- diff --git a/teleforma/context_processors.py b/teleforma/context_processors.py index c1475798..83f20b87 100644 --- a/teleforma/context_processors.py +++ b/teleforma/context_processors.py @@ -36,20 +36,20 @@ from teleforma.views.core import * -def seminar_progress(user, seminar): +def seminar_progress(user, seminar): """return the user progress of a seminar in percent """ progress = 0 total = 0 - + objects = [seminar.docs_1, seminar.docs_2, seminar.medias, seminar.docs_correct] for obj in objects: for item in obj.all(): total += item.weight if user in item.readers.all(): progress += item.weight - + questions = Question.objects.filter(seminar=seminar, status=3) for question in questions: total += question.weight @@ -67,11 +67,12 @@ def seminar_validated(user, seminar): questions = seminar.question.filter(status=3) if questions: for question in questions: - answers = Answer.objects.filter(question=question, user=user, validated=True) + answers = Answer.objects.filter(question=question, user=user) if answers: - validated.append(True) - else: - validated.append(False) + if answers[0].validated: + validated.append(True) + else: + validated.append(False) return not False in validated return False @@ -82,7 +83,7 @@ def all_seminars(request, progress_order=False, date_order=False): user = request else: user = request.user - + if not user.is_authenticated(): return {} @@ -93,7 +94,7 @@ def all_seminars(request, progress_order=False, date_order=False): seminars = [] professor = user.professor.get() courses = professor.courses.all() - + for course in courses: for seminar in course.seminar.all(): seminars.append(seminar) @@ -139,7 +140,7 @@ def total_progress(request): professor = user.professor.all() if auditor and not (user.is_staff or user.is_superuser): - seminars = auditor[0].seminars.all() + seminars = auditor[0].seminars.all() elif user.is_superuser or user.is_staff: seminars = Seminar.objects.all() elif professor: diff --git a/teleforma/models/pro.py b/teleforma/models/pro.py index 089232c0..d965dbc9 100755 --- a/teleforma/models/pro.py +++ b/teleforma/models/pro.py @@ -160,7 +160,7 @@ class Answer(models.Model): class Meta(MetaCore): db_table = app_label + '_' + 'answer' verbose_name = _('Answer') - ordering = ['-date_submitted'] + ordering = ['-date_submitted', '-date_validated'] class TestimonialTemplate(models.Model): diff --git a/teleforma/templates/teleforma/seminar_media_audio.html b/teleforma/templates/teleforma/seminar_media_audio.html index f52e69d5..8c5c6f89 100644 --- a/teleforma/templates/teleforma/seminar_media_audio.html +++ b/teleforma/templates/teleforma/seminar_media_audio.html @@ -6,7 +6,7 @@ {% block module-action %} {% for media in media.all %} {% if media.item.file and media.is_published and media.item.file.path|in_download_formats %} -
+ {% endif %} @@ -17,17 +17,22 @@
-
+ + + + - {{ seminar.title }} +
@@ -100,9 +105,7 @@
    {% for marker in media.item.markers.all %} - {% if not forloop.first %}
  • {{ marker.title }}
  • - {% endif %} {% endfor %}
@@ -126,7 +129,7 @@ function jumpToTimeoffset(time) { {% block module-action-right %} {% if media.item.file and media.is_published and media.item.file.path|in_download_formats %} -
+ {% endif %} diff --git a/teleforma/templates/teleforma/seminar_media_video.html b/teleforma/templates/teleforma/seminar_media_video.html index 9e121d5d..8d409a62 100644 --- a/teleforma/templates/teleforma/seminar_media_video.html +++ b/teleforma/templates/teleforma/seminar_media_video.html @@ -73,6 +73,7 @@ $(window).ready(function(){ + - {% if access_error %}