cap progress at 99 while progressing
Change-Id: Id8eb68c773b7f867d07789dc05994a65985be4a3 Reviewed-on: https://gerrit.instructure.com/196410 Tested-by: Jenkins Reviewed-by: James Williams <jamesw@instructure.com> QA-Review: James Williams <jamesw@instructure.com> Product-Review: James Williams <jamesw@instructure.com>
This commit is contained in:
parent
678715a027
commit
3e27cacf65
|
@ -121,7 +121,7 @@ class SisBatch < ActiveRecord::Base
|
|||
# Try to have 100 jobs but don't have a job that processes less than 25
|
||||
# rows but also not more than 1000 rows.
|
||||
# Progress is calculated on the number of jobs remaining.
|
||||
[[(rows/100.to_f).ceil, 25].max, 1000].min
|
||||
[[(rows/99.to_f).ceil, 25].max, 1000].min
|
||||
end
|
||||
|
||||
workflow do
|
||||
|
|
|
@ -205,12 +205,12 @@ module SIS
|
|||
end
|
||||
|
||||
def calculate_progress
|
||||
(((@current_row.to_f/@total_rows) * @progress_multiplier) + @progress_offset) * 100
|
||||
[(((@current_row.to_f/@total_rows) * @progress_multiplier) + @progress_offset) * 100, 99].min
|
||||
end
|
||||
|
||||
def update_progress
|
||||
completed_count = @batch.parallel_importers.where(workflow_state: "completed").count
|
||||
current_progress = (completed_count.to_f * 100 / @parallel_importers.values.map(&:count).sum).round
|
||||
current_progress = [(completed_count.to_f * 100 / @parallel_importers.values.map(&:count).sum).round, 99].min
|
||||
SisBatch.where(:id => @batch).where("progress IS NULL or progress < ?", current_progress).update_all(progress: current_progress)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue