From 99c52f7bc9cb90f915dda52e7346f292ad60476e Mon Sep 17 00:00:00 2001
From: Jonas <jonas.zohren@tu-dortmund.de>
Date: Tue, 23 Feb 2021 20:08:26 +0100
Subject: [PATCH] Add better json debug handling

---
 src/App.svelte | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/App.svelte b/src/App.svelte
index 2a98f8e..173973e 100644
--- a/src/App.svelte
+++ b/src/App.svelte
@@ -14,7 +14,7 @@ import FormulaS from "./FormulaS.svelte";
     for (let i = 0; i <= NUMBER_OF_WORKPACKAGES; i++) {
         workPackages.push({a: null, b:null, c: null});
     }
-    $: dataJson = JSON.stringify(workPackages, null, 2)
+    $: dataJson = JSON.stringify(workPackages.filter(({a,b,c}) => a !== null || b !== null || c !== null), null, 2)
     let jsonPasteArea = "";
 
 
@@ -60,7 +60,7 @@ import FormulaS from "./FormulaS.svelte";
         <summary>
             Debug: Show Input as JSON
         </summary>
-        <pre>
+        <pre style="border: 1px solid;">
             {dataJson}
         </pre>
     </details><details>
@@ -81,7 +81,7 @@ import FormulaS from "./FormulaS.svelte";
                     if (typeof elem.c !== 'number' && elem.c !== null)
                         throw TypeError("An 'c' attribute was neither number not null");
                 }
-                workPackages = decoded;
+                workPackages = [...decoded, {a: null, b: null, c: null}];
                 jsonPasteArea = "";
             } catch (error) {
                 alert(error.toString())
-- 
GitLab