diff --git a/app/assets/javascripts/controllers/admin/statistics.coffee.erb b/app/assets/javascripts/controllers/admin/statistics.coffee.erb index 93057dbb0..046d0ee62 100644 --- a/app/assets/javascripts/controllers/admin/statistics.coffee.erb +++ b/app/assets/javascripts/controllers/admin/statistics.coffee.erb @@ -604,9 +604,6 @@ Application.Controllers.controller 'ExportStatisticsController', [ '$scope', '$u $scope.setRequest = -> if $scope.export.type == 'global' $scope.actionUrl = '/stats/global/export' - $scope.query = JSON.stringify(query) - else - $scope.actionUrl = '/stats/'+index.key+'/export' $scope.query = JSON.stringify( "query": "bool": @@ -614,11 +611,16 @@ Application.Controllers.controller 'ExportStatisticsController', [ '$scope', '$u { "range": "date": - "gte": moment(info.dates.start).format() - "lte": moment(info.dates.end).format() + "gte": moment($scope.dates.start).format() + "lte": moment($scope.dates.end).format() } ] ) + else + $scope.actionUrl = '/stats/'+index.key+'/export' + $scope.query = JSON.stringify(query) + + ## # Callback to close the modal, telling the caller what is exported diff --git a/app/assets/templates/admin/statistics/export.html.erb b/app/assets/templates/admin/statistics/export.html.erb index a028612f7..fb577b2a0 100644 --- a/app/assets/templates/admin/statistics/export.html.erb +++ b/app/assets/templates/admin/statistics/export.html.erb @@ -24,6 +24,7 @@ show-button-bar="false" placeholder="{{ 'start' | translate }}" ng-click="toggleStartDatePicker($event)" + ng-change="setRequest()" required="required"/>