]> git.parisson.com Git - teleforma.git/commitdiff
Add date to webclass : https://trackers.pilotsystems.net/prebarreau/0401
authorYoan Le Clanche <yoanl@pilotsystems.net>
Wed, 20 Apr 2022 07:48:32 +0000 (09:48 +0200)
committerYoan Le Clanche <yoanl@pilotsystems.net>
Wed, 20 Apr 2022 07:48:32 +0000 (09:48 +0200)
teleforma/webclass/models.py
teleforma/webclass/templates/webclass/appointments.html
teleforma/webclass/templates/webclass/appointments_professor.html
teleforma/webclass/templates/webclass/inc/webclass_list.html

index 7f6c504f0c32a9a05ede90697b74869c52086d29..524ffbbfb3cc5e86ca38086e0e2550dee9c65729 100644 (file)
@@ -210,6 +210,21 @@ class WebclassSlot(models.Model):
     def __str__(self):
         return "Webclass slot : " + str(self.id)
 
+    @property
+    def date(self):
+        """
+        Compute the last date (from weekday) before the end of webclass.
+        This is the webclass date. Before, webclass were every "monday" for example.
+        Now there is only one date per webclass.
+        This is not ideal. We should have a "date" field on the webclass slot instead of "day". 
+        But we're waiting to see how PB use webclasses in the future.
+        """
+        end_day = self.webclass.end_date
+        next_day = end_day + datetime.timedelta(days=7 - end_day.weekday() + self.day, weeks=-1)
+        if next_day > end_day:
+            next_day = next_day - datetime.timedelta(weeks=1)
+        return next_day
+
     @property
     def remaining_participant_slot(self):
         """
index a052a298417761ca46b8c69576015fefa8227175..7a5652c7002a30c995819572b162de14ef7c2815 100644 (file)
@@ -68,7 +68,7 @@
         {% for slot in slots %}
             <tr>
                 <td>
-                <span class="booking_date"><strong>{{slot.get_day_display}}</strong> de <strong>{{slot.start_hour|date:"H\hi"}}</strong> à <strong>{{slot.end_hour|date:"H\hi"}}</strong></span>
+                <span class="booking_date">{{slot.get_day_display}} <strong>{{slot.date}}</strong> de <strong>{{slot.start_hour|date:"H\hi"}}</strong> à <strong>{{slot.end_hour|date:"H\hi"}}</strong></span>
                 </td>
                 <td>
                 {{slot.professor}}
@@ -79,7 +79,7 @@
 
                 <td>
                     <form class="booking_form" method="POST">
-                        <span class="booking_date" style="display:none"><strong>{{slot.get_day_display}}</strong> de <strong>{{slot.start_hour|date:"H\hi"}}</strong> à <strong>{{slot.end_hour|date:"H\hi"}}</strong></span>
+                        <span class="booking_date" style="display:none">{{slot.get_day_display}} <strong>{{slot.date}}</strong> de <strong>{{slot.start_hour|date:"H\hi"}}</strong> à <strong>{{slot.end_hour|date:"H\hi"}}</strong></span>
                         {% csrf_token %}
                         <input type="hidden" name="slot_id" value="{{slot.id}}" />
                         {% if slot.participant_slot_available %}
index 6031d1583ea5e41fa7fbd45335428c5af35a603b..f48b3c78eab59c4aa40839b4c6e2efcda1cd6717 100644 (file)
@@ -31,7 +31,7 @@ Calendrier des Webclass
         {% for slot in slots %}
         <tr>
             <td>
-                <span><strong>{{slot.get_day_display}}</strong> de <strong>{{slot.start_hour|date:"H\hi"}}</strong> à
+                <span>{{slot.get_day_display}} <strong>{{slot.date}}</strong> de <strong>{{slot.start_hour|date:"H\hi"}}</strong> à
                     <strong>{{slot.end_hour|date:"H\hi"}}</strong></span>
             </td>
             <td>
index a96fc8c616c43da551e659715189ebcc39a343cc..b48d4c0f11ecb96241692f9d95dba8cd5c73a327 100644 (file)
@@ -11,8 +11,8 @@
             {% if webclass_slot %}
             <tr>
                 <td colspan="2">
-                    <p>Vous êtes inscrit pour les webclasses du
-                        <strong>{{webclass_slot.get_day_display}} de
+                    <p>Vous êtes inscrit pour la webclass du
+                        <strong>{{webclass_slot.get_day_display}} {{webclass_slot.date}} de
                             {{webclass_slot.start_hour|date:"H\hi"}} à
                             {{webclass_slot.end_hour|date:"H\hi"}}</strong>
                         avec le professeur <strong>{{webclass_slot.professor.user.last_name}}</strong>.