From 6ef793f5593bb88d1bbf716a396cb5ab1022afb5 Mon Sep 17 00:00:00 2001
From: Furkan Sahin <furkan-dev@proton.me>
Date: Tue, 31 May 2022 07:18:41 -0500
Subject: Instead of checking whether a lab is self-assigned, check whether the
 lab is assigned to any PT at all!

---
 src/components/EditorLists.svelte | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

(limited to 'src/components/EditorLists.svelte')

diff --git a/src/components/EditorLists.svelte b/src/components/EditorLists.svelte
index 1b2084a..7cd17f6 100644
--- a/src/components/EditorLists.svelte
+++ b/src/components/EditorLists.svelte
@@ -29,8 +29,11 @@
 
   $: compatibleLabs = labs.filter(
     (lab) =>
-      !selectedPeerTeacher?.labs.has(lab.id) &&
+      // Lab not already assigned
+      !lab.assigned &&
+      // PT schedule not conflict with lab
       !selectedPeerTeacher?.conflictsWith(lab.event) &&
+      // PT's labs not conflict with this lab
       !assignedLabs.some((assignment) =>
         assignment.event.conflictsWith(lab.event)
       )
-- 
cgit v1.2.3

