Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

validateVariables #4580

Open
wants to merge 47 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
8dce915
validateVariables
mikepsinn Jul 3, 2021
f2d36d3
Merge branch 'develop' into feature/validateVariables
mikepsinn Jul 3, 2021
9296aa8
Merge branch 'develop' into feature/validateVariables
mikepsinn Jul 4, 2021
c6b374f
Merge branch 'develop' into feature/validateVariables
mikepsinn Jul 4, 2021
ff1c9c0
Merge branch 'develop' into feature/validateVariables
mikepsinn Jul 4, 2021
3efd7d4
Merge branch 'develop' into feature/validateVariables
mikepsinn Jul 4, 2021
ae3c13a
Merge branch 'develop' into feature/validateVariables
mikepsinn Jul 4, 2021
d7f015a
Merge branch 'develop' into feature/validateVariables
mikepsinn Jul 4, 2021
fe05f65
Merge branch 'develop' into feature/validateVariables
mikepsinn Jul 5, 2021
0c04503
if(v && v.variableId === 1398 && !v.outcome)
mikepsinn Jul 5, 2021
264fdea
Merge branch 'develop' into feature/validateVariables
mikepsinn Jul 5, 2021
8984ac7
Merge branch 'develop' into feature/validateVariables
mikepsinn Jul 7, 2021
9b54a64
Merge branch 'develop' into feature/validateVariables
mikepsinn Jul 7, 2021
bc1dc9d
Merge branch 'develop' into feature/validateVariables
mikepsinn Jul 7, 2021
1ef603b
Merge develop into feature/validateVariables
github-actions[bot] Jul 17, 2021
c6d60cc
Merge develop into feature/validateVariables
github-actions[bot] Jul 19, 2021
2efef98
Merge develop into feature/validateVariables
github-actions[bot] Aug 26, 2021
93b39ab
Merge develop into feature/validateVariables
github-actions[bot] Aug 26, 2021
b7c4b59
Merge develop into feature/validateVariables
github-actions[bot] Aug 26, 2021
d6a9ec7
Merge develop into feature/validateVariables
github-actions[bot] Aug 26, 2021
a8d6585
Merge develop into feature/validateVariables
github-actions[bot] Aug 27, 2021
79b02e8
Merge develop into feature/validateVariables
github-actions[bot] Aug 27, 2021
8bacd16
Merge develop into feature/validateVariables
github-actions[bot] Aug 27, 2021
47a772b
Merge develop into feature/validateVariables
github-actions[bot] Aug 27, 2021
258c090
Merge develop into feature/validateVariables
github-actions[bot] Aug 27, 2021
3bf2779
Merge develop into feature/validateVariables
github-actions[bot] Aug 27, 2021
bb0a429
Merge develop into feature/validateVariables
github-actions[bot] Aug 28, 2021
50c6f47
Merge develop into feature/validateVariables
github-actions[bot] Aug 28, 2021
b1fe547
Merge develop into feature/validateVariables
github-actions[bot] Aug 28, 2021
aa1607c
Merge develop into feature/validateVariables
github-actions[bot] Aug 28, 2021
f4db41e
Merge develop into feature/validateVariables
github-actions[bot] Aug 29, 2021
73b17a9
Merge develop into feature/validateVariables
github-actions[bot] Sep 1, 2021
31345a6
Merge develop into feature/validateVariables
github-actions[bot] Sep 7, 2021
3696c4f
Merge develop into feature/validateVariables
github-actions[bot] Sep 7, 2021
ee81811
Merge develop into feature/validateVariables
github-actions[bot] Oct 21, 2021
8297b0c
Merge develop into feature/validateVariables
github-actions[bot] Feb 1, 2022
b20f44e
Merge develop into feature/validateVariables
github-actions[bot] Feb 1, 2022
dd9812c
Merge develop into feature/validateVariables
github-actions[bot] Mar 17, 2022
0c1dc60
Merge develop into feature/validateVariables
github-actions[bot] Apr 7, 2022
9983f16
Merge develop into feature/validateVariables
github-actions[bot] Apr 8, 2022
db10c9c
Merge develop into feature/validateVariables
github-actions[bot] Apr 20, 2022
93825ec
Merge develop into feature/validateVariables
github-actions[bot] Apr 20, 2022
b7aea33
Merge develop into feature/validateVariables
github-actions[bot] Apr 21, 2022
5c8ebd4
Merge develop into feature/validateVariables
github-actions[bot] Apr 21, 2022
1f1859a
Merge develop into feature/validateVariables
github-actions[bot] Apr 21, 2022
67741b1
Merge develop into feature/validateVariables
github-actions[bot] Apr 21, 2022
2a7cd7e
Merge develop into feature/validateVariables
github-actions[bot] Apr 21, 2022
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
12 changes: 7 additions & 5 deletions src/js/qmHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -11989,11 +11989,11 @@ var qm = {
qmLog.error("no variables provided to putManualTrackingFirst");
return;
}
var manualTracking = variables.filter(function(variableToCheck){
return variableToCheck.manualTracking === true;
var manualTracking = variables.filter(function(v){
return v.manualTracking === true;
});
var nonManual = variables.filter(function(variableToCheck){
return variableToCheck.manualTracking !== true;
var nonManual = variables.filter(function(v){
return v.manualTracking !== true;
});
return manualTracking.concat(nonManual);
},
Expand Down Expand Up @@ -12036,6 +12036,7 @@ var qm = {
var q = params.name || params.searchPhrase || null;
if(q){variables = qm.variablesHelper.putExactMatchFirst(variables, q);}
}
qm.variablesHelper.validateVariables(variables)
return variables;
},
getUserAndCommonVariablesFromLocalStorage: function(params){
Expand Down Expand Up @@ -12126,6 +12127,7 @@ var qm = {
}
}
if(userVariables.length){
qm.variablesHelper.validateVariables(userVariables)
qm.localForage.saveWithUniqueId(qm.items.userVariables, userVariables);
}
if(commonVariables.length){
Expand Down Expand Up @@ -12154,7 +12156,7 @@ var qm = {
validateVariables: function(variables){
if(!Array.isArray(variables)){variables = [variables];}
variables.map(function (v){
if(v && v.variableId === 1398){
if(v && v.variableId === 1398 && !v.outcome){
qmLog.errorAndExceptionTestingOrDevelopment("why isn't mood an outcome: "+v.outcome, v)
}
});
Expand Down
24 changes: 14 additions & 10 deletions src/js/services/qmService.js
Original file line number Diff line number Diff line change
Expand Up @@ -408,15 +408,15 @@ angular.module('starter').factory('qmService', ["$http", "$q", "$rootScope", "$i
qmService.showMaterialAlert("Barcode scan failed!", "Couldn't identify your barcode, but I'll look into it. Please try a manual search in the meantime. ");
}, scannerConfig);
},
addUpcToVariableObject: function(variableObject){
if(!variableObject){
addUpcToVariableObject: function(v){
if(!v){
return;
}
if(qmService.barcodeScanner.upcToAttach){
variableObject.upc = qmService.barcodeScanner.upcToAttach;
v.upc = qmService.barcodeScanner.upcToAttach;
qmService.barcodeScanner.upcToAttach = null;
}
return variableObject;
return v;
},
quaggaScan: function(){
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia ||
Expand Down Expand Up @@ -2265,6 +2265,7 @@ angular.module('starter').factory('qmService', ["$http", "$q", "$rootScope", "$i
self.finish = function(){
self.items = null;
$scope.variable = qmService.barcodeScanner.addUpcToVariableObject($scope.variable);
qm.variablesHelper.validateVariables($scope.variable);
$mdDialog.hide($scope.variable);
};
self.scanBarcode = function(deferred){
Expand Down Expand Up @@ -2438,6 +2439,7 @@ angular.module('starter').factory('qmService', ["$http", "$q", "$rootScope", "$i
item.variable.barcode = item.variable.upc = self.barcode;
item.variable.barcodeFormat = self.barcodeFormat;
}
qm.variablesHelper.validateVariables(item.variable)
$scope.variable = item.variable;
item.variable.lastSelectedAt = qm.timeHelper.getUnixTimestampInSeconds();
qm.variablesHelper.setLastSelectedAtAndSave(item.variable);
Expand Down Expand Up @@ -2972,11 +2974,9 @@ angular.module('starter').factory('qmService', ["$http", "$q", "$rootScope", "$i
var hasMeasurementsOrIsAdmin = hasMeasurements || (u && u.administrator);
if(hasMeasurementsOrIsAdmin){buttons.push(allButtons.variableSettings);}
if(v){buttons.push(allButtons.compare);}
if(v && v.outcome){
buttons.push(allButtons.predictors);
}else{
buttons.push(allButtons.outcomes);
}
qm.variablesHelper.validateVariables(v);
if(v && v.outcome){buttons.push(allButtons.predictors);}
if(v && v.predictor){buttons.push(allButtons.outcomes);}
var actions = v.actionArray;
if(actions){
for(var i = 0; i < actions.length; i++){
Expand All @@ -2986,7 +2986,11 @@ angular.module('starter').factory('qmService', ["$http", "$q", "$rootScope", "$i
var ionIcon = item.ionIcon || ionIcons.recordMeasurement;
qmLog.debug("Action array item: ", item);
if(item.action === "track"){
buttons.push({action: item, id: id, text: '<span id="' + id + '"><i class="icon ' + ionIcon + '"></i>' + text + '</span>'});
buttons.push({
action: item,
id: id,
text: '<span id="' + id + '"><i class="icon ' + ionIcon + '"></i>' + text + '</span>'
});
}
if(buttons.length > 8){break;}
}
Expand Down