From 1e175280f849d170dc6713aa9a5bba161469b92d Mon Sep 17 00:00:00 2001 From: ankurjuneja Date: Mon, 18 Oct 2021 21:16:53 -0700 Subject: [PATCH 1/2] log non-date and non-string type date values --- ehr/resources/scripts/ehr/utils.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/ehr/resources/scripts/ehr/utils.js b/ehr/resources/scripts/ehr/utils.js index a8b84e4ce..2873f707e 100644 --- a/ehr/resources/scripts/ehr/utils.js +++ b/ehr/resources/scripts/ehr/utils.js @@ -180,18 +180,21 @@ EHR.Server.Utils = new function(){ console.error('Unable to parse date string: ' + val); } } - else if (!isNaN(val)){ - // NOTE: i'm not sure if we should really attempt this. this should really never happen, - // and it's probably an error if it does - normalizedVal = new Date(val); - } else { - if (val['getTime']){ - normalizedVal = new Date(val.getTime()); + console.log('EHR trigger script is being passed a date with value: ' + val); + if (!isNaN(val)) { + // NOTE: i'm not sure if we should really attempt this. this should really never happen, + // and it's probably an error if it does + normalizedVal = new Date(val); } else { - if (!supppressErrors) - console.error('Unknown datatype for date value. Type was: ' + (typeof val) + ' and value was: ' + val); + if (val['getTime']) { + normalizedVal = new Date(val.getTime()); + } + else { + if (!supppressErrors) + console.error('Unknown datatype for date value. Type was: ' + (typeof val) + ' and value was: ' + val); + } } } From 9e2ab5e1321041543b50da21fcc76eb4d806adc6 Mon Sep 17 00:00:00 2001 From: ankurjuneja Date: Mon, 18 Oct 2021 21:33:23 -0700 Subject: [PATCH 2/2] add log for overflowing location --- ehr/resources/queries/ehr_lookups/cage.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ehr/resources/queries/ehr_lookups/cage.js b/ehr/resources/queries/ehr_lookups/cage.js index c86eff59a..1462e5135 100644 --- a/ehr/resources/queries/ehr_lookups/cage.js +++ b/ehr/resources/queries/ehr_lookups/cage.js @@ -14,6 +14,9 @@ function onUpsert(helper, scriptErrors, row, oldRow) { row.location = row.room; if (row.cage) row.location += '-' + row.cage; + if (row.location.length > 24) { + console.log("Location is longer than allowed length: ", row.location); + } //remove whitespace, normalize punctuation and pad digits if (row.joinToCage){