From 36f74cc38e624c6296cc217f4e8025fb7a4cdbdc Mon Sep 17 00:00:00 2001
From: Hangzhi Yu <hangzhi@protonmail.com>
Date: Tue, 30 Apr 2024 13:45:59 +0200
Subject: [PATCH] Reformat

---
 .../components/SubstitutionOverview.vue       | 169 +++++++++---------
 .../substitutions/LessonInformation.vue       |   6 +-
 .../substitutions/SubstitutionCard.vue        |  41 +++--
 aleksis/apps/chronos/schema/__init__.py       |   6 +-
 4 files changed, 107 insertions(+), 115 deletions(-)

diff --git a/aleksis/apps/chronos/frontend/components/SubstitutionOverview.vue b/aleksis/apps/chronos/frontend/components/SubstitutionOverview.vue
index 35831f8c..84607ef5 100644
--- a/aleksis/apps/chronos/frontend/components/SubstitutionOverview.vue
+++ b/aleksis/apps/chronos/frontend/components/SubstitutionOverview.vue
@@ -14,94 +14,91 @@ import dateSortedIteratorMixin from "../mixins/dateSortedIteratorMixin.js";
 
 <template>
   <infinite-scrolling-date-sorted-c-r-u-d-iterator
-      :gql-query="gqlQuery"
-      :gql-additional-query-args="gqlQueryArgs"
-      :gql-patch-mutation="gqlPatchMutation"
-      :get-patch-data="gqlGetPatchData"
-      i18n-key="chronos.substitutions.overview"
-      :enable-search="true"
-      :enable-create="false"
-      :show-create="false"
-      :enable-delete="false"
-      :enable-edit="true"
-      :elevated="false"
-      :force-model-item-update="true"
-    >
-      <template #additionalActions="{ attrs, on }">
-        <v-autocomplete
-          :items="groups"
-          item-text="name"
-          clearable
-          return-object
-          filled
-          dense
-          hide-details
-          :placeholder="$t('chronos.substitutions.overview.filter.groups')"
-          :loading="$apollo.queries.groups.loading"
-          :value="currentObj"
-          @input="changeSelection"
-          @click:clear="changeSelection"
-        />
-        <v-alert type="info" outlined dense class="full-width">
-          <v-row
-            align="center"
-            no-gutters
-          >
-            <v-col class="grow">
-              {{ $t("chronos.substitutions.overview.info_alert.text") }}
-            </v-col>
-            <v-spacer></v-spacer>
-            <v-col class="shrink">
-              <v-btn
-                color="info"
-                outlined
-                small
-                :to="{ name: 'kolego.absences' }"
-              >
-                {{ $t("chronos.substitutions.overview.info_alert.button") }}
-              </v-btn>
-            </v-col>
-          </v-row>
-        </v-alert>
-      </template>
+    :gql-query="gqlQuery"
+    :gql-additional-query-args="gqlQueryArgs"
+    :gql-patch-mutation="gqlPatchMutation"
+    :get-patch-data="gqlGetPatchData"
+    i18n-key="chronos.substitutions.overview"
+    :enable-search="true"
+    :enable-create="false"
+    :show-create="false"
+    :enable-delete="false"
+    :enable-edit="true"
+    :elevated="false"
+    :force-model-item-update="true"
+  >
+    <template #additionalActions="{ attrs, on }">
+      <v-autocomplete
+        :items="groups"
+        item-text="name"
+        clearable
+        return-object
+        filled
+        dense
+        hide-details
+        :placeholder="$t('chronos.substitutions.overview.filter.groups')"
+        :loading="$apollo.queries.groups.loading"
+        :value="currentObj"
+        @input="changeSelection"
+        @click:clear="changeSelection"
+      />
+      <v-alert type="info" outlined dense class="full-width">
+        <v-row align="center" no-gutters>
+          <v-col class="grow">
+            {{ $t("chronos.substitutions.overview.info_alert.text") }}
+          </v-col>
+          <v-spacer></v-spacer>
+          <v-col class="shrink">
+            <v-btn
+              color="info"
+              outlined
+              small
+              :to="{ name: 'kolego.absences' }"
+            >
+              {{ $t("chronos.substitutions.overview.info_alert.button") }}
+            </v-btn>
+          </v-col>
+        </v-row>
+      </v-alert>
+    </template>
 
-      <template #item="{ item, lastQuery }">
-        <substitution-card
-          :substitution="item"
-          :affected-query="lastQuery"
-          :is-create="false"
-          :gql-patch-mutation="gqlPatchMutation"
-        />
-      </template>
+    <template #item="{ item, lastQuery }">
+      <substitution-card
+        :substitution="item"
+        :affected-query="lastQuery"
+        :is-create="false"
+        :gql-patch-mutation="gqlPatchMutation"
+      />
+    </template>
 
-      <template #itemLoader>
-        <v-card class="my-2 full-width">
-          <div class="full-width d-flex flex-column align-stretch flex-md-row">
-            <v-card-text>
-              <v-skeleton-loader
-                type="avatar, heading, chip"
-                class="d-flex full-width align-center gap"
-                height="100%"
-              />
-            </v-card-text>
-            <v-card-text>
-              <v-skeleton-loader
-                type="heading"
-                class="d-flex full-width align-center gap"
-                height="100%"
-              />
-            </v-card-text>
-            <v-card-text>
-              <v-skeleton-loader
-                type="button"
-                class="d-flex full-width align-center justify-end gap"
-                height="100%"
-              />
-            </v-card-text>
-          </div>
-        </v-card>
-      </template>
-    </infinite-scrolling-date-sorted-c-r-u-d-iterator>
+    <template #itemLoader>
+      <v-card class="my-2 full-width">
+        <div class="full-width d-flex flex-column align-stretch flex-md-row">
+          <v-card-text>
+            <v-skeleton-loader
+              type="avatar, heading, chip"
+              class="d-flex full-width align-center gap"
+              height="100%"
+            />
+          </v-card-text>
+          <v-card-text>
+            <v-skeleton-loader
+              type="heading"
+              class="d-flex full-width align-center gap"
+              height="100%"
+            />
+          </v-card-text>
+          <v-card-text>
+            <v-skeleton-loader
+              type="button"
+              class="d-flex full-width align-center justify-end gap"
+              height="100%"
+            />
+          </v-card-text>
+        </div>
+      </v-card>
+    </template>
+  </infinite-scrolling-date-sorted-c-r-u-d-iterator>
 </template>
 
 <script>
diff --git a/aleksis/apps/chronos/frontend/components/substitutions/LessonInformation.vue b/aleksis/apps/chronos/frontend/components/substitutions/LessonInformation.vue
index fa5c66f4..62f2857c 100644
--- a/aleksis/apps/chronos/frontend/components/substitutions/LessonInformation.vue
+++ b/aleksis/apps/chronos/frontend/components/substitutions/LessonInformation.vue
@@ -10,11 +10,7 @@ import { DateTime } from "luxon";
     <div class="d-flex">
       <v-tooltip bottom v-if="lesson.cancelled">
         <template #activator="{ on, attrs }">
-          <v-icon
-            color="error"
-            class="mr-md-4"
-            v-on="on"
-            v-bind="attrs"
+          <v-icon color="error" class="mr-md-4" v-on="on" v-bind="attrs"
             >mdi-cancel</v-icon
           >
         </template>
diff --git a/aleksis/apps/chronos/frontend/components/substitutions/SubstitutionCard.vue b/aleksis/apps/chronos/frontend/components/substitutions/SubstitutionCard.vue
index b69cd290..84f140a2 100644
--- a/aleksis/apps/chronos/frontend/components/substitutions/SubstitutionCard.vue
+++ b/aleksis/apps/chronos/frontend/components/substitutions/SubstitutionCard.vue
@@ -47,10 +47,10 @@ import createOrPatchMixin from "aleksis.core/mixins/createOrPatchMixin.js";
             close-icon="mdi-reload"
             @click:close="addTeacher(teacher)"
           >
-            <v-icon left>
-              $cancel
-            </v-icon>
-            <div class="text-decoration-line-through">{{ teacher.fullName }}</div>
+            <v-icon left> $cancel </v-icon>
+            <div class="text-decoration-line-through">
+              {{ teacher.fullName }}
+            </div>
           </v-chip>
         </template>
         <template #selection="data">
@@ -154,22 +154,25 @@ export default {
   },
   computed: {
     teachersWithStatus() {
-      const oldIds = this.substitution.amends.teachers.map((teacher) => teacher.id);
+      const oldIds = this.substitution.amends.teachers.map(
+        (teacher) => teacher.id,
+      );
       const newIds = this.substitution.teachers.map((teacher) => teacher.id);
-      const allTeachers = new Set(this.substitution.amends.teachers.concat(this.substitution.teachers));
-      let teachersWithStatus = Array.from(allTeachers)
-        .map((teacher) => {
-          let status = "regular";
-          if (newIds.includes(teacher.id) && !oldIds.includes(teacher.id)) {
-            status = "new";
-          } else if (
-            !newIds.includes(teacher.id) &&
-            oldIds.includes(teacher.id)
-          ) {
-            status = "removed";
-          }
-          return { ...teacher, status: status };
-        });
+      const allTeachers = new Set(
+        this.substitution.amends.teachers.concat(this.substitution.teachers),
+      );
+      let teachersWithStatus = Array.from(allTeachers).map((teacher) => {
+        let status = "regular";
+        if (newIds.includes(teacher.id) && !oldIds.includes(teacher.id)) {
+          status = "new";
+        } else if (
+          !newIds.includes(teacher.id) &&
+          oldIds.includes(teacher.id)
+        ) {
+          status = "removed";
+        }
+        return { ...teacher, status: status };
+      });
       return teachersWithStatus;
     },
   },
diff --git a/aleksis/apps/chronos/schema/__init__.py b/aleksis/apps/chronos/schema/__init__.py
index 6898fb5a..d0172159 100644
--- a/aleksis/apps/chronos/schema/__init__.py
+++ b/aleksis/apps/chronos/schema/__init__.py
@@ -93,7 +93,6 @@ class LessonEventType(DjangoObjectType):
         return []
 
 
-
 class DatetimeTimezoneMixin:
     """Handle datetimes for mutations with CalendarEvent objects.
 
@@ -189,9 +188,7 @@ class SubstitutionBatchCreateOrUpdateMutation(graphene.Mutation):
                 amended_lesson_event.timezone
             )
 
-            if info.context.user.has_perm(
-                "chronos.change_lessonsubstitution"
-            ):
+            if info.context.user.has_perm("chronos.change_lessonsubstitution"):
                 obj = LessonEvent.objects.create(
                     datetime_start=datetime_start,
                     datetime_end=datetime_end,
@@ -238,7 +235,6 @@ class SubstitutionBatchCreateOrUpdateMutation(graphene.Mutation):
         return SubstitutionBatchCreateOrUpdateMutation(substitutions=objs)
 
 
-
 class TimetableType(graphene.Enum):
     TEACHER = "teacher"
     GROUP = "group"
-- 
GitLab