From 09bbabb765d9e8c64b9455394295b5732622d3c3 Mon Sep 17 00:00:00 2001
From: Furkan Sahin <furkan-dev@proton.me>
Date: Wed, 27 Jul 2022 19:19:10 -0500
Subject: Parse the `csv` questionnairre. Currently populates values for
 recently added attributes for only existing PTs.

---
 src/components/FileUploads.svelte | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

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

diff --git a/src/components/FileUploads.svelte b/src/components/FileUploads.svelte
index 14b0be3..e5df56f 100644
--- a/src/components/FileUploads.svelte
+++ b/src/components/FileUploads.svelte
@@ -8,12 +8,14 @@
     parseDatabaseFile,
     parseLabScheduleFile,
     parsePTFile,
+    readQuestionairre,
   } from "../logic/EditorActions";
   import { labStore, ptStore } from "../stores";
 
   let ptSchedules: FileList | null;
   let labSchedule: FileList | null;
   let dbFile: FileList | null;
+  let questionairreFile: FileList | null;
   let snackbar: Snackbar;
   let snackbarText;
 
@@ -81,6 +83,12 @@
     }
   }
 
+  $: {
+    if (questionairreFile?.length) {
+      readQuestionairre(questionairreFile[0]);
+    }
+  }
+
   function dbStringify(): string {
     const peerTeachers = [...$ptStore.values()];
     const labs = [...$labStore.values()];
@@ -173,6 +181,18 @@
       >LocalStorage</button
     >
   </Card>
+
+  <Card
+    title="Upload PTs from Questionnairre"
+    desc="Gather all data from the questionnairre results. Should be in CSV format"
+  >
+    <UploadButton
+      color="btn-info"
+      accept="text/csv"
+      multiple={false}
+      bind:files={questionairreFile}
+    />
+  </Card>
 </div>
 
 <!-- https://github.com/saadeghi/daisyui/issues/221 -->
-- 
cgit v1.2.3

