Skip to content

Commit

Permalink
Merge branch 'develop' into feature/getFromLocalStorageOrApi
Browse files Browse the repository at this point in the history
  • Loading branch information
mikepsinn authored Jun 4, 2021
2 parents 9e248ff + e759350 commit f9c0bde
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 103 deletions.
99 changes: 50 additions & 49 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"coveralls": "3.0.14",
"cross-env": "6.0.3",
"cypress": "6.9.1",
"cypress-cucumber-preprocessor": "4.1.1",
"cypress-cucumber-preprocessor": "4.1.2",
"cypress-failed-log": "2.9.0",
"cypress-intellij-reporter": "0.0.6",
"cypress-junit-reporter": "1.3.1",
Expand Down
52 changes: 0 additions & 52 deletions src/js/controllers/variableSearchCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,58 +344,6 @@ angular.module('starter').controller('VariableSearchCtrl',
function getPluralVariableCategoryName(){
return $filter('wordAliases')(pluralize(getVariableCategoryName(), 1));
}
var checkNameExists = function(item){
if(!item.name){
var message = "variable doesn't have a name! variable: " + JSON.stringify(item);
qmLog.error(message);
qmLog.error(message);
return false;
}
return true;
};
$scope.matchEveryWord = function(){
return function(item){
if($scope.state.variableSearchParameters.barcode){
return true;
} // Name's not going to match the number
if(!checkNameExists(item)){
return false;
}
if(item.variableCategoryName){
if($scope.state.variableSearchParameters.manualTracking && $scope.state.variableSearchParameters.searchPhrase.length < 5){
if(item.variableCategoryName.indexOf('Location') !== -1 ||
item.variableCategoryName.indexOf('Software') !== -1 ||
item.variableCategoryName.indexOf('Environment') !== -1){
return false;
}
}
}
if($scope.state.excludeDuplicateBloodPressure){
if(item.name.toLowerCase().indexOf('diastolic') !== -1 || item.name.toLowerCase().indexOf('systolic') !== -1){
return false;
}
}
if($scope.state.excludeSingularBloodPressure && item.name.toLowerCase() === 'blood pressure'){
return false;
}
var variableObjectAsString = JSON.stringify(item).toLowerCase();
var lowercaseVariableSearchQuery = $scope.state.variableSearchParameters.searchPhrase.toLowerCase();
var filterBy = lowercaseVariableSearchQuery.split(/\s+/);
if(lowercaseVariableSearchQuery){
if(!filterBy.length){
return true;
}
}else{
return true;
}
return filterBy.every(function(word){
var exists = variableObjectAsString.indexOf(word);
if(exists !== -1){
return true;
}
});
};
};
// https://open.fda.gov/api/reference/ API Key https://open.fda.gov/api/reference/
$scope.scanBarcode = function(){
var params = getVariableSearchParameters();
Expand Down
2 changes: 1 addition & 1 deletion src/templates/variable-search.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<ion-list ng-show="state.variableSearchResults.length" class>
<!--<ion-item ng-click="selectVariable(item)" ng-repeat="item in state.variableSearchResults | orderBy:'-latestMeasurementTime' | limitTo:5 | unique:'id' ">-->
<ion-item id="variable-search-result" ng-click="selectVariable(item)"
ng-repeat="item in state.variableSearchResults | filter:matchEveryWord() | unique:'name' track by $index">
ng-repeat="item in state.variableSearchResults | unique:'name' track by $index">
<div>
<!-- For some reason, putting displayName on new line in HTML code also produces new line in rendered HTML even though there's no <br> -->
<p style="font-size:18px; white-space: pre;"><i ng-if="item.ionIcon" class="icon {{item.ionIcon}}"></i>&nbsp {{item.displayName}}</p>
Expand Down

0 comments on commit f9c0bde

Please sign in to comment.