From d77021f04a9edd0d736d905a153b36544002c0e8 Mon Sep 17 00:00:00 2001
From: Furkan Sahin <furkan-dev@proton.me>
Date: Tue, 31 May 2022 07:24:46 -0500
Subject: Deleting PT marks all their labs as unassigned

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

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

diff --git a/src/components/EditorLists.svelte b/src/components/EditorLists.svelte
index 7cd17f6..3dda136 100644
--- a/src/components/EditorLists.svelte
+++ b/src/components/EditorLists.svelte
@@ -44,6 +44,11 @@
       selectedPeerTeacher = undefined;
     }
 
+    $ptStore.get(id)?.labs.forEach((lab_id) => {
+      const lab = $labStore?.get(lab_id);
+      if (lab !== undefined) lab.assigned = false;
+    });
+
     ptStore.update((val) => {
       val.delete(id);
       return val;
-- 
cgit v1.2.3

