lib/eco/api/session/batch.rb in eco-helpers-0.6.2 vs lib/eco/api/session/batch.rb in eco-helpers-0.6.3
- old
+ new
@@ -99,13 +99,14 @@
# param q does not make sense here, even for GET method
params = {per_page: DEFAULT_BATCH_BLOCK}.merge(params)
per_page = params.fetch(:per_page)
- iteration = 1; done = 0
+ iteration = 1; done = 0
+ iterations = (people.length / per_page).ceil
people.each_slice(per_page) do |slice|
- msg = "starting batch '#{method}' iteration #{iteration}, which has #{slice.length} entries of #{people.length} -- #{done} done"
+ msg = "starting batch '#{method}' iteration #{iteration}/#{iterations}, with #{slice.length} entries of #{people.length} -- #{done} done"
logger.info(msg)
people_api.batch do |batch|
slice.each do |person|
# valid method checked before