]> git.parisson.com Git - teleforma.git/commitdiff
list all webclass records for staff
authorGuillaume Pellerin <guillaume.pellerin@parisson.com>
Fri, 4 Jul 2025 09:49:00 +0000 (11:49 +0200)
committerGuillaume Pellerin <guillaume.pellerin@parisson.com>
Fri, 4 Jul 2025 09:49:00 +0000 (11:49 +0200)
teleforma/webclass/models.py
teleforma/webclass/templates/webclass/inc/webclass_corrections_list.html
teleforma/webclass/templates/webclass/webclass_record.html

index 89390ffe8f5300cd9b22252f539e4143f85f399a..ee823868a949156ef29f12c8ea910143fa5f265e 100644 (file)
@@ -467,6 +467,8 @@ class WebclassRecord(models.Model):
     def __str__(self):
         return "Enregistrement webclass %d" % self.id
 
+    def is_published(self):
+        return self.status == 3
 
     @staticmethod
     def get_records(period, course):
@@ -474,7 +476,7 @@ class WebclassRecord(models.Model):
         records_mapping = {}
         # id : category mapping
         category_mapping = {}
-        for record in WebclassRecord.objects.filter(period=period, course=course, status=3):
+        for record in WebclassRecord.objects.filter(period=period, course=course):
             if record.record_id:
                 record_ids.add(record.record_id)
                 records_mapping[record.record_id] = record
index d8645aafbe8a592a1b7e46b942ae34779ca752d4..d96d8a4b67f6d0ef3cecefd3d5496bd6898594f7 100644 (file)
@@ -6,7 +6,9 @@
     <table class="listing" width="100%">
         <tbody>
             {% for record in webclass_corrections_records %}
-                {% include "webclass/webclass_record.html" %}
+                {% if record.obj.is_published or user.is_staff or user.professor.count %}
+                    {% include "webclass/webclass_record.html" %}
+                {ยง endif %}
             {% endfor %}
         </tbody>
     </table>
index bfc12d35bf4447260704bdad2f5b59003396c73a..48145b99698dc7b142646e7d47c3e59bcf4873e3 100644 (file)
             </dl>
         </div>
     </td>
+    <td {% if forloop.first %}class="border-top"{% endif %} width="10%" align="center">
+        {% if user.is_staff or user.professor.count %}
+            {% if record.obj._is_published %}
+                <img src="/static/teleforma/images/ok.png" style="vertical-align:middle" alt="" title="{% trans ' published' %}" />
+            {% else %}
+                <img src="/static/teleforma/images/delete.png" style="vertical-align:middle" alt="" title="{% trans ' rejected' %}" />
+            {% endif %}
+        {% endif %}
+    </td>
+
     <div style="padding-left: 1em;">
 
     </div>