]> git.parisson.com Git - teleforma.git/commitdiff
fix video icon, fix bug validated
authoryomguy <yomguy@parisson.com>
Thu, 24 Jan 2013 14:02:57 +0000 (15:02 +0100)
committeryomguy <yomguy@parisson.com>
Thu, 24 Jan 2013 14:02:57 +0000 (15:02 +0100)
teleforma/context_processors.py
teleforma/models/pro.py
teleforma/templates/teleforma/seminar_media_audio.html
teleforma/templates/teleforma/seminar_media_video.html

index c1475798eacdde24fc72d4be9125120c53fbacd6..83f20b87ad1bde34e00f998c7d76c4d58799c057 100644 (file)
 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:
index 089232c06847e31d902a99222e3acbb288566a67..d965dbc9424cfee6293064958f090cd74d287503 100755 (executable)
@@ -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):
index f52e69d5708beef44884b53345c53475a8d093de..8c5c6f899107e37aa51a87d5bdf213355cdc237b 100644 (file)
@@ -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 %}
-     <div class="module_action"> 
+     <div class="module_action">
      <a href="{{ MEDIA_URL }}{{ media.item.file }}" class="component_icon button" id="action_red"><img src="{{STATIC_URL}}teleforma/images/download_media.png" alt="" style="vertical-align:middle" />&nbsp;{% trans "Download" %}</a>
      </div>
     {% endif %}
 <div class="course_media">
 
 <div class="course_title">
-    <div style="float: right; font-size: 0.9em;">
+
+    <div style="float: left; font-size: 0.9em;">
         <a href="{% url teleforma-seminar-detail seminar.id %}" class="component_icon button icon_previous">&nbsp;{% trans "Back" %}</a>
-                
-        <a href="{% url teleforma-media-video seminar.id media.id %}" class="component_icon button icon_speaker">&nbsp;{% trans "Video" %}</a>
-        
+    </div>
+
+    <div style="float: right; font-size: 0.9em;">
+        <a href="{% url teleforma-media-video seminar.id media.id %}" class="component_icon button icon_clap">&nbsp;{% trans "Video" %}</a>
+
         {% if user.is_staff %}
         <a id="publish" href="#" class="{% if media.is_published %}component_icon button icon_ok{% else %}component_icon button icon_delete{% endif %}">{% if media.is_published %}{% trans " published" %}{% else %}{% trans " rejected" %}{% endif %}</a>
         {% endif %}
     </div>
 
-    <a href="{% url teleforma-seminar-detail seminar.id %}">{{ seminar.title }}</a>
+    <div style="text-align: center; padding: 0em .5em 0em .5em;">
+      <a href="{% url teleforma-seminar-detail seminar.id %}">{{ seminar.title }}</a>
+    </div>
 
 </div>
 
  <div id="index">
   <ul>
   {% for marker in media.item.markers.all %}
-  {% if not forloop.first %}
   <li><a href="#" onclick="jumpToTimeoffset({{ marker.time|point }});">{{ marker.title }}</a></li>
-  {% endif %}
   {% endfor %}
   </ul>
  </div>
@@ -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 %}
- <div class="module_action"> 
+ <div class="module_action">
    <a href="{{ MEDIA_URL }}{{ media.item.transcoded.all.0.file }}" class="component_icon button" id="action_red"><img src="{{STATIC_URL}}teleforma/images/download_media.png" alt="" style="vertical-align:middle" />&nbsp;{% trans "Download" %}</a>
  </div>
 {% endif %}
index 9e121d5dd0bf93f4060f73a69fb1b413687bf8b7..8d409a62a179e24635cf59caec52aa7beb08b5dd 100644 (file)
@@ -73,6 +73,7 @@ $(window).ready(function(){
     <div style="float: left; font-size: 0.9em;">
         <a href="{% url teleforma-seminar-detail seminar.id %}" class="component_icon button icon_previous">&nbsp;{% trans "Back" %}</a>
     </div>
+
     <div style="float: right; font-size: 0.9em;">
         <a href="{% url teleforma-media-audio seminar.id media.id %}" class="component_icon button icon_speaker">&nbsp;{% trans "Audio" %}</a>
 
@@ -80,9 +81,11 @@ $(window).ready(function(){
         <a id="publish" href="#" class="{% if media.is_published %}component_icon button icon_ok{% else %}component_icon button icon_delete{% endif %}">{% if media.is_published %}{% trans " published" %}{% else %}{% trans " rejected" %}{% endif %}</a>
         {% endif %}
     </div>
-    <div style="text-align: center;">
+
+    <div style="text-align: center; padding: 0em .5em 0em .5em;">
       <a href="{% url teleforma-seminar-detail seminar.id %}">{{ seminar.title }}</a>
     </div>
+
 </div>
 
 {% if access_error %}