Module: Admin::BackgroundMigrationsHelper
- Defined in:
- app/helpers/admin/background_migrations_helper.rb
Instance Method Summary collapse
-
#batched_migration_progress(migration, completed_rows) ⇒ Object
The extra logic here is needed because total_tuple_count is just an estimate and completed_rows also does not account for last jobs whose batch size is likely larger than the actual number of rows processed.
- #batched_migration_status_badge_variant(migration) ⇒ Object
Instance Method Details
#batched_migration_progress(migration, completed_rows) ⇒ Object
The extra logic here is needed because total_tuple_count is just an estimate and completed_rows also does not account for last jobs whose batch size is likely larger than the actual number of rows processed
20 21 22 23 24 25 26 |
# File 'app/helpers/admin/background_migrations_helper.rb', line 20 def batched_migration_progress(migration, completed_rows) return 100 if migration.finished? return 0 unless completed_rows.to_i > 0 return unless migration.total_tuple_count.to_i > 0 [100 * completed_rows / migration.total_tuple_count, 99].min end |
#batched_migration_status_badge_variant(migration) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'app/helpers/admin/background_migrations_helper.rb', line 5 def batched_migration_status_badge_variant(migration) variants = { active: :info, finalizing: :info, paused: :warning, failed: :danger, finished: :success } variants[migration.status_name] end |