From 5ebad87e1460e20088ddb911c93bf2fa1b02cf1c Mon Sep 17 00:00:00 2001
From: Julian Leucker <leuckerj@gmail.com>
Date: Thu, 2 May 2024 19:37:07 +0200
Subject: [PATCH] Reformat

---
 .../components/coursebook/Coursebook.vue      | 93 ++++++++++---------
 .../components/coursebook/CoursebookDay.vue   | 13 +--
 .../coursebook/CoursebookLoader.vue           |  4 +-
 .../absences/ManageStudentsDialog.vue         | 33 +++----
 aleksis/apps/alsijil/schema/documentation.py  |  2 +-
 .../alsijil/schema/participation_status.py    |  2 +-
 6 files changed, 75 insertions(+), 72 deletions(-)

diff --git a/aleksis/apps/alsijil/frontend/components/coursebook/Coursebook.vue b/aleksis/apps/alsijil/frontend/components/coursebook/Coursebook.vue
index 94d9bb5ff..af143a59a 100644
--- a/aleksis/apps/alsijil/frontend/components/coursebook/Coursebook.vue
+++ b/aleksis/apps/alsijil/frontend/components/coursebook/Coursebook.vue
@@ -21,20 +21,20 @@
       <coursebook-day
         v-for="{ date, docs, first, last } in groupDocsByDay(items)"
         v-intersect="{
-            handler: intersectHandler(date, first, last),
-            options: {
-              rootMargin: '-' + topMargin + 'px 0px 0px 0px',
-              threshold: [0, 1],
-            },
-          }"
+          handler: intersectHandler(date, first, last),
+          options: {
+            rootMargin: '-' + topMargin + 'px 0px 0px 0px',
+            threshold: [0, 1],
+          },
+        }"
         :date="date"
         :docs="docs"
         :lastQuery="lastQuery"
-        :focus-on-mount="initDate && (initDate.toMillis() === date.toMillis())"
+        :focus-on-mount="initDate && initDate.toMillis() === date.toMillis()"
         @init="transition"
         :key="'day-' + date"
         ref="days"
-        />
+      />
       <coursebook-loader />
 
       <date-select-footer
@@ -42,13 +42,10 @@
         @input="gotoDate"
         @prev="gotoPrev"
         @next="gotoNext"
-        />
+      />
     </template>
     <template #loading>
-      <coursebook-loader
-        :number-of-days="10"
-        :number-of-docs="5"
-      />
+      <coursebook-loader :number-of-days="10" :number-of-docs="5" />
     </template>
 
     <template #no-data>
@@ -190,12 +187,12 @@ export default {
   methods: {
     resetDate(toDate) {
       // Assure current date
-      console.log('Resetting date range', this.$route.hash);
+      console.log("Resetting date range", this.$route.hash);
       this.currentDate = toDate || this.$route.hash?.substring(1);
       if (!this.currentDate) {
-        console.log('Set default date');
+        console.log("Set default date");
         this.setDate(DateTime.now().toISODate());
-      } 
+      }
 
       const date = DateTime.fromISO(this.currentDate);
       this.initDate = date;
@@ -203,15 +200,15 @@ export default {
       this.dateEnd = date.plus({ days: this.dayIncrement }).toISODate();
     },
     transition() {
-      this.initDate = false
-      this.ready = true
+      this.initDate = false;
+      this.ready = true;
     },
     groupDocsByDay(docs) {
       // => {dt: {date: dt, docs: doc ...} ...}
       const docsByDay = docs.reduce((byDay, doc) => {
         // This works with dummy. Does actual doc have dateStart instead?
         const day = DateTime.fromISO(doc.datetimeStart).startOf("day");
-        byDay[day] ??= {date: day, docs: []};
+        byDay[day] ??= { date: day, docs: [] };
         byDay[day].docs.push(doc);
         return byDay;
       }, {});
@@ -219,7 +216,7 @@ export default {
       // sorting is necessary since backend can send docs unordered
       return Object.keys(docsByDay)
         .sort()
-        .map((key, idx, {length}) => {
+        .map((key, idx, { length }) => {
           const day = docsByDay[key];
           day.first = idx === 0;
           const lastIdx = length - 1;
@@ -229,7 +226,7 @@ export default {
     },
     // docsByDay: {dt: [dt doc ...] ...}
     fetchMore(from, to, then) {
-      console.log('fetching', from, to);
+      console.log("fetching", from, to);
       this.lastQuery.fetchMore({
         variables: {
           dateStart: from,
@@ -237,10 +234,10 @@ export default {
         },
         // Transform the previous result with new data
         updateQuery: (previousResult, { fetchMoreResult }) => {
-          console.log('Received more');
+          console.log("Received more");
           then();
           return { items: previousResult.items.concat(fetchMoreResult.items) };
-        }
+        },
       });
     },
     setDate(date) {
@@ -248,7 +245,7 @@ export default {
       if (!this.hashUpdater) {
         this.hashUpdater = window.requestIdleCallback(() => {
           if (!(this.$route.hash.substring(1) === this.currentDate)) {
-            this.$router.replace({ hash: this.currentDate })
+            this.$router.replace({ hash: this.currentDate });
           }
           this.hashUpdater = false;
         });
@@ -257,7 +254,8 @@ export default {
     fixScrollPos(height, top) {
       this.$nextTick(() => {
         if (height < document.documentElement.scrollHeight) {
-          document.documentElement.scrollTop = document.documentElement.scrollHeight - height + top;
+          document.documentElement.scrollTop =
+            document.documentElement.scrollHeight - height + top;
           this.ready = true;
         } else {
           // Update top, could have changed in the meantime.
@@ -270,28 +268,35 @@ export default {
       return (entries) => {
         const entry = entries[0];
         if (entry.isIntersecting) {
-
-          if ((entry.boundingClientRect.top <= this.topMargin) || first) {
-            console.log('@ ', date.toISODate());
+          if (entry.boundingClientRect.top <= this.topMargin || first) {
+            console.log("@ ", date.toISODate());
             this.setDate(date.toISODate());
           }
 
           if (once && this.ready && first) {
-            console.log('load up', date.toISODate());
+            console.log("load up", date.toISODate());
             this.ready = false;
-            this.fetchMore(date.minus({ days: this.dayIncrement }).toISODate(),
-                           date.minus({ days: 1 }).toISODate(),
-                          () => {
-                            this.fixScrollPos(document.documentElement.scrollHeight,
-                                              document.documentElement.scrollTop);
-                          });
+            this.fetchMore(
+              date.minus({ days: this.dayIncrement }).toISODate(),
+              date.minus({ days: 1 }).toISODate(),
+              () => {
+                this.fixScrollPos(
+                  document.documentElement.scrollHeight,
+                  document.documentElement.scrollTop,
+                );
+              },
+            );
             once = false;
           } else if (once && this.ready && last) {
-            console.log('load down', date.toISODate());
+            console.log("load down", date.toISODate());
             this.ready = false;
-            this.fetchMore(date.plus({ days: 1 }).toISODate(),
-                           date.plus({ days: this.dayIncrement }).toISODate(),
-                           () => { this.ready = true });
+            this.fetchMore(
+              date.plus({ days: 1 }).toISODate(),
+              date.plus({ days: this.dayIncrement }).toISODate(),
+              () => {
+                this.ready = true;
+              },
+            );
             once = false;
           }
         }
@@ -319,15 +324,19 @@ export default {
         .find((date2) => date2 > date);
     },
     gotoDate(date) {
-      const present = this.$refs.days
-            .find((day) => day.date.toISODate() === date);
+      const present = this.$refs.days.find(
+        (day) => day.date.toISODate() === date,
+      );
 
       if (present) {
         // React immediatly -> smoother navigation
         // Also intersect handler does not always react to scrollIntoView
         this.setDate(date);
         present.focus("smooth");
-      } else if (!this.findPrev(DateTime.fromISO(date)) || !this.findNext(DateTime.fromISO(date))) {
+      } else if (
+        !this.findPrev(DateTime.fromISO(date)) ||
+        !this.findNext(DateTime.fromISO(date))
+      ) {
         this.resetDate(date);
       }
     },
diff --git a/aleksis/apps/alsijil/frontend/components/coursebook/CoursebookDay.vue b/aleksis/apps/alsijil/frontend/components/coursebook/CoursebookDay.vue
index 7b49df371..14411e9ce 100644
--- a/aleksis/apps/alsijil/frontend/components/coursebook/CoursebookDay.vue
+++ b/aleksis/apps/alsijil/frontend/components/coursebook/CoursebookDay.vue
@@ -1,8 +1,5 @@
 <template>
-  <v-list-item
-    :style="{ scrollMarginTop: '145px' }"
-    two-line
-  >
+  <v-list-item :style="{ scrollMarginTop: '145px' }" two-line>
     <v-list-item-content>
       <v-subheader class="text-h6">{{
         $d(date, "dateWithWeekday")
@@ -48,21 +45,21 @@ export default {
       default: false,
     },
   },
-  emits: ['init'],
+  emits: ["init"],
   methods: {
     focus(how) {
       this.$el.scrollIntoView({
         behavior: how,
         block: "start",
-        inline: "nearest"
+        inline: "nearest",
       });
-      console.log('focused @', this.date.toISODate());
+      console.log("focused @", this.date.toISODate());
     },
   },
   mounted() {
     if (this.focusOnMount) {
       this.$nextTick(this.focus("instant"));
-      this.$emit('init');
+      this.$emit("init");
     }
   },
 };
diff --git a/aleksis/apps/alsijil/frontend/components/coursebook/CoursebookLoader.vue b/aleksis/apps/alsijil/frontend/components/coursebook/CoursebookLoader.vue
index dfcfe81a6..a5136eb9f 100644
--- a/aleksis/apps/alsijil/frontend/components/coursebook/CoursebookLoader.vue
+++ b/aleksis/apps/alsijil/frontend/components/coursebook/CoursebookLoader.vue
@@ -24,12 +24,12 @@ export default {
     numberOfDays: {
       type: Number,
       required: false,
-      default: 1
+      default: 1,
     },
     numberOfDocs: {
       type: Number,
       required: false,
-      default: 1
+      default: 1,
     },
   },
 };
diff --git a/aleksis/apps/alsijil/frontend/components/coursebook/absences/ManageStudentsDialog.vue b/aleksis/apps/alsijil/frontend/components/coursebook/absences/ManageStudentsDialog.vue
index 2be88d215..ad561da59 100644
--- a/aleksis/apps/alsijil/frontend/components/coursebook/absences/ManageStudentsDialog.vue
+++ b/aleksis/apps/alsijil/frontend/components/coursebook/absences/ManageStudentsDialog.vue
@@ -1,5 +1,4 @@
 <script>
-import BackButton from "aleksis.core/components/generic/BackButton.vue";
 import CancelButton from "aleksis.core/components/generic/buttons/CancelButton.vue";
 import MobileFullscreenDialog from "aleksis.core/components/generic/dialogs/MobileFullscreenDialog.vue";
 import documentationPartMixin from "../documentation/documentationPartMixin";
@@ -10,25 +9,24 @@ export default {
   name: "ManageStudentsDialog",
   extends: MobileFullscreenDialog,
   components: {
-    BackButton,
     CancelButton,
     LessonInformation,
     MobileFullscreenDialog,
     SlideIterator,
   },
-  mixins: [ documentationPartMixin ],
+  mixins: [documentationPartMixin],
   data() {
     return {
       dialog: false,
       search: "",
       selected: [],
       isExpanded: false,
-    }
+    };
   },
   computed: {
     items() {
       return this.documentation.participations;
-    }
+    },
   },
 };
 </script>
@@ -69,9 +67,11 @@ export default {
         v-model="selected"
         :items="items"
         :search="search"
-        :item-key-getter="item => 'documentation-' + documentation.id + '-student-' + item.id"
+        :item-key-getter="
+          (item) => 'documentation-' + documentation.id + '-student-' + item.id
+        "
         :is-expanded.sync="isExpanded"
-        >
+      >
         <template #listItemContent="{ item }">
           <v-list-item-title>
             {{ item.person.fullName }}
@@ -86,13 +86,8 @@ export default {
         <template #expandedItem="{ item, close }">
           <v-card-title>
             <v-tooltip bottom>
-              <template v-slot:activator="{ on, attrs }">
-                <v-btn
-                  v-bind="attrs"
-                  v-on="on"
-                  icon
-                  @click="close"
-                >
+              <template #activator="{ on, attrs }">
+                <v-btn v-bind="attrs" v-on="on" icon @click="close">
                   <v-icon>$prev</v-icon>
                 </v-btn>
               </template>
@@ -110,11 +105,13 @@ export default {
     </template>
 
     <template #actions>
-      <cancel-button @click="dialog = false" i18n-key="actions.close" v-show="$vuetify.breakpoint.mobile" />
+      <cancel-button
+        @click="dialog = false"
+        i18n-key="actions.close"
+        v-show="$vuetify.breakpoint.mobile"
+      />
     </template>
   </mobile-fullscreen-dialog>
 </template>
 
-<style scoped>
-
-</style>
+<style scoped></style>
diff --git a/aleksis/apps/alsijil/schema/documentation.py b/aleksis/apps/alsijil/schema/documentation.py
index c28fd2003..e9ece98b8 100644
--- a/aleksis/apps/alsijil/schema/documentation.py
+++ b/aleksis/apps/alsijil/schema/documentation.py
@@ -19,9 +19,9 @@ from aleksis.core.schema.base import (
     PermissionsTypeMixin,
 )
 from aleksis.core.util.core_helpers import get_site_preferences
-from .participation_status import ParticipationStatusType
 
 from ..models import Documentation
+from .participation_status import ParticipationStatusType
 
 
 class DocumentationType(PermissionsTypeMixin, DjangoFilterMixin, DjangoObjectType):
diff --git a/aleksis/apps/alsijil/schema/participation_status.py b/aleksis/apps/alsijil/schema/participation_status.py
index 86254a86c..48053dc22 100644
--- a/aleksis/apps/alsijil/schema/participation_status.py
+++ b/aleksis/apps/alsijil/schema/participation_status.py
@@ -1,7 +1,7 @@
 from graphene_django import DjangoObjectType
 
 from aleksis.apps.alsijil.models import ParticipationStatus
-from aleksis.core.schema.base import PermissionsTypeMixin, DjangoFilterMixin
+from aleksis.core.schema.base import DjangoFilterMixin, PermissionsTypeMixin
 
 
 class ParticipationStatusType(PermissionsTypeMixin, DjangoFilterMixin, DjangoObjectType):
-- 
GitLab