From 04c7a24c026b35aba3fcd0ee1becd39682e5f3ad Mon Sep 17 00:00:00 2001
From: Furkan Sahin <furkan-dev@proton.me>
Date: Tue, 31 May 2022 23:18:34 -0500
Subject: selfassign if adding/removing lab in order to update Peer Teachers
 column. Without updating peerTeachers array, changes will not be reflected in
 this column

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

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

diff --git a/src/components/EditorLists.svelte b/src/components/EditorLists.svelte
index d31a427..6eb248f 100644
--- a/src/components/EditorLists.svelte
+++ b/src/components/EditorLists.svelte
@@ -66,6 +66,11 @@
     // Mark lab as assigned
     const lab = $labStore.get(id);
     if (lab !== undefined) lab.assigned = true;
+
+    // Self assignemnt to update `assignedLabs` and `compatibleLabs`
+    selectedPeerTeacher = selectedPeerTeacher;
+    // Self assignment to update PT values used in `Peer Teacher` column
+    peerTeachers = peerTeachers;
   }
 
   function unassignLab(id: number) {
@@ -76,6 +81,11 @@
     // Mark lab as unassigned
     const lab = $labStore.get(id);
     if (lab !== undefined) lab.assigned = false;
+
+    // Self assignemnt to update `assignedLabs` and `compatibleLabs`
+    selectedPeerTeacher = selectedPeerTeacher;
+    // Self assignment to update PT values used in `Peer Teacher` column
+    peerTeachers = peerTeachers;
   }
 </script>
 
-- 
cgit v1.2.3

