From 1ef38ce38bc2823ad603fe42f4b918cfab04683c Mon Sep 17 00:00:00 2001
From: Furkan Sahin <furkan-dev@proton.me>
Date: Sun, 7 Aug 2022 22:41:41 -0500
Subject: Display assigned PT's emails as well as output it to CSV

---
 src/components/Labs.svelte | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

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

diff --git a/src/components/Labs.svelte b/src/components/Labs.svelte
index bddf607..680c6f1 100644
--- a/src/components/Labs.svelte
+++ b/src/components/Labs.svelte
@@ -14,6 +14,7 @@
     "Location",
     "Instructor",
     "Assigned PT",
+    "PT Email",
     "",
   ];
 
@@ -43,13 +44,19 @@
   }
   function download() {
     // prepare data in CSV format
-    let cols = headers.slice(1, -1);
+    let cols = headers.slice(1);
     let csv = cols.join(",") + "\n";
     labsAndPts.forEach((row) => {
       let l = row.lab;
-      csv += `${l.course} - ${l.section},${l.time},${
-        l.location
-      },${displayFaculty(l)},${row.pt?.name ?? "UNASSIGNED"}\n`;
+      csv +=
+        [
+          `${l.course} - ${l.section}`,
+          l.time,
+          l.location,
+          displayFaculty(l),
+          row.pt?.name ?? "UNASSIGNED",
+          row.pt?.email ?? "N/A",
+        ].join(",") + "\n";
     });
 
     const blob = new Blob([csv], { type: "text/csv" });
@@ -102,6 +109,7 @@
           <td>{l.lab?.location}</td>
           <td>{displayFaculty(l.lab)}</td>
           <td>{l.pt?.name ?? "UNASSIGNED"}</td>
+          <td>{l.pt?.email ?? "N/A"}</td>
           <td><button class="btn btn-ghost btn-xs">Delete</button></td>
         </tr>
       {/each}
-- 
cgit v1.2.3

