From 358a543d781387b4c58f7f524679440e0dbe9621 Mon Sep 17 00:00:00 2001
From: Hangzhi Yu <hangzhi@protonmail.com>
Date: Wed, 11 Dec 2024 11:01:34 +0100
Subject: [PATCH] Also show slot numbers for substitution lessons in coursebook

---
 .../documentation/LessonInformation.vue       | 25 ++++++++++++-------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/aleksis/apps/alsijil/frontend/components/coursebook/documentation/LessonInformation.vue b/aleksis/apps/alsijil/frontend/components/coursebook/documentation/LessonInformation.vue
index a104d8442..eeee1819f 100644
--- a/aleksis/apps/alsijil/frontend/components/coursebook/documentation/LessonInformation.vue
+++ b/aleksis/apps/alsijil/frontend/components/coursebook/documentation/LessonInformation.vue
@@ -10,24 +10,19 @@ import SubjectChipSelectField from "aleksis.apps.cursus/components/SubjectChipSe
     <div class="d-flex">
       <documentation-status v-if="compact" v-bind="documentationPartProps" />
       <div
-        v-if="documentation.amends?.slotNumberStart"
+        v-if="slotNumberStart"
         :class="{
           'text-h5 mr-3 d-flex flex-column justify-center slot-number': true,
           'ml-2 slot-number-mobile': !largeGrid,
         }"
       >
         <span
-          v-if="
-            documentation.amends?.slotNumberStart ==
-            documentation.amends?.slotNumberEnd
-          "
+          v-if="slotNumberStart == slotNumberEnd"
         >
-          {{ documentation.amends?.slotNumberStart }}.
+          {{ slotNumberStart }}.
         </span>
         <span v-else>
-          {{ documentation.amends?.slotNumberStart }}.–{{
-            documentation.amends?.slotNumberEnd
-          }}.
+          {{ slotNumberStart }}.–{{slotNumberEnd}}.
         </span>
       </div>
       <div :class="{ 'text-right d-flex flex-column fit-content': largeGrid }">
@@ -158,6 +153,18 @@ export default {
       }
       return [];
     },
+    slotNumberStart() {
+      if (this.documentation?.amends?.amends?.slotNumberStart) {
+        return this.documentation.amends.amends.slotNumberStart;
+      }
+      return this.documentation.amends?.slotNumberStart;
+    },
+    slotNumberEnd() {
+      if (this.documentation?.amends?.amends?.slotNumberEnd) {
+        return this.documentation.amends.amends.slotNumberEnd;
+      }
+      return this.documentation.amends?.slotNumberEnd;
+    },
   },
 };
 </script>
-- 
GitLab