canvas_sync 0.22.6 → 0.22.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +0 -0
- data/app/controllers/canvas_sync/api/v1/health_check_controller.rb +0 -0
- data/app/controllers/canvas_sync/api/v1/live_events_controller.rb +0 -0
- data/app/models/canvas_sync/job_log.rb +0 -0
- data/app/models/canvas_sync/sync_batch.rb +0 -0
- data/config/initializers/apartment.rb +0 -0
- data/config/routes.rb +0 -0
- data/db/migrate/20170915210836_create_canvas_sync_job_log.rb +0 -0
- data/db/migrate/20180725155729_add_job_id_to_canvas_sync_job_logs.rb +0 -0
- data/db/migrate/20190916154829_add_fork_count_to_canvas_sync_job_logs.rb +0 -0
- data/db/migrate/20201018210836_create_canvas_sync_sync_batches.rb +0 -0
- data/db/migrate/20201030210836_add_full_sync_to_canvas_sync_sync_batch.rb +0 -0
- data/lib/canvas_sync/api_syncable.rb +0 -0
- data/lib/canvas_sync/batch_processor.rb +0 -0
- data/lib/canvas_sync/class_callback_executor.rb +0 -0
- data/lib/canvas_sync/concerns/ability_helper.rb +0 -0
- data/lib/canvas_sync/concerns/account/ancestry.rb +0 -0
- data/lib/canvas_sync/concerns/account/base.rb +0 -0
- data/lib/canvas_sync/concerns/api_syncable.rb +9 -6
- data/lib/canvas_sync/concerns/legacy_columns.rb +0 -0
- data/lib/canvas_sync/concerns/live_event_sync.rb +0 -0
- data/lib/canvas_sync/concerns/role/base.rb +0 -0
- data/lib/canvas_sync/concerns/sync_mapping.rb +11 -1
- data/lib/canvas_sync/config.rb +0 -0
- data/lib/canvas_sync/engine.rb +0 -0
- data/lib/canvas_sync/generators/install_generator.rb +0 -0
- data/lib/canvas_sync/generators/install_live_events_generator.rb +0 -0
- data/lib/canvas_sync/generators/templates/migrations/create_accounts.rb +0 -0
- data/lib/canvas_sync/generators/templates/migrations/create_admins.rb +0 -0
- data/lib/canvas_sync/generators/templates/migrations/create_assignment_groups.rb +0 -0
- data/lib/canvas_sync/generators/templates/migrations/create_assignment_overrides.rb +25 -0
- data/lib/canvas_sync/generators/templates/migrations/create_assignments.rb +0 -0
- data/lib/canvas_sync/generators/templates/migrations/create_content_migrations.rb +0 -0
- data/lib/canvas_sync/generators/templates/migrations/create_context_module_items.rb +0 -0
- data/lib/canvas_sync/generators/templates/migrations/create_context_modules.rb +0 -0
- data/lib/canvas_sync/generators/templates/migrations/create_course_nicknames.rb +0 -0
- data/lib/canvas_sync/generators/templates/migrations/create_course_progresses.rb +0 -0
- data/lib/canvas_sync/generators/templates/migrations/create_courses.rb +0 -0
- data/lib/canvas_sync/generators/templates/migrations/create_enrollments.rb +1 -0
- data/lib/canvas_sync/generators/templates/migrations/create_grading_period_groups.rb +0 -0
- data/lib/canvas_sync/generators/templates/migrations/create_grading_periods.rb +0 -0
- data/lib/canvas_sync/generators/templates/migrations/create_group_memberships.rb +0 -0
- data/lib/canvas_sync/generators/templates/migrations/create_groups.rb +0 -0
- data/lib/canvas_sync/generators/templates/migrations/create_learning_outcome_results.rb +0 -0
- data/lib/canvas_sync/generators/templates/migrations/create_learning_outcomes.rb +0 -0
- data/lib/canvas_sync/generators/templates/migrations/create_pseudonyms.rb +0 -0
- data/lib/canvas_sync/generators/templates/migrations/create_roles.rb +0 -0
- data/lib/canvas_sync/generators/templates/migrations/create_rubric_assessments.rb +0 -0
- data/lib/canvas_sync/generators/templates/migrations/create_rubric_associations.rb +0 -0
- data/lib/canvas_sync/generators/templates/migrations/create_rubrics.rb +0 -0
- data/lib/canvas_sync/generators/templates/migrations/create_sections.rb +0 -0
- data/lib/canvas_sync/generators/templates/migrations/create_submissions.rb +0 -0
- data/lib/canvas_sync/generators/templates/migrations/create_terms.rb +0 -0
- data/lib/canvas_sync/generators/templates/migrations/create_user_observers.rb +0 -0
- data/lib/canvas_sync/generators/templates/migrations/create_users.rb +0 -0
- data/lib/canvas_sync/generators/templates/models/account.rb +0 -0
- data/lib/canvas_sync/generators/templates/models/admin.rb +0 -0
- data/lib/canvas_sync/generators/templates/models/assignment.rb +0 -0
- data/lib/canvas_sync/generators/templates/models/assignment_group.rb +0 -0
- data/lib/canvas_sync/generators/templates/models/assignment_override.rb +28 -0
- data/lib/canvas_sync/generators/templates/models/content_migration.rb +0 -0
- data/lib/canvas_sync/generators/templates/models/context_module.rb +0 -0
- data/lib/canvas_sync/generators/templates/models/context_module_item.rb +0 -0
- data/lib/canvas_sync/generators/templates/models/course.rb +0 -0
- data/lib/canvas_sync/generators/templates/models/course_nickname.rb +0 -0
- data/lib/canvas_sync/generators/templates/models/enrollment.rb +0 -0
- data/lib/canvas_sync/generators/templates/models/grading_period.rb +0 -0
- data/lib/canvas_sync/generators/templates/models/grading_period_group.rb +0 -0
- data/lib/canvas_sync/generators/templates/models/group.rb +0 -0
- data/lib/canvas_sync/generators/templates/models/group_membership.rb +0 -0
- data/lib/canvas_sync/generators/templates/models/learning_outcome.rb +0 -0
- data/lib/canvas_sync/generators/templates/models/learning_outcome_result.rb +0 -0
- data/lib/canvas_sync/generators/templates/models/pseudonym.rb +0 -0
- data/lib/canvas_sync/generators/templates/models/role.rb +0 -0
- data/lib/canvas_sync/generators/templates/models/rubric.rb +0 -0
- data/lib/canvas_sync/generators/templates/models/rubric_assessment.rb +0 -0
- data/lib/canvas_sync/generators/templates/models/rubric_association.rb +0 -0
- data/lib/canvas_sync/generators/templates/models/section.rb +0 -0
- data/lib/canvas_sync/generators/templates/models/submission.rb +0 -0
- data/lib/canvas_sync/generators/templates/models/term.rb +0 -0
- data/lib/canvas_sync/generators/templates/models/user.rb +0 -0
- data/lib/canvas_sync/generators/templates/models/user_observer.rb +0 -0
- data/lib/canvas_sync/generators/templates/services/live_events/assignment_event.rb +0 -0
- data/lib/canvas_sync/generators/templates/services/live_events/assignment_group_event.rb +0 -0
- data/lib/canvas_sync/generators/templates/services/live_events/course_event.rb +0 -0
- data/lib/canvas_sync/generators/templates/services/live_events/course_section_event.rb +0 -0
- data/lib/canvas_sync/generators/templates/services/live_events/enrollment_event.rb +0 -0
- data/lib/canvas_sync/generators/templates/services/live_events/grade_event.rb +0 -0
- data/lib/canvas_sync/generators/templates/services/live_events/module_event.rb +0 -0
- data/lib/canvas_sync/generators/templates/services/live_events/module_item_event.rb +0 -0
- data/lib/canvas_sync/generators/templates/services/live_events/submission_event.rb +0 -0
- data/lib/canvas_sync/generators/templates/services/live_events/syllabus_event.rb +0 -0
- data/lib/canvas_sync/generators/templates/services/live_events/user_event.rb +0 -0
- data/lib/canvas_sync/importers/bulk_importer.rb +39 -69
- data/lib/canvas_sync/importers/legacy_importer.rb +0 -0
- data/lib/canvas_sync/job.rb +0 -0
- data/lib/canvas_sync/job_batches/batch.rb +1 -1
- data/lib/canvas_sync/job_batches/callback.rb +0 -0
- data/lib/canvas_sync/job_batches/chain_builder.rb +3 -24
- data/lib/canvas_sync/job_batches/compat/active_job.rb +0 -0
- data/lib/canvas_sync/job_batches/compat/sidekiq/web/batches_assets/css/styles.less +0 -0
- data/lib/canvas_sync/job_batches/compat/sidekiq/web/batches_assets/js/batch_tree.js +0 -0
- data/lib/canvas_sync/job_batches/compat/sidekiq/web/batches_assets/js/util.js +0 -0
- data/lib/canvas_sync/job_batches/compat/sidekiq/web/helpers.rb +0 -0
- data/lib/canvas_sync/job_batches/compat/sidekiq/web/views/_batch_tree.erb +0 -0
- data/lib/canvas_sync/job_batches/compat/sidekiq/web/views/_batches_table.erb +0 -0
- data/lib/canvas_sync/job_batches/compat/sidekiq/web/views/_common.erb +0 -0
- data/lib/canvas_sync/job_batches/compat/sidekiq/web/views/_jobs_table.erb +0 -0
- data/lib/canvas_sync/job_batches/compat/sidekiq/web/views/_pagination.erb +0 -0
- data/lib/canvas_sync/job_batches/compat/sidekiq/web/views/batch.erb +0 -0
- data/lib/canvas_sync/job_batches/compat/sidekiq/web/views/batches.erb +0 -0
- data/lib/canvas_sync/job_batches/compat/sidekiq/web/views/pool.erb +0 -0
- data/lib/canvas_sync/job_batches/compat/sidekiq/web/views/pools.erb +0 -0
- data/lib/canvas_sync/job_batches/compat/sidekiq/web.rb +0 -0
- data/lib/canvas_sync/job_batches/compat/sidekiq.rb +0 -0
- data/lib/canvas_sync/job_batches/compat.rb +0 -0
- data/lib/canvas_sync/job_batches/context_hash.rb +0 -0
- data/lib/canvas_sync/job_batches/hier_batch_ids.lua +0 -0
- data/lib/canvas_sync/job_batches/jobs/base_job.rb +0 -0
- data/lib/canvas_sync/job_batches/jobs/concurrent_batch_job.rb +0 -0
- data/lib/canvas_sync/job_batches/jobs/managed_batch_job.rb +0 -4
- data/lib/canvas_sync/job_batches/jobs/serial_batch_job.rb +0 -0
- data/lib/canvas_sync/job_batches/pool.rb +0 -0
- data/lib/canvas_sync/job_batches/pool_refill.lua +0 -0
- data/lib/canvas_sync/job_batches/redis_model.rb +0 -0
- data/lib/canvas_sync/job_batches/redis_script.rb +0 -0
- data/lib/canvas_sync/job_batches/schedule_callback.lua +0 -0
- data/lib/canvas_sync/job_batches/status.rb +0 -1
- data/lib/canvas_sync/job_uniqueness/compat/active_job.rb +0 -0
- data/lib/canvas_sync/job_uniqueness/compat/sidekiq.rb +0 -0
- data/lib/canvas_sync/job_uniqueness/compat.rb +0 -0
- data/lib/canvas_sync/job_uniqueness/configuration.rb +0 -0
- data/lib/canvas_sync/job_uniqueness/job_uniqueness.rb +0 -0
- data/lib/canvas_sync/job_uniqueness/lock_context.rb +3 -15
- data/lib/canvas_sync/job_uniqueness/locksmith.rb +0 -0
- data/lib/canvas_sync/job_uniqueness/on_conflict/base.rb +0 -0
- data/lib/canvas_sync/job_uniqueness/on_conflict/log.rb +0 -0
- data/lib/canvas_sync/job_uniqueness/on_conflict/null_strategy.rb +0 -0
- data/lib/canvas_sync/job_uniqueness/on_conflict/raise.rb +0 -0
- data/lib/canvas_sync/job_uniqueness/on_conflict/reject.rb +0 -0
- data/lib/canvas_sync/job_uniqueness/on_conflict/reschedule.rb +0 -0
- data/lib/canvas_sync/job_uniqueness/on_conflict.rb +0 -0
- data/lib/canvas_sync/job_uniqueness/strategy/base.rb +0 -0
- data/lib/canvas_sync/job_uniqueness/strategy/until_and_while_executing.rb +0 -0
- data/lib/canvas_sync/job_uniqueness/strategy/until_executed.rb +0 -0
- data/lib/canvas_sync/job_uniqueness/strategy/until_executing.rb +0 -0
- data/lib/canvas_sync/job_uniqueness/strategy/until_expired.rb +0 -0
- data/lib/canvas_sync/job_uniqueness/strategy/while_executing.rb +0 -0
- data/lib/canvas_sync/job_uniqueness/strategy.rb +0 -0
- data/lib/canvas_sync/job_uniqueness/unique_job_common.rb +0 -0
- data/lib/canvas_sync/jobs/begin_sync_chain_job.rb +0 -0
- data/lib/canvas_sync/jobs/canvas_process_waiter.rb +0 -0
- data/lib/canvas_sync/jobs/report_checker.rb +0 -0
- data/lib/canvas_sync/jobs/report_processor_job.rb +0 -0
- data/lib/canvas_sync/jobs/report_starter.rb +0 -0
- data/lib/canvas_sync/jobs/sync_accounts_job.rb +0 -0
- data/lib/canvas_sync/jobs/sync_admins_job.rb +0 -0
- data/lib/canvas_sync/jobs/sync_assignment_groups_job.rb +0 -0
- data/lib/canvas_sync/jobs/sync_assignment_overrides_job.rb +20 -0
- data/lib/canvas_sync/jobs/sync_assignments_job.rb +0 -0
- data/lib/canvas_sync/jobs/sync_content_migrations_job.rb +0 -0
- data/lib/canvas_sync/jobs/sync_context_module_items_job.rb +0 -0
- data/lib/canvas_sync/jobs/sync_context_modules_job.rb +0 -0
- data/lib/canvas_sync/jobs/sync_course_progresses_job.rb +0 -0
- data/lib/canvas_sync/jobs/sync_provisioning_report_job.rb +0 -0
- data/lib/canvas_sync/jobs/sync_roles_job.rb +0 -0
- data/lib/canvas_sync/jobs/sync_rubric_assessments_job.rb +0 -0
- data/lib/canvas_sync/jobs/sync_rubric_associations_job.rb +0 -0
- data/lib/canvas_sync/jobs/sync_rubrics_job.rb +0 -0
- data/lib/canvas_sync/jobs/sync_simple_table_job.rb +0 -0
- data/lib/canvas_sync/jobs/sync_submissions_job.rb +0 -0
- data/lib/canvas_sync/jobs/sync_terms_job.rb +0 -0
- data/lib/canvas_sync/jobs/term_batches_job.rb +1 -4
- data/lib/canvas_sync/live_events/base_handler.rb +0 -0
- data/lib/canvas_sync/live_events/process_event_job.rb +0 -0
- data/lib/canvas_sync/live_events.rb +0 -0
- data/lib/canvas_sync/misc_helper.rb +0 -0
- data/lib/canvas_sync/processors/assignment_groups_processor.rb +0 -0
- data/lib/canvas_sync/processors/assignment_overrides_processor.rb +41 -0
- data/lib/canvas_sync/processors/assignments_processor.rb +0 -0
- data/lib/canvas_sync/processors/content_migrations_processor.rb +0 -0
- data/lib/canvas_sync/processors/context_module_items_processor.rb +0 -0
- data/lib/canvas_sync/processors/context_modules_processor.rb +0 -0
- data/lib/canvas_sync/processors/course_completion_report_processor.rb +0 -0
- data/lib/canvas_sync/processors/model_mappings.yml +46 -0
- data/lib/canvas_sync/processors/normal_processor.rb +0 -0
- data/lib/canvas_sync/processors/provisioning_report_processor.rb +0 -0
- data/lib/canvas_sync/processors/report_processor.rb +0 -0
- data/lib/canvas_sync/processors/rubric_assessments_processor.rb +0 -0
- data/lib/canvas_sync/processors/rubric_associations_processor.rb +0 -0
- data/lib/canvas_sync/processors/rubrics_processor.rb +0 -0
- data/lib/canvas_sync/processors/submissions_processor.rb +0 -0
- data/lib/canvas_sync/record.rb +0 -0
- data/lib/canvas_sync/sidekiq_job.rb +0 -0
- data/lib/canvas_sync/version.rb +1 -1
- data/lib/canvas_sync.rb +4 -0
- data/spec/canvas_sync/canvas_sync_spec.rb +41 -59
- data/spec/canvas_sync/jobs/canvas_process_waiter_spec.rb +0 -0
- data/spec/canvas_sync/jobs/job_spec.rb +0 -0
- data/spec/canvas_sync/jobs/report_checker_spec.rb +0 -0
- data/spec/canvas_sync/jobs/report_processor_job_spec.rb +0 -0
- data/spec/canvas_sync/jobs/report_starter_spec.rb +0 -0
- data/spec/canvas_sync/jobs/sync_admins_job_spec.rb +0 -0
- data/spec/canvas_sync/jobs/sync_assignment_groups_job_spec.rb +0 -0
- data/spec/canvas_sync/jobs/sync_assignments_job_spec.rb +0 -0
- data/spec/canvas_sync/jobs/sync_content_migrations_job_spec.rb +0 -0
- data/spec/canvas_sync/jobs/sync_context_module_items_job_spec.rb +0 -0
- data/spec/canvas_sync/jobs/sync_context_modules_job_spec.rb +0 -0
- data/spec/canvas_sync/jobs/sync_provisioning_report_job_spec.rb +0 -0
- data/spec/canvas_sync/jobs/sync_roles_job_spec.rb +0 -0
- data/spec/canvas_sync/jobs/sync_simple_table_job_spec.rb +0 -0
- data/spec/canvas_sync/jobs/sync_submissions_job_spec.rb +0 -0
- data/spec/canvas_sync/jobs/sync_terms_job_spec.rb +0 -0
- data/spec/canvas_sync/live_events/live_event_sync_spec.rb +0 -0
- data/spec/canvas_sync/live_events/live_events_controller_spec.rb +0 -0
- data/spec/canvas_sync/live_events/process_event_job_spec.rb +0 -0
- data/spec/canvas_sync/misc_helper_spec.rb +0 -0
- data/spec/canvas_sync/models/accounts_spec.rb +0 -0
- data/spec/canvas_sync/models/admins_spec.rb +0 -0
- data/spec/canvas_sync/models/assignment_group_spec.rb +0 -0
- data/spec/canvas_sync/models/assignment_spec.rb +0 -0
- data/spec/canvas_sync/models/context_module_item_spec.rb +0 -0
- data/spec/canvas_sync/models/context_module_spec.rb +0 -0
- data/spec/canvas_sync/models/course_spec.rb +0 -0
- data/spec/canvas_sync/models/enrollment_spec.rb +0 -0
- data/spec/canvas_sync/models/group_membership_spec.rb +0 -0
- data/spec/canvas_sync/models/group_spec.rb +0 -0
- data/spec/canvas_sync/models/roles_spec.rb +0 -0
- data/spec/canvas_sync/models/section_spec.rb +0 -0
- data/spec/canvas_sync/models/submission_spec.rb +0 -0
- data/spec/canvas_sync/models/term_spec.rb +0 -0
- data/spec/canvas_sync/models/user_spec.rb +0 -0
- data/spec/canvas_sync/processors/assignment_groups_processor_spec.rb +0 -0
- data/spec/canvas_sync/processors/assignment_overrides_processor_spec.rb +45 -0
- data/spec/canvas_sync/processors/assignments_processor_spec.rb +0 -0
- data/spec/canvas_sync/processors/content_migrations_processor_spec.rb +0 -0
- data/spec/canvas_sync/processors/context_module_items_processor_spec.rb +0 -0
- data/spec/canvas_sync/processors/context_modules_processor_spec.rb +0 -0
- data/spec/canvas_sync/processors/course_completion_report_processor_spec.rb +0 -0
- data/spec/canvas_sync/processors/normal_processor_spec.rb +0 -0
- data/spec/canvas_sync/processors/provisioning_report_processor_spec.rb +4 -0
- data/spec/canvas_sync/processors/rubric_assessments_spec.rb +0 -0
- data/spec/canvas_sync/processors/rubric_associations_spec.rb +0 -0
- data/spec/canvas_sync/processors/rubrics_processor_spec.rb +0 -0
- data/spec/canvas_sync/processors/submissions_processor_spec.rb +0 -0
- data/spec/canvas_sync/services/module_event_spec.rb +0 -0
- data/spec/canvas_sync/services/module_item_event_spec.rb +0 -0
- data/spec/dummy/README.rdoc +0 -0
- data/spec/dummy/Rakefile +0 -0
- data/spec/dummy/app/models/account.rb +0 -0
- data/spec/dummy/app/models/admin.rb +0 -0
- data/spec/dummy/app/models/application_record.rb +0 -0
- data/spec/dummy/app/models/assignment.rb +0 -0
- data/spec/dummy/app/models/assignment_group.rb +0 -0
- data/spec/dummy/app/models/assignment_override.rb +34 -0
- data/spec/dummy/app/models/content_migration.rb +0 -0
- data/spec/dummy/app/models/context_module.rb +0 -0
- data/spec/dummy/app/models/context_module_item.rb +0 -0
- data/spec/dummy/app/models/course.rb +0 -0
- data/spec/dummy/app/models/course_nickname.rb +0 -0
- data/spec/dummy/app/models/enrollment.rb +0 -0
- data/spec/dummy/app/models/grading_period.rb +0 -0
- data/spec/dummy/app/models/grading_period_group.rb +0 -0
- data/spec/dummy/app/models/group.rb +0 -0
- data/spec/dummy/app/models/group_membership.rb +0 -0
- data/spec/dummy/app/models/learning_outcome.rb +0 -0
- data/spec/dummy/app/models/learning_outcome_result.rb +0 -0
- data/spec/dummy/app/models/pseudonym.rb +0 -0
- data/spec/dummy/app/models/role.rb +0 -0
- data/spec/dummy/app/models/rubric.rb +0 -0
- data/spec/dummy/app/models/rubric_assessment.rb +0 -0
- data/spec/dummy/app/models/rubric_association.rb +0 -0
- data/spec/dummy/app/models/section.rb +0 -0
- data/spec/dummy/app/models/submission.rb +0 -0
- data/spec/dummy/app/models/term.rb +0 -0
- data/spec/dummy/app/models/user.rb +0 -0
- data/spec/dummy/app/models/user_observer.rb +0 -0
- data/spec/dummy/app/services/live_events/assignment_created_event.rb +0 -0
- data/spec/dummy/app/services/live_events/assignment_event.rb +0 -0
- data/spec/dummy/app/services/live_events/assignment_updated_event.rb +0 -0
- data/spec/dummy/app/services/live_events/base_event.rb +0 -0
- data/spec/dummy/app/services/live_events/course_created_event.rb +0 -0
- data/spec/dummy/app/services/live_events/course_event.rb +0 -0
- data/spec/dummy/app/services/live_events/course_section_created_event.rb +0 -0
- data/spec/dummy/app/services/live_events/course_section_event.rb +0 -0
- data/spec/dummy/app/services/live_events/course_section_updated_event.rb +0 -0
- data/spec/dummy/app/services/live_events/course_updated_event.rb +0 -0
- data/spec/dummy/app/services/live_events/enrollment_created_event.rb +0 -0
- data/spec/dummy/app/services/live_events/enrollment_event.rb +0 -0
- data/spec/dummy/app/services/live_events/enrollment_updated_event.rb +0 -0
- data/spec/dummy/app/services/live_events/grade_changed_event.rb +0 -0
- data/spec/dummy/app/services/live_events/grade_event.rb +0 -0
- data/spec/dummy/app/services/live_events/module_created_event.rb +0 -0
- data/spec/dummy/app/services/live_events/module_event.rb +0 -0
- data/spec/dummy/app/services/live_events/module_item_created_event.rb +0 -0
- data/spec/dummy/app/services/live_events/module_item_event.rb +0 -0
- data/spec/dummy/app/services/live_events/module_item_updated_event.rb +0 -0
- data/spec/dummy/app/services/live_events/module_updated_event.rb +0 -0
- data/spec/dummy/app/services/live_events/submission_created_event.rb +0 -0
- data/spec/dummy/app/services/live_events/submission_event.rb +0 -0
- data/spec/dummy/app/services/live_events/submission_updated_event.rb +0 -0
- data/spec/dummy/app/services/live_events/syllabus_event.rb +0 -0
- data/spec/dummy/app/services/live_events/syllabus_updated_event.rb +0 -0
- data/spec/dummy/app/services/live_events/user_created_event.rb +0 -0
- data/spec/dummy/app/services/live_events/user_event.rb +0 -0
- data/spec/dummy/app/services/live_events/user_updated_event.rb +0 -0
- data/spec/dummy/config/application.rb +0 -0
- data/spec/dummy/config/boot.rb +0 -0
- data/spec/dummy/config/database.yml +0 -0
- data/spec/dummy/config/environment.rb +0 -0
- data/spec/dummy/config/environments/development.rb +0 -0
- data/spec/dummy/config/environments/test.rb +0 -0
- data/spec/dummy/config/initializers/assets.rb +0 -0
- data/spec/dummy/config/initializers/session_store.rb +0 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +0 -0
- data/spec/dummy/config/routes.rb +0 -0
- data/spec/dummy/config/secrets.yml +0 -0
- data/spec/dummy/config.ru +0 -0
- data/spec/dummy/db/migrate/20190702203621_create_courses.rb +0 -0
- data/spec/dummy/db/migrate/20190702203622_create_accounts.rb +0 -0
- data/spec/dummy/db/migrate/20190702203623_create_terms.rb +0 -0
- data/spec/dummy/db/migrate/20190702203624_create_enrollments.rb +1 -0
- data/spec/dummy/db/migrate/20190702203625_create_sections.rb +0 -0
- data/spec/dummy/db/migrate/20190702203626_create_assignments.rb +0 -0
- data/spec/dummy/db/migrate/20190702203627_create_submissions.rb +0 -0
- data/spec/dummy/db/migrate/20190702203630_create_assignment_groups.rb +0 -0
- data/spec/dummy/db/migrate/20190702203631_create_context_modules.rb +0 -0
- data/spec/dummy/db/migrate/20190702203632_create_context_module_items.rb +0 -0
- data/spec/dummy/db/migrate/20190927204545_create_roles.rb +0 -0
- data/spec/dummy/db/migrate/20190927204546_create_admins.rb +0 -0
- data/spec/dummy/db/migrate/20200415171620_create_groups.rb +0 -0
- data/spec/dummy/db/migrate/20200416214248_create_group_memberships.rb +0 -0
- data/spec/dummy/db/migrate/20201016181346_create_pseudonyms.rb +0 -0
- data/spec/dummy/db/migrate/20210907233329_create_user_observers.rb +0 -0
- data/spec/dummy/db/migrate/20210907233330_create_grading_periods.rb +0 -0
- data/spec/dummy/db/migrate/20211001184920_create_grading_period_groups.rb +0 -0
- data/spec/dummy/db/migrate/20220308072643_create_content_migrations.rb +0 -0
- data/spec/dummy/db/migrate/20220712210559_create_learning_outcomes.rb +0 -0
- data/spec/dummy/db/migrate/20220926221926_create_users.rb +0 -0
- data/spec/dummy/db/migrate/20240408223326_create_course_nicknames.rb +0 -0
- data/spec/dummy/db/migrate/20240509105100_create_rubrics.rb +0 -0
- data/spec/dummy/db/migrate/20240510094100_create_rubric_associations.rb +0 -0
- data/spec/dummy/db/migrate/20240510101100_create_rubric_assessments.rb +0 -0
- data/spec/dummy/db/migrate/20240523101010_create_learning_outcome_results.rb +0 -0
- data/spec/dummy/db/migrate/20240828161300_create_course_progresses.rb +0 -0
- data/spec/dummy/db/migrate/20241223080202_create_assignment_overrides.rb +25 -0
- data/spec/dummy/db/schema.rb +188 -174
- data/spec/factories/account_factory.rb +0 -0
- data/spec/factories/admin_factory.rb +0 -0
- data/spec/factories/assignment_factory.rb +0 -0
- data/spec/factories/assignment_group_factory.rb +0 -0
- data/spec/factories/assignment_override_factory.rb +10 -0
- data/spec/factories/context_module_factory.rb +0 -0
- data/spec/factories/context_module_item_factory.rb +0 -0
- data/spec/factories/course_factory.rb +0 -0
- data/spec/factories/enrollment_factory.rb +0 -0
- data/spec/factories/group_factory.rb +0 -0
- data/spec/factories/group_membership_factory.rb +0 -0
- data/spec/factories/role_factory.rb +0 -0
- data/spec/factories/section_factory.rb +0 -0
- data/spec/factories/submission_factory.rb +0 -0
- data/spec/factories/term_factory.rb +0 -0
- data/spec/factories/user_factory.rb +0 -0
- data/spec/job_batching/batch_spec.rb +0 -0
- data/spec/job_batching/callback_spec.rb +0 -0
- data/spec/job_batching/compat/active_job_spec.rb +0 -0
- data/spec/job_batching/compat/sidekiq_spec.rb +0 -0
- data/spec/job_batching/context_hash_spec.rb +0 -0
- data/spec/job_batching/flow_spec.rb +0 -0
- data/spec/job_batching/integration/fail_then_succeed.rb +0 -0
- data/spec/job_batching/integration/integration.rb +0 -0
- data/spec/job_batching/integration/nested.rb +0 -0
- data/spec/job_batching/integration/simple.rb +0 -0
- data/spec/job_batching/integration/workflow.rb +0 -0
- data/spec/job_batching/integration_helper.rb +0 -0
- data/spec/job_batching/pool_spec.rb +0 -0
- data/spec/job_batching/status_spec.rb +0 -0
- data/spec/job_batching/support/base_job.rb +0 -0
- data/spec/job_batching/support/sample_callback.rb +0 -0
- data/spec/job_uniqueness/compat/active_job_spec.rb +0 -0
- data/spec/job_uniqueness/compat/sidekiq_spec.rb +0 -0
- data/spec/job_uniqueness/lock_context_spec.rb +0 -0
- data/spec/job_uniqueness/on_conflict/log_spec.rb +0 -0
- data/spec/job_uniqueness/on_conflict/raise_spec.rb +0 -0
- data/spec/job_uniqueness/on_conflict/reschedule_spec.rb +0 -0
- data/spec/job_uniqueness/on_conflict_spec.rb +0 -0
- data/spec/job_uniqueness/spec_helper.rb +0 -0
- data/spec/job_uniqueness/strategy/base_spec.rb +0 -0
- data/spec/job_uniqueness/strategy/until_and_while_executing_spec.rb +0 -0
- data/spec/job_uniqueness/strategy/until_executed_spec.rb +0 -0
- data/spec/job_uniqueness/strategy/until_executing_spec.rb +0 -0
- data/spec/job_uniqueness/strategy/until_expired_spec.rb +0 -0
- data/spec/job_uniqueness/strategy/while_executing_spec.rb +0 -0
- data/spec/job_uniqueness/support/lock_strategy.rb +0 -0
- data/spec/job_uniqueness/support/on_conflict.rb +0 -0
- data/spec/job_uniqueness/support/test_worker.rb +0 -0
- data/spec/job_uniqueness/unique_job_common_spec.rb +0 -0
- data/spec/spec_helper.rb +0 -0
- data/spec/support/fake_canvas.rb +0 -0
- data/spec/support/fixtures/canvas_responses/admins.json +0 -0
- data/spec/support/fixtures/canvas_responses/module.json +0 -0
- data/spec/support/fixtures/canvas_responses/module_item.json +0 -0
- data/spec/support/fixtures/canvas_responses/roles.json +0 -0
- data/spec/support/fixtures/canvas_responses/terms.json +0 -0
- data/spec/support/fixtures/reports/assignment_groups.csv +0 -0
- data/spec/support/fixtures/reports/assignment_overrides.csv +3 -0
- data/spec/support/fixtures/reports/assignment_overrides_conflict.csv +2 -0
- data/spec/support/fixtures/reports/assignments.csv +0 -0
- data/spec/support/fixtures/reports/content_migrations.csv +0 -0
- data/spec/support/fixtures/reports/context_module_items.csv +0 -0
- data/spec/support/fixtures/reports/context_modules.csv +0 -0
- data/spec/support/fixtures/reports/course_nicknames.csv +0 -0
- data/spec/support/fixtures/reports/course_progresses.csv +0 -0
- data/spec/support/fixtures/reports/course_progresses_conflict.csv +0 -0
- data/spec/support/fixtures/reports/courses.csv +0 -0
- data/spec/support/fixtures/reports/enrollments.csv +0 -0
- data/spec/support/fixtures/reports/grading_period_groups.csv +0 -0
- data/spec/support/fixtures/reports/grading_periods.csv +0 -0
- data/spec/support/fixtures/reports/group_memberships.csv +0 -0
- data/spec/support/fixtures/reports/groups.csv +0 -0
- data/spec/support/fixtures/reports/learning_outcome_results.csv +0 -0
- data/spec/support/fixtures/reports/learning_outcomes.csv +0 -0
- data/spec/support/fixtures/reports/provisioning_csv +0 -0
- data/spec/support/fixtures/reports/rubric_assessments.csv +0 -0
- data/spec/support/fixtures/reports/rubric_associations.csv +0 -0
- data/spec/support/fixtures/reports/rubrics.csv +0 -0
- data/spec/support/fixtures/reports/sections.csv +0 -0
- data/spec/support/fixtures/reports/submissions.csv +0 -0
- data/spec/support/fixtures/reports/user_observers.csv +0 -0
- data/spec/support/fixtures/reports/users.csv +0 -0
- data/spec/support/fixtures/reports/xlist.csv +0 -0
- metadata +208 -211
- data/lib/canvas_sync/concerns/auto_relations.rb +0 -11
- data/spec/support/fixtures/reports/provisioning_csv_unzipped/courses.csv +0 -3
- data/spec/support/fixtures/reports/provisioning_csv_unzipped/users.csv +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0537b456eab7c4816125ddf995d80bb0afbd49a5d2f197fba4367e9753a85de7
|
4
|
+
data.tar.gz: e8789634293ef5517faba77d4c654036d45fc42f5aad69b836736dea2cd5f1dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83fc5373c5bb541d163e4c5bcfee7adf43c2f5c70a6957a879d657b03a48a7ef5b96adde4b28fefadf913533942a538d7b014a0409ed41b6fed694191ec9d2ac
|
7
|
+
data.tar.gz: 5b212e20447e8a743e276407e7251ede63bdf1df2650d1378c60a40fedff6ef29efe716d25f1ec6a6c0ca1e7f6938c2b3b012d677189c5b158c876209ae5f48f
|
data/Rakefile
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/config/routes.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -40,14 +40,17 @@ module CanvasSync::Concerns
|
|
40
40
|
options = { validate: false, on_duplicate_key_update: update_conditions }.merge(import_args)
|
41
41
|
|
42
42
|
if all_pages
|
43
|
-
|
44
|
-
|
43
|
+
enumer = api_array.all_pages_each.lazy
|
44
|
+
|
45
|
+
# Map the API response to instances of this model
|
46
|
+
enumer = enumer.map do |api_item|
|
47
|
+
new.assign_from_api_params(api_item)
|
45
48
|
end
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
+
|
50
|
+
# Import in batches
|
51
|
+
enumer.each_slice(batch_size) do |batch|
|
52
|
+
import(columns, batch, options)
|
49
53
|
end
|
50
|
-
batcher.flush
|
51
54
|
else
|
52
55
|
items = api_array.map do |api_item|
|
53
56
|
new.assign_from_api_params(api_item)
|
File without changes
|
File without changes
|
File without changes
|
@@ -51,10 +51,11 @@ module CanvasSync::Concerns
|
|
51
51
|
m = maps[mname] = {}
|
52
52
|
|
53
53
|
m[:conflict_target] = Array(legacy[:conflict_target]).map(&:to_sym).map do |lct|
|
54
|
-
legacy[:report_columns][lct]
|
54
|
+
legacy[:report_columns]&.[](lct)&.[](:database_column_name)
|
55
55
|
end
|
56
56
|
|
57
57
|
m[:columns] = {}
|
58
|
+
|
58
59
|
legacy[:report_columns].each do |rcol, opts|
|
59
60
|
m[:columns][opts[:database_column_name]] = opts.except(:database_column_name).merge!(
|
60
61
|
report_column: rcol,
|
@@ -68,6 +69,15 @@ module CanvasSync::Concerns
|
|
68
69
|
def self.default_v1_mappings
|
69
70
|
@legacy_mappings ||= begin
|
70
71
|
mapping = YAML.load_file(File.join(__dir__, '../processors', "model_mappings.yml")).deep_symbolize_keys!
|
72
|
+
# Default columns can be excluded if the table has not been migrated to accept them
|
73
|
+
mapping.each do |mname, legacy|
|
74
|
+
legacy[:report_columns].select! do |rcol, opts|
|
75
|
+
model = mname.to_s&.classify&.safe_constantize
|
76
|
+
# we need to make sure this is a model otherwise they will be systematically removed - some mappings are not models (e.g xlists)
|
77
|
+
model.present? && !model.column_names.include?(opts[:database_column_name].to_s) ? false : true
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
71
81
|
override_filepath = Rails.root.join("config/canvas_sync_provisioning_mapping.yml")
|
72
82
|
|
73
83
|
if File.file?(override_filepath)
|
data/lib/canvas_sync/config.rb
CHANGED
File without changes
|
data/lib/canvas_sync/engine.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,25 @@
|
|
1
|
+
class CreateAssignmentOverrides < ActiveRecord::Migration[5.1]
|
2
|
+
def change
|
3
|
+
create_table :assignment_overrides do |t|
|
4
|
+
t.bigint :canvas_id, null: false
|
5
|
+
t.bigint :canvas_assignment_id
|
6
|
+
t.bigint :canvas_group_id
|
7
|
+
t.bigint :canvas_course_id
|
8
|
+
t.bigint :canvas_section_id
|
9
|
+
t.bigint :student_ids, array: true
|
10
|
+
t.datetime :due_at
|
11
|
+
t.boolean :all_day
|
12
|
+
t.datetime :all_day_date
|
13
|
+
t.datetime :unlock_at
|
14
|
+
t.datetime :lock_at
|
15
|
+
t.string :title
|
16
|
+
t.string :workflow_state
|
17
|
+
|
18
|
+
t.timestamps
|
19
|
+
end
|
20
|
+
|
21
|
+
add_index :assignment_overrides, :canvas_id, unique: true
|
22
|
+
add_index :assignment_overrides, :canvas_assignment_id
|
23
|
+
add_index :assignment_overrides, :canvas_course_id
|
24
|
+
end
|
25
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# <%= autogenerated_model_warning %>
|
2
|
+
|
3
|
+
class AssignmentOverride < ApplicationRecord
|
4
|
+
include CanvasSync::Record
|
5
|
+
include CanvasSync::Concerns::ApiSyncable
|
6
|
+
|
7
|
+
canvas_sync_features :defaults
|
8
|
+
|
9
|
+
validates :canvas_id, uniqueness: true, presence: true
|
10
|
+
belongs_to :assignment, primary_key: :canvas_id, foreign_key: :canvas_assignment_id, optional: true
|
11
|
+
belongs_to :course, primary_key: :canvas_id, foreign_key: :canvas_course_id, optional: true
|
12
|
+
|
13
|
+
api_syncable({
|
14
|
+
canvas_id: :id,
|
15
|
+
canvas_assignment_id: :assignment_id,
|
16
|
+
title: :title,
|
17
|
+
workflow_state: :workflow_state,
|
18
|
+
due_at: :due_at,
|
19
|
+
all_day: :all_day,
|
20
|
+
all_day_date: :all_day_date,
|
21
|
+
unlock_at: :unlock_at,
|
22
|
+
lock_at: :lock_at,
|
23
|
+
student_ids: ->(r) { JSON.parse(r[:student_ids]) if r[:student_ids].present? },
|
24
|
+
canvas_group_id: :group_id,
|
25
|
+
canvas_section_id: :course_section_id,
|
26
|
+
canvas_course_id: -> (r) { r.dig(:assignment, :course_id) }
|
27
|
+
}, -> (api) { api.assignment_override(canvas_assignment_id, canvas_id) })
|
28
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -23,7 +23,7 @@ module CanvasSync
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
def self.perform_in_batches(report_file_path, raw_mapping, klass, conflict_target, import_args: {})
|
26
|
+
def self.perform_in_batches(report_file_path, raw_mapping, klass, conflict_target, import_args: {}, &block)
|
27
27
|
mapping = {}.with_indifferent_access
|
28
28
|
raw_mapping.each do |db_col, opts|
|
29
29
|
next if opts[:deprecated] && !klass.column_names.include?(db_col.to_s)
|
@@ -37,14 +37,27 @@ module CanvasSync
|
|
37
37
|
conflict_target = Array(conflict_target).map(&:to_s)
|
38
38
|
conflict_target_indices = conflict_target.map{|ct| database_column_names.index(ct) }
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
40
|
+
enumer = CSV.foreach(report_file_path, headers: true, header_converters: :symbol).lazy
|
41
|
+
|
42
|
+
# Optionally filter rows by a passed block
|
43
|
+
if block
|
44
|
+
enumer = enumer.filter_map do |row|
|
45
|
+
catch :skip do
|
46
|
+
block.call(row)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# Optionally chunk by a computed value. Mainly so we can group duplicate rows and choose one
|
52
|
+
chunker = nil
|
53
|
+
chunker = UserChunker.new if defined?(User) && klass == User && csv_column_names.include?('user_id')
|
54
|
+
if chunker
|
55
|
+
enumer = enumer.chunk{|row| chunker.key(row) }.flat_map{|key, rows| chunker.choose(key, rows) }
|
44
56
|
end
|
45
57
|
|
46
|
-
|
47
|
-
|
58
|
+
# Prepare the rows for import
|
59
|
+
enumer = enumer.map do |row|
|
60
|
+
mapping.map do |db_col, col_def|
|
48
61
|
value = nil
|
49
62
|
value = row[col_def[:report_column]] if col_def[:report_column]
|
50
63
|
|
@@ -63,33 +76,25 @@ module CanvasSync
|
|
63
76
|
|
64
77
|
value
|
65
78
|
end
|
79
|
+
end
|
66
80
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
81
|
+
# Reject rows within a single batch that have the same ID
|
82
|
+
row_ids = nil
|
83
|
+
if conflict_target.present?
|
84
|
+
enumer = enumer.reject do |row|
|
85
|
+
key = conflict_target_indices.map{|ct| row[ct] }
|
86
|
+
skip = row_ids[key]
|
71
87
|
row_ids[key] = true
|
88
|
+
skip
|
72
89
|
end
|
73
|
-
|
74
|
-
batcher << formatted_row
|
75
|
-
}
|
76
|
-
|
77
|
-
row_buffer = nil
|
78
|
-
if defined?(User) && klass == User && csv_column_names.include?('user_id')
|
79
|
-
row_buffer = UserRowBuffer.new(&row_buffer_out)
|
80
|
-
else
|
81
|
-
row_buffer = NullRowBuffer.new(&row_buffer_out)
|
82
90
|
end
|
83
91
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
92
|
+
# Start importing
|
93
|
+
row_ids = {}
|
94
|
+
enumer.each_slice(batch_size) do |batch|
|
95
|
+
perform_import(klass, database_column_names, batch, conflict_target, import_args)
|
96
|
+
row_ids = {}
|
89
97
|
end
|
90
|
-
|
91
|
-
row_buffer.flush
|
92
|
-
batcher.flush
|
93
98
|
end
|
94
99
|
|
95
100
|
def self.perform_import(klass, columns, rows, conflict_target, import_args={})
|
@@ -157,52 +162,17 @@ module CanvasSync
|
|
157
162
|
batch_size > 0 ? batch_size : DEFAULT_BATCH_SIZE
|
158
163
|
end
|
159
164
|
|
160
|
-
class RowBuffer
|
161
|
-
def initialize(&block)
|
162
|
-
@flush_out = block
|
163
|
-
@buffered_rows = []
|
164
|
-
end
|
165
|
-
|
166
|
-
def <<(v)
|
167
|
-
@buffered_rows << v
|
168
|
-
end
|
169
|
-
|
170
|
-
def flush(value = @buffered_rows)
|
171
|
-
if value.is_a?(Array)
|
172
|
-
value.each do |v|
|
173
|
-
@flush_out.call(v)
|
174
|
-
end
|
175
|
-
else
|
176
|
-
@flush_out.call(value)
|
177
|
-
end
|
178
|
-
@buffered_rows = []
|
179
|
-
end
|
180
|
-
end
|
181
|
-
|
182
|
-
class NullRowBuffer
|
183
|
-
def initialize(&block)
|
184
|
-
@flush_out = block
|
185
|
-
end
|
186
|
-
|
187
|
-
def <<(v)
|
188
|
-
@flush_out.call(v)
|
189
|
-
end
|
190
|
-
|
191
|
-
def flush; end
|
192
|
-
end
|
193
|
-
|
194
165
|
# Ensures that, if a User has multiple rows, one with a SIS ID is preferred.
|
195
166
|
# This is mainly to fix issues in legacy apps - the suggested approach for new apps
|
196
167
|
# is to sync and use the Pseudonymes table
|
197
|
-
class
|
198
|
-
def
|
199
|
-
|
200
|
-
super
|
168
|
+
class UserChunker
|
169
|
+
def key(row)
|
170
|
+
row[:canvas_user_id]
|
201
171
|
end
|
202
172
|
|
203
|
-
def
|
204
|
-
row =
|
205
|
-
|
173
|
+
def choose(key, rows)
|
174
|
+
row = rows.find{|r| r[:user_id].present? } || rows.last
|
175
|
+
row.present? ? [row] : []
|
206
176
|
end
|
207
177
|
end
|
208
178
|
end
|
File without changes
|
data/lib/canvas_sync/job.rb
CHANGED
File without changes
|
@@ -337,7 +337,7 @@ module CanvasSync::JobBatches
|
|
337
337
|
trigger_callback.call(:complete)
|
338
338
|
end
|
339
339
|
|
340
|
-
if all_successful # All
|
340
|
+
if all_successful # All Successful
|
341
341
|
trigger_callback.call(:success)
|
342
342
|
elsif pending_jobs == dead_jobs && pending_batches == stagnated_batches # Stagnated
|
343
343
|
trigger_callback.call(:stagnated)
|
File without changes
|
@@ -4,9 +4,7 @@ module CanvasSync::JobBatches
|
|
4
4
|
|
5
5
|
attr_reader :base_job
|
6
6
|
|
7
|
-
def initialize(base_type = SerialBatchJob
|
8
|
-
@chain_id = chain_id || SecureRandom.urlsafe_base64(10)
|
9
|
-
|
7
|
+
def initialize(base_type = SerialBatchJob)
|
10
8
|
if base_type.is_a?(Hash)
|
11
9
|
@base_job = base_type
|
12
10
|
@base_job[:args] ||= @base_job[:parameters] || []
|
@@ -111,7 +109,7 @@ module CanvasSync::JobBatches
|
|
111
109
|
return nil if matching_jobs.count == 0
|
112
110
|
|
113
111
|
job = matching_jobs[0][0]
|
114
|
-
job = self.class.new(job
|
112
|
+
job = self.class.new(job) unless job.is_a?(ChainBuilder)
|
115
113
|
job
|
116
114
|
end
|
117
115
|
|
@@ -120,7 +118,6 @@ module CanvasSync::JobBatches
|
|
120
118
|
job_def.normalize!
|
121
119
|
else
|
122
120
|
job_def[:job] = job_def[:job].to_s
|
123
|
-
job_def[:chain_link] ||= "#{@chain_id}-#{SecureRandom.urlsafe_base64(10)}"
|
124
121
|
if (chain = self.class.get_chain_parameter(job_def, raise_error: false)).present?
|
125
122
|
chain.map! { |sub_job| normalize!(sub_job) }
|
126
123
|
end
|
@@ -141,7 +138,7 @@ module CanvasSync::JobBatches
|
|
141
138
|
args: args,
|
142
139
|
kwargs: kwargs,
|
143
140
|
}
|
144
|
-
self.class.new(hsh
|
141
|
+
self.class.new(hsh).apply_block(&blk) if blk.present?
|
145
142
|
hsh
|
146
143
|
end
|
147
144
|
|
@@ -242,24 +239,6 @@ module CanvasSync::JobBatches
|
|
242
239
|
job_class.perform_later(*job_args, **job_kwargs)
|
243
240
|
end
|
244
241
|
end
|
245
|
-
|
246
|
-
def link_to_batch!(chain_link, batch)
|
247
|
-
# Or make chains a separate entity - Chains show batches, but batches don't show chain?
|
248
|
-
# Or "Annotate" a Batch with chain data - could extract chain id from any job entry
|
249
|
-
end
|
250
|
-
|
251
|
-
def annotate_batch!(batch, chain)
|
252
|
-
|
253
|
-
end
|
254
|
-
|
255
|
-
def handle_step_complete(status, opts)
|
256
|
-
chain_link = opts[:chain_link]
|
257
|
-
chain_id, chain_step_id = chain_link.split('-')
|
258
|
-
|
259
|
-
CanvasSync::JobBatches::Batch.redis.multi do |r|
|
260
|
-
r.hset("CHAIN-#{chain_id}-steps", chain_step_id, "complete")
|
261
|
-
end
|
262
|
-
end
|
263
242
|
end
|
264
243
|
end
|
265
244
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|