[Search] Not case sensitive

Search is no longer case sensitive.
This commit is contained in:
shale 2015-07-10 14:20:04 -07:00
parent b5756d2b99
commit 6d1cb85a07

View File

@ -88,13 +88,20 @@ define(function () {
console.log('search called, with term ', term);
var searchResults = [],
itemsLength,
itemName,
i;
// Make not case sensitive
if (term) {
term = term.toLocaleLowerCase();
}
// refresh items list
return listify().then( function () {
itemsLength = $scope.items.length; // Slight time optimization
for (i = 0; i < itemsLength; i += 1) {
console.log('items[', i, '].getModel', $scope.items[i].getModel());
if ($scope.items[i].getModel().name.includes(term)) {
itemName = $scope.items[i].getModel().name;
console.log('items[', i, '] name', itemName);
if (itemName.toLocaleLowerCase().includes(term)) {
searchResults.push($scope.items[i]);
}
}