From 713bab144fc5119c337beb0780f7a1edda3fe10e Mon Sep 17 00:00:00 2001
From: Julian Leucker <leuckerj@gmail.com>
Date: Fri, 16 Feb 2024 20:06:57 +0100
Subject: [PATCH] Reformat

---
 .../documentation/Documentation.vue           | 18 ++++------
 .../documentation/DocumentationModal.vue      |  9 ++---
 .../documentation/LessonSummary.vue           | 35 ++++++++++---------
 aleksis/apps/alsijil/models.py                |  3 +-
 aleksis/apps/alsijil/schema/documentation.py  |  2 +-
 5 files changed, 30 insertions(+), 37 deletions(-)

diff --git a/aleksis/apps/alsijil/frontend/components/documentation/Documentation.vue b/aleksis/apps/alsijil/frontend/components/documentation/Documentation.vue
index 6b38b4c60..f04a7e0c2 100644
--- a/aleksis/apps/alsijil/frontend/components/documentation/Documentation.vue
+++ b/aleksis/apps/alsijil/frontend/components/documentation/Documentation.vue
@@ -4,7 +4,7 @@
     <!-- align-stretch - stretch full-width -->
     <div
       class="full-width d-flex flex-column align-stretch"
-      :class="{ 'flex-md-row': ('compact' in $attrs) }"
+      :class="{ 'flex-md-row': 'compact' in $attrs }"
     >
       <lesson-information
         class="flex-grow-1"
@@ -20,19 +20,13 @@
         @loading="loading = $event"
         @save="$emit('close')"
       />
-      <lesson-notes
-        class="flex-grow-1"
-        :documentation="$attrs.documentation"
-      />
+      <lesson-notes class="flex-grow-1" :documentation="$attrs.documentation" />
     </div>
-    <v-divider/>
+    <v-divider />
     <v-card-actions v-if="!('compact' in $attrs)">
-      <v-spacer/>
+      <v-spacer />
       <cancel-button @click="$emit('close')" :disabled="loading" />
-      <save-button
-        @click="save"
-        :loading="loading"
-      />
+      <save-button @click="save" :loading="loading" />
     </v-card-actions>
   </v-card>
 </template>
@@ -66,7 +60,7 @@ export default {
   methods: {
     save() {
       this.$refs.summary.save();
-      this.$emit('close');
+      this.$emit("close");
     },
   },
 };
diff --git a/aleksis/apps/alsijil/frontend/components/documentation/DocumentationModal.vue b/aleksis/apps/alsijil/frontend/components/documentation/DocumentationModal.vue
index 95ce18a01..c47b172e7 100644
--- a/aleksis/apps/alsijil/frontend/components/documentation/DocumentationModal.vue
+++ b/aleksis/apps/alsijil/frontend/components/documentation/DocumentationModal.vue
@@ -7,21 +7,18 @@
       <documentation
         compact
         @open="popup = true"
-        v-bind="{...$attrs, ...attrs}"
+        v-bind="{ ...$attrs, ...attrs }"
         v-on="on"
       />
     </template>
     <!-- dialog view -> deactivate dialog -->
     <!-- cancel | save (through lesson-summary) -->
-    <documentation
-      v-bind="$attrs"
-      @close="popup = false"
-    />
+    <documentation v-bind="$attrs" @close="popup = false" />
   </mobile-fullscreen-dialog>
 </template>
 
 <script>
-import MobileFullscreenDialog from "aleksis.core/components/generic/dialogs/MobileFullscreenDialog.vue"
+import MobileFullscreenDialog from "aleksis.core/components/generic/dialogs/MobileFullscreenDialog.vue";
 import Documentation from "./Documentation.vue";
 
 export default {
diff --git a/aleksis/apps/alsijil/frontend/components/documentation/LessonSummary.vue b/aleksis/apps/alsijil/frontend/components/documentation/LessonSummary.vue
index 83655e0fd..aa958595a 100644
--- a/aleksis/apps/alsijil/frontend/components/documentation/LessonSummary.vue
+++ b/aleksis/apps/alsijil/frontend/components/documentation/LessonSummary.vue
@@ -41,7 +41,7 @@
       v-if="!compact"
       :label="$t('alsijil.coursebook.summary.topic')"
       :value="documentation.topic"
-      @input="topic=$event"
+      @input="topic = $event"
     />
     <v-textarea
       filled
@@ -49,7 +49,7 @@
       v-if="!compact"
       :label="$t('alsijil.coursebook.summary.homework.label')"
       :value="documentation.homework"
-      @input="homework=$event"
+      @input="homework = $event"
     />
     <v-textarea
       filled
@@ -57,8 +57,8 @@
       v-if="!compact"
       :label="$t('alsijil.coursebook.summary.group_note.label')"
       :value="documentation.groupNote"
-      @input="groupNote=$event"
-      />
+      @input="groupNote = $event"
+    />
   </v-card-text>
 </template>
 
@@ -90,19 +90,19 @@ export default {
   },
   methods: {
     truncate(str) {
-      return str ?
-        (str.length > 25) ? str.slice(0, 24) + ' …' : str
-      : "";
+      return str ? (str.length > 25 ? str.slice(0, 24) + " …" : str) : "";
     },
     handleUpdateAfterCreateOrPatch(itemId, wasCreate) {
       return (cached, incoming) => {
         this.loading = false;
         for (const object of incoming) {
-          console.log('summary: handleUpdateAfterCreateOrPatch', object);
+          console.log("summary: handleUpdateAfterCreateOrPatch", object);
           // Replace the current documentation
-          const index = cached.findIndex((o) => o[itemId] === this.documentation.id);
+          const index = cached.findIndex(
+            (o) => o[itemId] === this.documentation.id,
+          );
           // merged with the incoming partial documentation
-          cached[index] = {...this.documentation, ...object};
+          cached[index] = { ...this.documentation, ...object };
         }
         return cached;
       };
@@ -114,14 +114,15 @@ export default {
         const groupNote = this.groupNote ? { groupNote: this.groupNote } : {};
 
         this.loading = true;
-        console.log("save was called")
 
-        this.createOrPatch([{
-          id: this.documentation.id,
-          ...topic,
-          ...homework,
-          ...groupNote,
-        }]);
+        this.createOrPatch([
+          {
+            id: this.documentation.id,
+            ...topic,
+            ...homework,
+            ...groupNote,
+          },
+        ]);
 
         this.topic = "";
         this.homework = "";
diff --git a/aleksis/apps/alsijil/models.py b/aleksis/apps/alsijil/models.py
index a2d37a972..8e80f165a 100644
--- a/aleksis/apps/alsijil/models.py
+++ b/aleksis/apps/alsijil/models.py
@@ -553,7 +553,8 @@ class Documentation(CalendarEvent):
                     existing_documentations := (
                         event_reference_obj := event["REFERENCE_OBJECT"]
                     ).documentation.filter(
-                        datetime_start=event["DTSTART"].dt.replace(tzinfo=timezone.utc), datetime_end=event["DTEND"].dt.replace(tzinfo=timezone.utc)
+                        datetime_start=event["DTSTART"].dt.replace(tzinfo=timezone.utc),
+                        datetime_end=event["DTEND"].dt.replace(tzinfo=timezone.utc),
                     )
                 ).exists()
                 else cls(
diff --git a/aleksis/apps/alsijil/schema/documentation.py b/aleksis/apps/alsijil/schema/documentation.py
index 4f6bfe431..b72a7f50f 100644
--- a/aleksis/apps/alsijil/schema/documentation.py
+++ b/aleksis/apps/alsijil/schema/documentation.py
@@ -145,7 +145,7 @@ class DocumentationBatchCreateOrUpdateMutation(graphene.Mutation):
             lesson_event = LessonEvent.objects.get(id=lesson_event_id)
 
             if not info.context.user.has_perm(
-                    "alsijil.add_documentation_for_lesson_event_rule", lesson_event
+                "alsijil.add_documentation_for_lesson_event_rule", lesson_event
             ):
                 raise PermissionDenied()
 
-- 
GitLab