bugfix for description suggestions
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>de.tilman</groupId>
|
||||
<artifactId>next-transactions</artifactId>
|
||||
<version>1.5.2</version>
|
||||
<version>1.5.3</version>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
||||
@@ -207,10 +207,18 @@ transactionControllers.controller('TransactionListCtrl', [ '$scope', '$routePara
|
||||
$scope.updateSuggestions = function(val) {
|
||||
var suggestions = $resource('/api/transactions/search/descriptions', { accountId: $scope.account.id, prefix: val.toLowerCase() }).get();
|
||||
return suggestions.$promise.then(function(data) {
|
||||
var newSuggestions = new Array(suggestions._embedded.transactions.length);
|
||||
for (i = 0; i < suggestions._embedded.transactions.length; i++) {
|
||||
newSuggestions[i] = suggestions._embedded.transactions[i].description;
|
||||
var newSuggestions = new Array();
|
||||
var numSuggestions = 0;
|
||||
var idx = 0;
|
||||
|
||||
while (numSuggestions < 6 && idx < suggestions._embedded.transactions.length) {
|
||||
if (newSuggestions.indexOf(suggestions._embedded.transactions[idx].description) < 0) {
|
||||
newSuggestions[numSuggestions] = suggestions._embedded.transactions[idx].description;
|
||||
numSuggestions++;
|
||||
}
|
||||
idx++;
|
||||
}
|
||||
|
||||
return newSuggestions;
|
||||
});
|
||||
};
|
||||
|
||||
@@ -62,7 +62,8 @@
|
||||
id="descriptionInput"
|
||||
ng-model="transaction.description"
|
||||
uib-typeahead="suggestion for suggestion in updateSuggestions($viewValue)"
|
||||
class="form-control">
|
||||
class="form-control"
|
||||
autocomplete="off">
|
||||
</div>
|
||||
|
||||
<div class="row form-group" ng-show="accountUsers.length > 1">
|
||||
|
||||
Reference in New Issue
Block a user