From f37ed7cf6950f2717d59fce8737787d55ac21275 Mon Sep 17 00:00:00 2001 From: Quentin Ra Date: Thu, 7 Oct 2021 12:47:16 +0200 Subject: [PATCH] fix: solving error when disabling options --- statistics/csv/summary.html | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/statistics/csv/summary.html b/statistics/csv/summary.html index bc6f8dd..45d96ef 100644 --- a/statistics/csv/summary.html +++ b/statistics/csv/summary.html @@ -88,9 +88,10 @@
Please, select a CSV
for (let i = 0; i < headers.length; i++) { const header = headers[i]; - const mean = res.empirical_mean.shift(); - const variance = res.empirical_variance.shift(); - const std_deviation = res.empirical_std_deviation.shift(); + // if calculated, then ... + const mean = res.empirical_mean === false ? null : res.empirical_mean.shift(); + const variance = res.empirical_variance === false ? null : res.empirical_variance.shift(); + const std_deviation = res.empirical_std_deviation === false ? null : res.empirical_std_deviation.shift(); let bundle = {error: false, text: ""}; @@ -112,6 +113,7 @@
Please, select a CSV
} results_div.innerHTML = `${columns}${body}
` } catch (e) { + console.log(e) results_div.innerHTML = 'Dataset is empty.'; } } @@ -119,10 +121,15 @@
Please, select a CSV
function checkResultAndAppend(value, bundle) { let type = typeof value; if (type !== "boolean") { - if (type === "string") { // error - bundle.error = true; + if (value != null) { + if (type === "string") { // error + bundle.error = true; + } + bundle.text += `${value}`; + } else { + // not calculated + bundle.text += `x`; } - bundle.text += `${value}`; return bundle; } }