Replace method to use get with range in paramters.

This commit is contained in:
Alexis Lahouze
2015-06-13 01:27:32 +02:00
parent 7b49cec047
commit b983835023
3 changed files with 30 additions and 32 deletions

View File

@ -86,8 +86,15 @@ var EntryController = function($scope, $http, $rootScope, $filter) {
$scope.getAccountStatus = function(account, month) {
if(account != null && month != null) {
$http.get("/api/accounts/" + account.id + "/" + month.year + "/" + month.month).
success($scope.getAccountStatus_success);
// Note: Month is 0 indexed.
var begin = moment({year: month.year, month: month.month - 1, day: 1});
var end = begin.clone().endOf('month');
$http.get("/api/accounts/" + account.id,
{params: {
begin: begin.format('YYYY-MM-DD'),
end: end.format('YYYY-MM-DD')
}}).success($scope.getAccountStatus_success);
}
};

View File

@ -83,6 +83,8 @@
</div>
{% block footer %}{% endblock %}
<script type="text/javascript" src="https://raw.githubusercontent.com/moment/moment/develop/min/moment.min.js"></script>
<!-- JQuery Javascript library -->
<script type="text/javascript" src="http://code.jquery.com/jquery-2.0.3.min.js"></script>