From f649246082794e4adcc529fd853a9c53c4a535da Mon Sep 17 00:00:00 2001 From: "Mike P. Sinn" Date: Fri, 18 Sep 2020 15:56:32 -0500 Subject: [PATCH 1/7] newMeasurement --- src/js/controllers/measurementAddCtrl.js | 96 ++++++++++-------------- src/js/qmHelpers.js | 69 +++++++++++++++++ src/js/services/qmService.js | 19 ----- 3 files changed, 108 insertions(+), 76 deletions(-) diff --git a/src/js/controllers/measurementAddCtrl.js b/src/js/controllers/measurementAddCtrl.js index f42adf4cb8..8e2b02d3b5 100644 --- a/src/js/controllers/measurementAddCtrl.js +++ b/src/js/controllers/measurementAddCtrl.js @@ -32,6 +32,7 @@ angular.module('starter').controller('MeasurementAddCtrl', ["$scope", "$q", "$ti $scope.state.title = 'Record a Measurement'; $scope.state.selectedDate = moment(); $scope.state.units = qm.unitHelper.getNonAdvancedUnits(); + var reminderFromUrl = qm.urlHelper.getParam('trackingReminderObject', window.location.href, true); if($stateParams.trackingReminder){ setupTrackingByReminderNotification($stateParams.trackingReminder); }else if($stateParams.measurement){ @@ -40,8 +41,9 @@ angular.module('starter').controller('MeasurementAddCtrl', ["$scope", "$q", "$ti setupTrackingByMeasurement(JSON.parse(qm.urlHelper.getParam('measurementObject', window.location.href, true))); }else if($stateParams.variableObject){ setupFromVariable($stateParams.variableObject); - }else if(qm.urlHelper.getParam('trackingReminderObject', window.location.href, true)){ - setupTrackingByReminderNotification(JSON.parse(qm.urlHelper.getParam('trackingReminderObject', window.location.href, true))); + }else if(reminderFromUrl){ + var tr = JSON.parse(reminderFromUrl); + setupTrackingByReminderNotification(tr); }else if($stateParams.reminderNotification){ setupTrackingByReminderNotification($stateParams.reminderNotification); }else if(qm.urlHelper.getParam('measurementId', location.href, true)){ @@ -208,12 +210,12 @@ angular.module('starter').controller('MeasurementAddCtrl', ["$scope", "$q", "$ti var startTimeEpoch = qm.urlHelper.getParam('startTimeEpoch', location.href, true); var value = qm.urlHelper.getParam('value', location.href, true); if(unitAbbreviatedName || variableName || startTimeEpoch || value){ - var measurementObject = {}; - measurementObject.unitAbbreviatedName = unitAbbreviatedName; - measurementObject.variableName = variableName; - measurementObject.startTimeEpoch = startTimeEpoch; - measurementObject.value = value; - setupTrackingByMeasurement(measurementObject); + var m = {}; + m.unitAbbreviatedName = unitAbbreviatedName; + m.variableName = variableName; + m.startTimeEpoch = startTimeEpoch; + m.value = value; + setupTrackingByMeasurement(m); } }; function isYesNo() { @@ -247,20 +249,14 @@ angular.module('starter').controller('MeasurementAddCtrl', ["$scope", "$q", "$ti var category = qmService.getVariableCategoryInfo(v.variableCategoryName); setupUnit(category.defaultUnitAbbreviatedName, v.valence); } - if(v.upc){$scope.state.measurement.upc = v.upc;} - if(v.inputType){$scope.state.measurement.inputType = v.inputType;} - $scope.state.measurement.variableName = v.name; - $scope.state.measurement.maximumAllowedValue = v.maximumAllowedValue; - $scope.state.measurement.minimumAllowedValue = v.minimumAllowedValue; - if(!$scope.state.measurement.variableName){$scope.state.measurement.variableName = v.variableName;} - if($scope.state.measurement.variableName.toLowerCase().indexOf('blood pressure') > -1){$rootScope.bloodPressure.show = true;} - if(v.variableCategoryName){ - $scope.state.measurement.variableCategoryName = v.variableCategoryName; - setupVariableCategory(v.variableCategoryName); + var m = qm.measurements.newMeasurement(v); + if(m.variableName.toLowerCase().indexOf('blood pressure') > -1){$rootScope.bloodPressure.show = true;} + if(m.variableCategoryName){ + setupVariableCategory(m.variableCategoryName); }else{ $scope.state.showVariableCategorySelector = true; } - $scope.state.measurement.combinationOperation = (v.combinationOperation) ? v.combinationOperation : 'MEAN'; + $scope.state.measurement = m; $scope.state.measurementIsSetup = true; // Fill in default value as last value if not /5 /** @namespace variableObject.lastValue */ @@ -282,17 +278,16 @@ angular.module('starter').controller('MeasurementAddCtrl', ["$scope", "$q", "$ti var deferred = $q.defer(); qmService.showBlackRingLoader(); qmService.getMeasurementById(qm.urlHelper.getParam('measurementId', location.href, true)) - .then(function(measurementObject){ + .then(function(m){ qmService.hideLoader(); $scope.state.measurementIsSetup = true; - setupTrackingByMeasurement(measurementObject); + setupTrackingByMeasurement(m); deferred.resolve(); }, function(error){ - qmService.hideLoader(); - qmLogService.error($state.current.name + ": " + "Error response: ", error); - deferred.reject(error); - } - ); + qmService.hideLoader(); + qmLogService.error($state.current.name + ": " + "Error response: ", error); + deferred.reject(error); + }); return deferred.promise; }; $scope.goToAddReminder = function(){ @@ -310,7 +305,7 @@ angular.module('starter').controller('MeasurementAddCtrl', ["$scope", "$q", "$ti qmLogService.error('No unitAbbreviatedName provided to setupValueFieldType'); return false; } - $scope.state.measurement.inputType = qmService.getInputType(unitAbbreviatedName, valence, variableName); + $scope.state.measurement.inputType = qm.unitHelper.getInputType(unitAbbreviatedName, valence, variableName); } function setVariableObjectFromMeasurement(){ $scope.state.variableObject = { @@ -330,42 +325,29 @@ angular.module('starter').controller('MeasurementAddCtrl', ["$scope", "$q", "$ti } } } - var setupTrackingByMeasurement = function(measurementObject){ - if(isNaN(measurementObject.startTimeEpoch)){ - measurementObject.startTimeEpoch = moment(measurementObject.startTimeEpoch).unix(); - } - if(!measurementObject.id){ - measurementObject.prevStartTimeEpoch = measurementObject.startTimeEpoch; - } + var setupTrackingByMeasurement = function(m){ + if(isNaN(m.startTimeEpoch)){m.startTimeEpoch = moment(m.startTimeEpoch).unix();} + if(!m.id){m.prevStartTimeEpoch = m.startTimeEpoch;} $scope.state.title = "Edit Measurement"; - $scope.state.selectedDate = moment(measurementObject.startTimeEpoch * 1000); - $scope.state.measurement = measurementObject; - qmLog.info("Setting $scope.state.measurement to ", $scope.state.measurement); + $scope.state.selectedDate = moment(m.startTimeEpoch * 1000); + $scope.state.measurement = m; + qmLog.info("Setting $scope.state.measurement to ", m); $scope.state.measurementIsSetup = true; - setupUnit($scope.state.measurement.unitAbbreviatedName, $scope.state.measurement.valence); - if($scope.state.measurement.variable){ - $scope.state.measurement.variableName = $scope.state.measurement.variable; - } + setupUnit(m.unitAbbreviatedName, m.valence); setStateVariable(); }; var setupTrackingByReminderNotification = function(n){ - if(n){ - $scope.state.title = "Record Measurement"; - if(!$scope.state.measurement.unitAbbreviatedName){ - setupUnit(n.unitAbbreviatedName); - } - $scope.state.hideRemindMeButton = true; - $scope.state.measurement.value = n.defaultValue; - $scope.state.measurement.variableName = n.variableName; - $scope.state.measurement.variableCategoryName = getVariableCategoryName(n); - $scope.state.measurement.combinationOperation = n.combinationOperation; - if(n.trackingReminderNotificationTimeEpoch !== "undefined" && n.trackingReminderNotificationTimeEpoch){ - $scope.state.selectedDate = moment(n.trackingReminderNotificationTimeEpoch * 1000); - } - $scope.state.measurementIsSetup = true; - setupUnit(n.unitAbbreviatedName, n.valence); - setStateVariable(); + $scope.state.title = "Record Measurement"; + if(!$scope.state.measurement.unitAbbreviatedName){ + setupUnit(n.unitAbbreviatedName); } + $scope.state.hideRemindMeButton = true; + var m = qm.measurements.fromNotification(n); + $scope.state.measurement = m; + if(m.startTime){$scope.state.selectedDate = moment(m.startTime * 1000);} + $scope.state.measurementIsSetup = true; + setupUnit(n.unitAbbreviatedName, n.valence); + setStateVariable(); // Create variableObject if(!$scope.state.variableObject){ if($stateParams.variableObject !== null && typeof $stateParams.variableObject !== "undefined"){ diff --git a/src/js/qmHelpers.js b/src/js/qmHelpers.js index 8765d3f2be..7f823ce0cb 100644 --- a/src/js/qmHelpers.js +++ b/src/js/qmHelpers.js @@ -4219,6 +4219,48 @@ var qm = { } }, measurements: { + newMeasurement: function(src){ + var value; + if(typeof src.modifiedValue !== "undefined" && src.modifiedValue !== null){ + value = src.modifiedValue; + } else if (typeof src.value !== "undefined" && src.value !== null){ + value = src.value; + } else if (typeof src.defaultValue !== "undefined" && src.defaultValue !== null){ + value = src.defaultValue; + } else { + throw "no value provided" + } + var timeAt = src.trackingReminderNotificationTimeEpoch || + src.startAt || + src.startTime || + src.notifyAt || + src.startTimeString || + src.startTimeEpoch; + var unit = qm.unitHelper.find(src); + var m = { + combinationOperation: src.combinationOperation || 'MEAN', + icon: src.icon, + inputType: src.inputType || unit.inputType, + maximumAllowedValue: src.maximumAllowedValue || unit.maximum, + minimumAllowedValue: src.minimumAllowedValue || unit.minimum, + pngPath: src.pngPath || src.image, + startAt: qm.timeHelper.toDate(timeAt), + startTime: qm.timeHelper.toUnixTime(timeAt), + unitAbbreviatedName: unit.abbreviatedName, + unitId: unit.id, + unitName: unit.name, + upc: src.upc, + valence: src.valence, + value: value, + variableCategoryId: src.variableCategoryName, + variableCategoryName: src.variableCategoryName, + variableName: src.variableName || src.name, + } + return m; + }, + fromNotification: function (n){ + return qm.measurements.newMeasurement(n); + }, getUniqueKey: function(m){ if(m.id){return m.id.toString();} var startTime = m.startTime || m.startTimeEpoch; @@ -8486,6 +8528,13 @@ var qm = { } }, timeHelper: { + toDate: function(timeAt){ + var unixTime = qm.timeHelper.universalConversionToUnixTimeSeconds(timeAt); + return qm.timeHelper.convertUnixTimeStampToISOString(unixTime); + }, + toUnixTime: function(timeAt){ + return qm.timeHelper.universalConversionToUnixTimeSeconds(timeAt); + }, getUnixTimestampInMilliseconds: function(dateTimeString){ if(!dateTimeString){ return new Date().getTime(); @@ -8684,6 +8733,26 @@ var qm = { } }, unitHelper: { + getInputType: function(unitAbbreviatedName, valence, variableName) { + return qm.unitHelper.getInputType(unitAbbreviatedName, valence, variableName); + var inputType = 'value'; + if (variableName === 'Blood Pressure') { + inputType = 'bloodPressure'; + } + if (unitAbbreviatedName === '/5') { + inputType = 'oneToFiveNumbers'; + if (valence === 'positive') { + inputType = 'happiestFaceIsFive'; + } + if (valence === 'negative') { + inputType = 'saddestFaceIsFive'; + } + } + if (unitAbbreviatedName === 'yes/no') { + inputType = 'yesOrNo'; + } + return inputType; + }, getNonAdvancedUnits: function(){ var nonAdvancedUnitObjects = []; var allUnits = qm.staticData.units; diff --git a/src/js/services/qmService.js b/src/js/services/qmService.js index 02389ab191..f1519376df 100644 --- a/src/js/services/qmService.js +++ b/src/js/services/qmService.js @@ -7439,25 +7439,6 @@ angular.module('starter').factory('qmService', ["$http", "$q", "$rootScope", "$i } return true; }; - qmService.getInputType = function(unitAbbreviatedName, valence, variableName){ - var inputType = 'value'; - if(variableName === 'Blood Pressure'){ - inputType = 'bloodPressure'; - } - if(unitAbbreviatedName === '/5'){ - inputType = 'oneToFiveNumbers'; - if(valence === 'positive'){ - inputType = 'happiestFaceIsFive'; - } - if(valence === 'negative'){ - inputType = 'saddestFaceIsFive'; - } - } - if(unitAbbreviatedName === 'yes/no'){ - inputType = 'yesOrNo'; - } - return inputType; - }; var deleteAllMeasurementsForVariable = function(variableName){ qmService.showBlackRingLoader(); // Delete all measurements for a variable From 13bc969e81bb25af797d240577a83e4e1e9a1e64 Mon Sep 17 00:00:00 2001 From: "Mike P. Sinn" Date: Fri, 18 Sep 2020 16:01:19 -0500 Subject: [PATCH 2/7] $scope.$on('$ionicView.beforeEnter') --- src/js/controllers/measurementAddCtrl.js | 51 ++++++++++++------------ 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/src/js/controllers/measurementAddCtrl.js b/src/js/controllers/measurementAddCtrl.js index 8e2b02d3b5..cc828e5225 100644 --- a/src/js/controllers/measurementAddCtrl.js +++ b/src/js/controllers/measurementAddCtrl.js @@ -33,34 +33,33 @@ angular.module('starter').controller('MeasurementAddCtrl', ["$scope", "$q", "$ti $scope.state.selectedDate = moment(); $scope.state.units = qm.unitHelper.getNonAdvancedUnits(); var reminderFromUrl = qm.urlHelper.getParam('trackingReminderObject', window.location.href, true); - if($stateParams.trackingReminder){ - setupTrackingByReminderNotification($stateParams.trackingReminder); - }else if($stateParams.measurement){ - setupTrackingByMeasurement($stateParams.measurement); - }else if(qm.urlHelper.getParam('measurementObject', window.location.href, true)){ - setupTrackingByMeasurement(JSON.parse(qm.urlHelper.getParam('measurementObject', window.location.href, true))); - }else if($stateParams.variableObject){ - setupFromVariable($stateParams.variableObject); + var measurementFromUrl = qm.urlHelper.getParam('measurementObject', window.location.href, true); + var tr = $stateParams.trackingReminder; + var m = $stateParams.measurement; + var v = $stateParams.variableObject; + var n = $stateParams.reminderNotification; + var id = qm.urlHelper.getParam('measurementId', location.href, true); + if(tr){ + setupTrackingByReminder(tr); + }else if(m){ + setupTrackingByMeasurement(m); + }else if(measurementFromUrl){ + setupTrackingByMeasurement(JSON.parse(measurementFromUrl)); + }else if(v){ + setupFromVariable(v); }else if(reminderFromUrl){ - var tr = JSON.parse(reminderFromUrl); - setupTrackingByReminderNotification(tr); - }else if($stateParams.reminderNotification){ - setupTrackingByReminderNotification($stateParams.reminderNotification); - }else if(qm.urlHelper.getParam('measurementId', location.href, true)){ - setMeasurementVariablesByMeasurementId().then(function(){ - if(!$scope.state.measurementIsSetup){ - $scope.goBack(); - } + setupTrackingByReminder(JSON.parse(reminderFromUrl)); + }else if(n){ + setupTrackingByReminder(n); + }else if(id){ + setMeasurementVariablesByMeasurementId(id).then(function(){ + if(!$scope.state.measurementIsSetup){$scope.goBack();} }); }else if($stateParams.variableName){ setupFromVariableName($stateParams.variableName); } - if(!$scope.state.measurementIsSetup){ - setupFromUrlParameters(); - } - if(!$scope.state.measurementIsSetup){ - setupFromVariable(qm.getPrimaryOutcomeVariable()); - } + if(!$scope.state.measurementIsSetup){setupFromUrlParameters();} + if(!$scope.state.measurementIsSetup){setupFromVariable(qm.getPrimaryOutcomeVariable());} }); $scope.$on('$ionicView.enter', function(e){ qmLogService.debug('$ionicView.enter ' + $state.current.name); @@ -274,10 +273,10 @@ angular.module('starter').controller('MeasurementAddCtrl', ["$scope", "$q", "$ti qmLogService.error(error); }); }; - var setMeasurementVariablesByMeasurementId = function(){ + var setMeasurementVariablesByMeasurementId = function(id){ var deferred = $q.defer(); qmService.showBlackRingLoader(); - qmService.getMeasurementById(qm.urlHelper.getParam('measurementId', location.href, true)) + qmService.getMeasurementById(id) .then(function(m){ qmService.hideLoader(); $scope.state.measurementIsSetup = true; @@ -336,7 +335,7 @@ angular.module('starter').controller('MeasurementAddCtrl', ["$scope", "$q", "$ti setupUnit(m.unitAbbreviatedName, m.valence); setStateVariable(); }; - var setupTrackingByReminderNotification = function(n){ + var setupTrackingByReminder = function(n){ $scope.state.title = "Record Measurement"; if(!$scope.state.measurement.unitAbbreviatedName){ setupUnit(n.unitAbbreviatedName); From 2408ce0c9ec0e5df1b096c75f941b0bd77272ddd Mon Sep 17 00:00:00 2001 From: "Mike P. Sinn" Date: Fri, 18 Sep 2020 16:12:45 -0500 Subject: [PATCH 3/7] getInputType --- src/js/qmHelpers.js | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/js/qmHelpers.js b/src/js/qmHelpers.js index 7f823ce0cb..78afebd62f 100644 --- a/src/js/qmHelpers.js +++ b/src/js/qmHelpers.js @@ -8734,23 +8734,14 @@ var qm = { }, unitHelper: { getInputType: function(unitAbbreviatedName, valence, variableName) { - return qm.unitHelper.getInputType(unitAbbreviatedName, valence, variableName); var inputType = 'value'; - if (variableName === 'Blood Pressure') { - inputType = 'bloodPressure'; - } + if (variableName === 'Blood Pressure') {inputType = 'bloodPressure';} if (unitAbbreviatedName === '/5') { inputType = 'oneToFiveNumbers'; - if (valence === 'positive') { - inputType = 'happiestFaceIsFive'; - } - if (valence === 'negative') { - inputType = 'saddestFaceIsFive'; - } - } - if (unitAbbreviatedName === 'yes/no') { - inputType = 'yesOrNo'; + if (valence === 'positive') {inputType = 'happiestFaceIsFive';} + if (valence === 'negative') {inputType = 'saddestFaceIsFive';} } + if (unitAbbreviatedName === 'yes/no') {inputType = 'yesOrNo';} return inputType; }, getNonAdvancedUnits: function(){ From f6ab23e1ab5d77cab8d12ab700b371db5d21226f Mon Sep 17 00:00:00 2001 From: "Mike P. Sinn" Date: Sun, 20 Sep 2020 17:10:37 -0500 Subject: [PATCH 4/7] newMeasurement --- src/js/qmHelpers.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/js/qmHelpers.js b/src/js/qmHelpers.js index 4ff0df72ef..4a1115bcc9 100644 --- a/src/js/qmHelpers.js +++ b/src/js/qmHelpers.js @@ -4228,7 +4228,7 @@ var qm = { } else if (typeof src.defaultValue !== "undefined" && src.defaultValue !== null){ value = src.defaultValue; } else { - throw "no value provided" + value = null; } var timeAt = src.trackingReminderNotificationTimeEpoch || src.startAt || @@ -4240,15 +4240,15 @@ var qm = { var m = { combinationOperation: src.combinationOperation || 'MEAN', icon: src.icon, - inputType: src.inputType || unit.inputType, - maximumAllowedValue: src.maximumAllowedValue || unit.maximum, - minimumAllowedValue: src.minimumAllowedValue || unit.minimum, + inputType: src.inputType || (unit) ? unit.inputType : null, + maximumAllowedValue: src.maximumAllowedValue || (unit) ? unit.maximum : null, + minimumAllowedValue: src.minimumAllowedValue || (unit) ? unit.minimum : null, pngPath: src.pngPath || src.image, startAt: qm.timeHelper.toDate(timeAt), startTime: qm.timeHelper.toUnixTime(timeAt), - unitAbbreviatedName: unit.abbreviatedName, - unitId: unit.id, - unitName: unit.name, + unitAbbreviatedName: (unit) ? unit.abbreviatedName : null, + unitId: (unit) ? unit.id : null, + unitName: (unit) ? unit.name : null, upc: src.upc, valence: src.valence, value: value, @@ -8880,9 +8880,9 @@ var qm = { } return arr; }, - find:function(v){ + find: function(v) { var nameOrId; - if(typeof v === "string" || data === parseInt(data, 10)){ + if(typeof v === "string" || v === parseInt(v, 10)){ nameOrId = v; } else { nameOrId = v.unitId || v.defaultUnitId || v.defaultUnitAbbreviatedName || v.unitAbbreviatedName || v.id; From e838bacd7e6afe2d1d572c8fb0d86e9d42222028 Mon Sep 17 00:00:00 2001 From: "Mike P. Sinn" Date: Sun, 20 Sep 2020 18:17:01 -0500 Subject: [PATCH 5/7] if(!m.inputType){m.inputType = qm.unitHelper.getInputType(unit.abbreviatedName, m.valence, m.variableName);} --- src/js/qmHelpers.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/js/qmHelpers.js b/src/js/qmHelpers.js index 4a1115bcc9..471b86a36c 100644 --- a/src/js/qmHelpers.js +++ b/src/js/qmHelpers.js @@ -4237,6 +4237,10 @@ var qm = { src.startTimeString || src.startTimeEpoch; var unit = qm.unitHelper.find(src); + var cat = qm.variableCategoryHelper.find(src); + if(!unit && cat){ + unit = qm.unitHelper.find(cat); + } var m = { combinationOperation: src.combinationOperation || 'MEAN', icon: src.icon, @@ -4256,6 +4260,7 @@ var qm = { variableCategoryName: src.variableCategoryName, variableName: src.variableName || src.name, } + if(!m.inputType){m.inputType = qm.unitHelper.getInputType(unit.abbreviatedName, m.valence, m.variableName);} return m; }, fromNotification: function (n){ @@ -9967,6 +9972,15 @@ var qm = { } return arr; }, + find: function(v) { + var nameOrId; + if(typeof v === "string" || v === parseInt(v, 10)){ + nameOrId = v; + } else { + nameOrId = v.variableCategoryId || v.variableCategoryName; + } + return qm.variableCategoryHelper.getByNameOrId(nameOrId); + } }, visualizer: { visualizerEnabled: true, From fabff4f04f8f62bd772015afd1cc60888dca4f78 Mon Sep 17 00:00:00 2001 From: "Mike P. Sinn" Date: Sun, 20 Sep 2020 18:47:24 -0500 Subject: [PATCH 6/7] if(!nameOrId){return null;} --- src/js/qmHelpers.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/js/qmHelpers.js b/src/js/qmHelpers.js index 471b86a36c..71f73ee08b 100644 --- a/src/js/qmHelpers.js +++ b/src/js/qmHelpers.js @@ -4247,7 +4247,7 @@ var qm = { inputType: src.inputType || (unit) ? unit.inputType : null, maximumAllowedValue: src.maximumAllowedValue || (unit) ? unit.maximum : null, minimumAllowedValue: src.minimumAllowedValue || (unit) ? unit.minimum : null, - pngPath: src.pngPath || src.image, + pngPath: src.pngPath || src.image || (cat) ? cat.pngUrl : null, startAt: qm.timeHelper.toDate(timeAt), startTime: qm.timeHelper.toUnixTime(timeAt), unitAbbreviatedName: (unit) ? unit.abbreviatedName : null, @@ -9979,6 +9979,7 @@ var qm = { } else { nameOrId = v.variableCategoryId || v.variableCategoryName; } + if(!nameOrId){return null;} return qm.variableCategoryHelper.getByNameOrId(nameOrId); } }, From a9af919351e06c55e62a2722dbfc2e95e12f2609 Mon Sep 17 00:00:00 2001 From: "Mike P. Sinn" Date: Sun, 20 Sep 2020 19:20:26 -0500 Subject: [PATCH 7/7] if(!m.inputType && unit) --- src/js/qmHelpers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/qmHelpers.js b/src/js/qmHelpers.js index 71f73ee08b..d2ce2a9a9f 100644 --- a/src/js/qmHelpers.js +++ b/src/js/qmHelpers.js @@ -4260,7 +4260,7 @@ var qm = { variableCategoryName: src.variableCategoryName, variableName: src.variableName || src.name, } - if(!m.inputType){m.inputType = qm.unitHelper.getInputType(unit.abbreviatedName, m.valence, m.variableName);} + if(!m.inputType && unit){m.inputType = qm.unitHelper.getInputType(unit.abbreviatedName, m.valence, m.variableName);} return m; }, fromNotification: function (n){