mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
Assign polling numbers to variables and add comments
This commit is contained in:
@@ -5,13 +5,15 @@ angular.module("admin.orders").controller "bulkInvoiceCtrl", ($scope, $http, $ti
|
||||
$scope.loading = true
|
||||
$scope.message = null
|
||||
$scope.error = null
|
||||
$scope.poll_wait = 5 # 5 Seconds between each check
|
||||
$scope.poll_retries = 80 # Maximum checks before stopping
|
||||
|
||||
$http.post('/admin/orders/invoices', {order_ids: $scope.selected_orders}).success (data) ->
|
||||
$scope.invoice_id = data
|
||||
$scope.pollBulkInvoice()
|
||||
|
||||
$scope.pollBulkInvoice = ->
|
||||
$timeout($scope.nextPoll, 5000)
|
||||
$timeout($scope.nextPoll, $scope.poll_wait * 1000)
|
||||
|
||||
$scope.nextPoll = ->
|
||||
$http.get('/admin/orders/invoices/'+$scope.invoice_id+'/poll').success (data) ->
|
||||
@@ -21,7 +23,7 @@ angular.module("admin.orders").controller "bulkInvoiceCtrl", ($scope, $http, $ti
|
||||
.error (data) ->
|
||||
$scope.poll++
|
||||
|
||||
if $scope.poll > 30
|
||||
if $scope.poll > $scope.poll_retries
|
||||
$scope.loading = false
|
||||
$scope.error = t('js.admin.orders.index.bulk_invoice_failed')
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user