Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ehr/resources/queries/ehr_lookups/cage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand Down
21 changes: 12 additions & 9 deletions ehr/resources/scripts/ehr/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will log to the console (an improvement over the current behavior) and then fail the job with the same unhelpful error message.

I've asked Matthew to share the full log file. I checked the recording but he didn't scroll down quite far enough to show the root exception during the screensharing yesterday.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will give us the value of the date which we were eyeballing in granite and couldn't find.

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);
}
}
}

Expand Down