From e37d01acb5df1ae1a878b00f2212d166ff178d50 Mon Sep 17 00:00:00 2001
From: Hangzhi Yu <hangzhi@protonmail.com>
Date: Tue, 9 Apr 2024 00:55:15 +0200
Subject: [PATCH] Reformat

---
 .../documentation/LessonInformation.vue       | 24 ++++++++++++-------
 aleksis/apps/alsijil/rules.py                 |  3 +--
 aleksis/apps/alsijil/schema/documentation.py  |  6 ++++-
 aleksis/apps/alsijil/util/predicates.py       |  6 ++++-
 4 files changed, 27 insertions(+), 12 deletions(-)

diff --git a/aleksis/apps/alsijil/frontend/components/coursebook/documentation/LessonInformation.vue b/aleksis/apps/alsijil/frontend/components/coursebook/documentation/LessonInformation.vue
index 86d060922..bcf6b0d6f 100644
--- a/aleksis/apps/alsijil/frontend/components/coursebook/documentation/LessonInformation.vue
+++ b/aleksis/apps/alsijil/frontend/components/coursebook/documentation/LessonInformation.vue
@@ -31,15 +31,18 @@ import PersonChip from "aleksis.core/components/person/PersonChip.vue";
       :subject="documentation.subject"
       v-bind="compact ? dialogActivator.attrs : {}"
       v-on="compact ? dialogActivator.on : {}"
-      />
+    />
     <subject-chip
-      v-if="documentation?.lessonEvent?.amends?.subject && documentation.lessonEvent.amends.subject.id !== documentation.subject.id"
+      v-if="
+        documentation?.lessonEvent?.amends?.subject &&
+        documentation.lessonEvent.amends.subject.id !== documentation.subject.id
+      "
       :subject="documentation.lessonEvent.amends.subject"
       v-bind="compact ? dialogActivator.attrs : {}"
       v-on="compact ? dialogActivator.on : {}"
       class="text-decoration-line-through"
       disabled
-      />
+    />
     <div :class="{ 'd-flex align-center flex-wrap gap': true }">
       <person-chip
         v-for="teacher in documentation.teachers"
@@ -48,7 +51,7 @@ import PersonChip from "aleksis.core/components/person/PersonChip.vue";
         no-link
         v-bind="compact ? dialogActivator.attrs : {}"
         v-on="compact ? dialogActivator.on : {}"
-        />
+      />
       <person-chip
         v-for="teacher in amendedTeachers"
         :person="teacher"
@@ -57,7 +60,7 @@ import PersonChip from "aleksis.core/components/person/PersonChip.vue";
         v-on="compact ? dialogActivator.on : {}"
         class="text-decoration-line-through"
         disabled
-        />
+      />
     </div>
   </div>
 </template>
@@ -83,11 +86,16 @@ export default {
       return this.compact && !this.$vuetify.breakpoint.mobile;
     },
     amendedTeachers() {
-      if (this.documentation?.lessonEvent?.amends?.teachers && this.documentation.lessonEvent.amends.teachers.length) {
-        return this.documentation.lessonEvent.amends.teachers.filter((at) => !this.documentation.teachers.includes((t) => t.id === at.id));
+      if (
+        this.documentation?.lessonEvent?.amends?.teachers &&
+        this.documentation.lessonEvent.amends.teachers.length
+      ) {
+        return this.documentation.lessonEvent.amends.teachers.filter(
+          (at) => !this.documentation.teachers.includes((t) => t.id === at.id),
+        );
       }
       return [];
-    }
+    },
   },
 };
 </script>
diff --git a/aleksis/apps/alsijil/rules.py b/aleksis/apps/alsijil/rules.py
index 206cde1cf..7045b2d03 100644
--- a/aleksis/apps/alsijil/rules.py
+++ b/aleksis/apps/alsijil/rules.py
@@ -384,8 +384,7 @@ view_documentations_for_group_predicate = has_person & (
 add_perm("alsijil.view_documentations_for_group_rule", view_documentations_for_group_predicate)
 
 view_documentations_menu_predicate = has_person & (
-    has_global_perm("alsijil.view_documentation")
-    | can_view_any_documentation
+    has_global_perm("alsijil.view_documentation") | can_view_any_documentation
 )
 add_perm("alsijil.view_documentations_menu_rule", view_documentations_menu_predicate)
 
diff --git a/aleksis/apps/alsijil/schema/documentation.py b/aleksis/apps/alsijil/schema/documentation.py
index 3c67915f8..52b92549f 100644
--- a/aleksis/apps/alsijil/schema/documentation.py
+++ b/aleksis/apps/alsijil/schema/documentation.py
@@ -139,7 +139,11 @@ class DocumentationBatchCreateOrUpdateMutation(graphene.Mutation):
                     else:
                         teachers = lesson_event.amends.teachers
                 else:
-                    course, subject, teachers = lesson_event.course, lesson_event.subject, lesson_event.teachers
+                    course, subject, teachers = (
+                        lesson_event.course,
+                        lesson_event.subject,
+                        lesson_event.teachers,
+                    )
 
                 obj = Documentation.objects.create(
                     datetime_start=datetime_start,
diff --git a/aleksis/apps/alsijil/util/predicates.py b/aleksis/apps/alsijil/util/predicates.py
index d0b50940d..c81468053 100644
--- a/aleksis/apps/alsijil/util/predicates.py
+++ b/aleksis/apps/alsijil/util/predicates.py
@@ -423,7 +423,11 @@ def can_view_any_documentation(user: User):
     """Predicate which checks if the user is allowed to view any documentation."""
     allowed_lesson_events = LessonEvent.objects.related_to_person(user.person)
 
-    return Documentation.objects.filter(Q(teachers=user.person) | Q(lesson_event__in=allowed_lesson_events) | Q(course__teachers=user.person)).exists()
+    return Documentation.objects.filter(
+        Q(teachers=user.person)
+        | Q(lesson_event__in=allowed_lesson_events)
+        | Q(course__teachers=user.person)
+    ).exists()
 
 
 @predicate
-- 
GitLab