From f44988df313ff2d40698589d092ad35f4fbf7583 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Tue, 17 Dec 2024 16:00:33 -0600 Subject: Handle non-existent values correctly. --- uploader/templates/phenotypes/add-phenotypes-raw-files.html | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'uploader/templates/phenotypes') diff --git a/uploader/templates/phenotypes/add-phenotypes-raw-files.html b/uploader/templates/phenotypes/add-phenotypes-raw-files.html index 833cd87..27e71c9 100644 --- a/uploader/templates/phenotypes/add-phenotypes-raw-files.html +++ b/uploader/templates/phenotypes/add-phenotypes-raw-files.html @@ -337,13 +337,24 @@ var tableheader = table.find("thead"); var tablebody = table.find("tbody"); var numheadings = 0; + var navalues = formdata + .na_strings + .split(" ") + .map((v) => {return v.trim();}) + .filter((v) => {return Boolean(v);}); filedata.forEach((line) => { if(line.startsWith(formdata.comment_char) || linenum >= numrows) { return false; } var row = $(""); line.split(formdata.separator) - .map((field) => {return field.trim();}) + .map((field) => { + var value = field.trim(); + if(navalues.includes(value)) { + return "⋘NUL⋙"; + } + return value; + }) .filter((field) => { return (field !== "" && field != undefined && field != null); }) -- cgit v1.2.3