diff --git a/pom.xml b/pom.xml
index 5bbcefa..9a522f6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
4.0.0
de.tilman
next-transactions
- 1.5.2
+ 1.5.3
org.springframework.boot
diff --git a/src/main/resources/static/app/controllers.js b/src/main/resources/static/app/controllers.js
index 05b3182..dc115fc 100644
--- a/src/main/resources/static/app/controllers.js
+++ b/src/main/resources/static/app/controllers.js
@@ -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;
});
};
diff --git a/src/main/resources/static/app/transaction-list.html b/src/main/resources/static/app/transaction-list.html
index 0fc3a04..79641a6 100644
--- a/src/main/resources/static/app/transaction-list.html
+++ b/src/main/resources/static/app/transaction-list.html
@@ -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">