]> git.parisson.com Git - teleforma.git/commitdiff
add corrector courses
authorGuillaume Pellerin <yomguy@parisson.com>
Fri, 13 Jun 2014 01:40:28 +0000 (03:40 +0200)
committerGuillaume Pellerin <yomguy@parisson.com>
Fri, 13 Jun 2014 01:40:28 +0000 (03:40 +0200)
teleforma/exam/models.py
teleforma/exam/templates/exam/inc/script_list.html
teleforma/exam/templates/exam/script_form.html
teleforma/views/core.py
teleforma/views/crfpa.py

index 86478461949c69992b85b99f6e587d12c15556ce..b77d5dee07cd907b05f109203bdfcd24e639bbb6 100644 (file)
@@ -133,7 +133,9 @@ class Quota(models.Model):
     def level(self):
         if self.value:
             if self.value != 0:
-                return 100*self.corrector.scripts.filter(Q(status=2) | Q(status=3)).count()/self.value
+                level = 100*self.corrector.scripts.filter(Q(status=2) | Q(status=3) | Q(status=4)).count()/self.value
+                print level
+                return level
             else:
                 return 0
         else:
@@ -303,6 +305,7 @@ class Script(BaseResource):
         #notify_user(mess, 'acceptance')
         
     def reject(self):
+        self.date_marked = datetime.datetime.now()
         self.date_rejected = datetime.datetime.now()
         context = {}
         text = render_to_string('exam/messages/script_rejected.txt', context)
index 4246e224ad54fb23457ef4bad27cfedfc2de8c6b..a9ac2c5885a23b01252d6ef804b637f40d1e45f7 100644 (file)
@@ -28,8 +28,8 @@
      <td><a href="{% url teleforma-exam-script-detail period.id script.id %}">{{ script.session }}</a></td>
      <td><a href="{% url teleforma-exam-script-detail period.id script.id %}">{{ script.type }}</a></td>
      <td><a href="{% url teleforma-exam-script-detail period.id script.id %}">{{ script.date_submitted }}</a></td>
-     <td><a href="{% url teleforma-exam-script-detail period.id script.id %}">{{ script.date_marked }}</a></td>
-     <td><a href="{% url teleforma-exam-script-detail period.id script.id %}">{{ script.score }}</a></td>
+     <td><a href="{% url teleforma-exam-script-detail period.id script.id %}">{% if script.date_marked %}{{ script.date_marked }}{% endif %}</a></td>
+     <td><a href="{% url teleforma-exam-script-detail period.id script.id %}">{% if script.score %}{{ script.score }}{% endif %}</a></td>
     </tr>
     {% endfor %}
     </tbody>
index ee8512aaaab8332f7b9003bf14247ae8950a5c26..de1ce161d6f6872b9a92a96c8e7d191c81536377 100644 (file)
@@ -25,7 +25,7 @@
 {% trans "New script" %}
 </div>
 
-<div class="course_content" id="media_infos">
+<div class="course_content" id="media_infos" style="font-size: 115%;">
     <form method="post" id="_ScriptForm" action="">{% csrf_token %}
        <table>
        <tr><td colspan="2">{% for error in form.non_field_errors %}<li class="error">{{ error }}</li>{% endfor %}</td></tr>
index 4966db11df127116133be91447e4d28b096a7790..747ee16e735910c2fc75a55026bc5fe83cb86cd6 100644 (file)
@@ -173,6 +173,11 @@ def get_periods(user):
         professor = user.professor.get()
         periods = Period.objects.all()
 
+    corrector = user.correctors.all()
+    if corrector:
+        corrector = user.correctors.get()
+        periods = Period.objects.all()
+
     return periods
 
 def get_default_period(periods):
index 68930fa85b76a8645f7f8f0fb8eb7179c08bde1b..b4655de19d48af13ae53f9edc25a8d25d2b87f4e 100644 (file)
@@ -50,12 +50,18 @@ def get_crfpa_courses(user, date_order=False, num_order=False, period=None):
 
     professor = user.professor.all()
     student = user.student.all()
+    corrector = user.correctors.all()
 
     if professor:
         professor = user.professor.get()
         courses = format_courses(courses, queryset=professor.courses.all(),
                                   types=CourseType.objects.all())
 
+    if corrector:
+        corrector = user.correctors.get()
+        #FIXME
+        courses = format_courses(courses, queryset=Course.objects.all(),
+                    types=CourseType.objects)
     elif student:
         student = user.student.get()
         for training in student.trainings.all():