]> git.parisson.com Git - teleforma.git/commitdiff
https://trackers.pilotsystems.net/prebarreau/0238 : webclass summary is now available...
authorYoan Le Clanche <yoanl@pilotsystems.net>
Wed, 1 Sep 2021 13:15:52 +0000 (15:15 +0200)
committerYoan Le Clanche <yoanl@pilotsystems.net>
Wed, 1 Sep 2021 13:15:52 +0000 (15:15 +0200)
.vscode/settings.json
teleforma/templates/teleforma/base.html
teleforma/webclass/templates/webclass/appointments_professor.html
teleforma/webclass/views.py

index 839ddd71b6ca694e985f204d7483e6fdfb5ec2e4..a45c2431bb0c5fa5f835a4dc6750caff487281e6 100644 (file)
@@ -1,3 +1,13 @@
 {
-    "python.pythonPath": "py_env/bin/python3"
+    "python.pythonPath": "py_env/bin/python3",
+    "prettier.disableLanguages": ["django-html"],
+    "beautify.language": {
+        "html": [
+            "django-html"
+        ]
+    },
+    "[django-html]": {
+        "editor.formatOnSave": false,
+        "editor.defaultFormatter": "HookyQR.beautify"
+    }
 }
\ No newline at end of file
index 8ebe49a5fa9be56e16d7d4feecb7af7c6ee750af..28494ba0aeb4f1852fbdd1d234f07249e822e829 100644 (file)
           {% endif %}
           {% endif %}
 
-          {% if user.professor.count %}
+          {% if user.professor.count or user.is_superuser %}
           <li><a href="{% url 'teleforma-webclass-professor' %}" class="yellow">Webclass</a></li>
           {% endif %}
 
index 58250e187174a41d90e3bc08607aa6feec863d8b..6031d1583ea5e41fa7fbd45335428c5af35a603b 100644 (file)
@@ -15,44 +15,52 @@ Calendrier des Webclass
 {% block content %}
 <table class="webclass-appointment listing" width="100%">
     <thead>
-    <tr>
-        <th>Horaire</th>
-        <th>Période</th>
-        <th>Cours</th>
-        {% comment %} <th>IEJ</th> {% endcomment %}
-        <th>Participants</th>
-        <th>Salon</th>
-    </tr>
+        <tr>
+            <th>Horaire</th>
+            <th>Période</th>
+            <th>Cours</th>
+            {% comment %} <th>IEJ</th> {% endcomment %}
+            <th>Participants</th>
+            <th>Salon</th>
+            {% if is_superuser %}
+            <th>Professeur</th>
+            {% endif %}
+        </tr>
     </thead>
     <tbody>
-    {% for slot in slots %}
-    <tr>
-        <td>
-            <span><strong>{{slot.get_day_display}}</strong> de <strong>{{slot.start_hour|date:"H\hi"}}</strong> à <strong>{{slot.end_hour|date:"H\hi"}}</strong></span>
-        </td>
-        <td>
-        {{slot.webclass.period.name}}
-        </td>
-        <td>
-        {{slot.webclass.course.title}}
-        </td>
-        {% comment %} <td>
-        {% for iej in slot.webclass.iej.all %}
-        {{iej.name}}
+        {% for slot in slots %}
+        <tr>
+            <td>
+                <span><strong>{{slot.get_day_display}}</strong> de <strong>{{slot.start_hour|date:"H\hi"}}</strong> à
+                    <strong>{{slot.end_hour|date:"H\hi"}}</strong></span>
+            </td>
+            <td>
+                {{slot.webclass.period.name}}
+            </td>
+            <td>
+                {{slot.webclass.course.title}}
+            </td>
+            {% comment %} <td>
+                {% for iej in slot.webclass.iej.all %}
+                {{iej.name}}
+                {% endfor %}
+            </td> {% endcomment %}
+            <td>
+                {{slot.participants.count}}
+            </td>
+            <td>
+                <a href="{% url 'teleforma-webclass-join' slot.id %}" target="_blank"
+                    class="conference-big-button component_icon button icon_next">Rejoindre la conférence</a>
+            </td>
+            {% if is_superuser %}
+            <td>{{slot.professor}}</td>
+            {% endif %}
+        </tr>
+        {% empty %}
+        <tr>
+            <td colspan="5">Aucune webclasse programmée.</td>
+        </tr>
         {% endfor %}
-        </td> {% endcomment %}
-        <td>
-         {{slot.participants.count}}
-        </td>
-        <td>
-            <a href="{% url 'teleforma-webclass-join' slot.id %}" target="_blank" class="conference-big-button component_icon button icon_next">Rejoindre la conférence</a>
-        </td>
-    </tr>
-    {% empty %}
-    <tr>
-    <td colspan="5">Aucune webclasse programmée.</td>
-    </tr>
-    {% endfor %}
     </tbody>
 </table>
-{% endblock content %}
+{% endblock content %}
\ No newline at end of file
index 327023594e188162035d124226b7c724c6fcc3a5..3cf8c1cc1bab13d6631f28a3a4482818a907cc76 100644 (file)
@@ -24,11 +24,17 @@ class WebclassProfessorAppointments(TemplateView):
                         self).get_context_data(**kwargs)
 
         user = self.request.user
-        if not user.professor:
+        if not user.professor.all() and not user.is_superuser:
             return HttpResponse('Unauthorized', status=401)
         today = datetime.today()
-        context['slots'] = WebclassSlot.published.filter(
-            professor=user.professor.get(), webclass__status=3, webclass__end_date__gte=today).order_by('day', 'start_hour')
+        query = {
+            'webclass__status': 3,
+            'webclass__end_date__gte': today
+        }
+        if user.professor.all():
+            query['professor'] = user.professor.get()
+        context['slots'] = WebclassSlot.published.filter(**query).order_by('day', 'start_hour')
+        context['is_superuser'] = user.is_superuser
         return context