canvas_sync 0.16.4 → 0.21.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +235 -151
- data/app/controllers/{api → canvas_sync/api}/v1/health_check_controller.rb +1 -1
- data/app/controllers/canvas_sync/api/v1/live_events_controller.rb +122 -0
- data/app/models/canvas_sync/sync_batch.rb +5 -0
- data/config/initializers/apartment.rb +10 -1
- data/config/routes.rb +7 -0
- data/db/migrate/20170915210836_create_canvas_sync_job_log.rb +12 -31
- data/db/migrate/20180725155729_add_job_id_to_canvas_sync_job_logs.rb +4 -13
- data/db/migrate/20190916154829_add_fork_count_to_canvas_sync_job_logs.rb +3 -11
- data/db/migrate/20201018210836_create_canvas_sync_sync_batches.rb +11 -0
- data/db/migrate/20201030210836_add_full_sync_to_canvas_sync_sync_batch.rb +7 -0
- data/lib/canvas_sync/batch_processor.rb +41 -0
- data/lib/canvas_sync/concerns/ability_helper.rb +72 -0
- data/lib/canvas_sync/concerns/account/ancestry.rb +2 -0
- data/lib/canvas_sync/concerns/account/base.rb +15 -0
- data/lib/canvas_sync/concerns/api_syncable.rb +17 -10
- data/lib/canvas_sync/concerns/live_event_sync.rb +46 -0
- data/lib/canvas_sync/concerns/role/base.rb +57 -0
- data/lib/canvas_sync/concerns/sync_mapping.rb +120 -0
- data/lib/canvas_sync/engine.rb +80 -0
- data/lib/canvas_sync/generators/install_generator.rb +1 -0
- data/lib/canvas_sync/generators/install_live_events_generator.rb +0 -1
- data/lib/canvas_sync/generators/templates/migrations/create_content_migrations.rb +24 -0
- data/lib/canvas_sync/generators/templates/migrations/create_course_nicknames.rb +17 -0
- data/lib/canvas_sync/generators/templates/migrations/create_grading_period_groups.rb +18 -0
- data/lib/canvas_sync/generators/templates/migrations/create_grading_periods.rb +22 -0
- data/lib/canvas_sync/generators/templates/migrations/create_learning_outcome_results.rb +46 -0
- data/lib/canvas_sync/generators/templates/migrations/create_learning_outcomes.rb +30 -0
- data/lib/canvas_sync/generators/templates/migrations/create_rubric_assessments.rb +31 -0
- data/lib/canvas_sync/generators/templates/migrations/create_rubric_associations.rb +36 -0
- data/lib/canvas_sync/generators/templates/migrations/create_rubrics.rb +38 -0
- data/lib/canvas_sync/generators/templates/migrations/create_user_observers.rb +17 -0
- data/lib/canvas_sync/generators/templates/migrations/create_users.rb +0 -1
- data/lib/canvas_sync/generators/templates/models/account.rb +3 -0
- data/lib/canvas_sync/generators/templates/models/admin.rb +2 -0
- data/lib/canvas_sync/generators/templates/models/assignment.rb +3 -0
- data/lib/canvas_sync/generators/templates/models/assignment_group.rb +3 -0
- data/lib/canvas_sync/generators/templates/models/content_migration.rb +12 -0
- data/lib/canvas_sync/generators/templates/models/context_module.rb +3 -0
- data/lib/canvas_sync/generators/templates/models/context_module_item.rb +3 -0
- data/lib/canvas_sync/generators/templates/models/course.rb +11 -0
- data/lib/canvas_sync/generators/templates/models/course_nickname.rb +13 -0
- data/lib/canvas_sync/generators/templates/models/enrollment.rb +14 -0
- data/lib/canvas_sync/generators/templates/models/grading_period.rb +10 -0
- data/lib/canvas_sync/generators/templates/models/grading_period_group.rb +9 -0
- data/lib/canvas_sync/generators/templates/models/group.rb +2 -0
- data/lib/canvas_sync/generators/templates/models/group_membership.rb +2 -0
- data/lib/canvas_sync/generators/templates/models/learning_outcome.rb +24 -0
- data/lib/canvas_sync/generators/templates/models/learning_outcome_result.rb +48 -0
- data/lib/canvas_sync/generators/templates/models/pseudonym.rb +2 -0
- data/lib/canvas_sync/generators/templates/models/role.rb +2 -0
- data/lib/canvas_sync/generators/templates/models/rubric.rb +29 -0
- data/lib/canvas_sync/generators/templates/models/rubric_assessment.rb +17 -0
- data/lib/canvas_sync/generators/templates/models/rubric_association.rb +14 -0
- data/lib/canvas_sync/generators/templates/models/section.rb +9 -0
- data/lib/canvas_sync/generators/templates/models/submission.rb +3 -0
- data/lib/canvas_sync/generators/templates/models/term.rb +3 -0
- data/lib/canvas_sync/generators/templates/models/user.rb +11 -0
- data/lib/canvas_sync/generators/templates/models/user_observer.rb +13 -0
- data/lib/canvas_sync/generators/templates/services/live_events/assignment_event.rb +1 -1
- data/lib/canvas_sync/generators/templates/services/live_events/assignment_group_event.rb +1 -1
- data/lib/canvas_sync/generators/templates/services/live_events/course_event.rb +1 -3
- data/lib/canvas_sync/generators/templates/services/live_events/course_section_event.rb +1 -1
- data/lib/canvas_sync/generators/templates/services/live_events/enrollment_event.rb +1 -1
- data/lib/canvas_sync/generators/templates/services/live_events/grade_event.rb +1 -1
- data/lib/canvas_sync/generators/templates/services/live_events/module_event.rb +1 -1
- data/lib/canvas_sync/generators/templates/services/live_events/module_item_event.rb +1 -1
- data/lib/canvas_sync/generators/templates/services/live_events/submission_event.rb +1 -1
- data/lib/canvas_sync/generators/templates/services/live_events/syllabus_event.rb +1 -1
- data/lib/canvas_sync/generators/templates/services/live_events/user_event.rb +1 -3
- data/lib/canvas_sync/importers/bulk_importer.rb +138 -31
- data/lib/canvas_sync/job.rb +7 -5
- data/lib/canvas_sync/job_batches/active_job.rb +108 -0
- data/lib/canvas_sync/job_batches/batch.rb +543 -0
- data/lib/canvas_sync/job_batches/callback.rb +149 -0
- data/lib/canvas_sync/job_batches/chain_builder.rb +249 -0
- data/lib/canvas_sync/job_batches/context_hash.rb +159 -0
- data/lib/canvas_sync/job_batches/hier_batch_ids.lua +25 -0
- data/lib/canvas_sync/job_batches/jobs/base_job.rb +7 -0
- data/lib/canvas_sync/job_batches/jobs/concurrent_batch_job.rb +22 -0
- data/lib/canvas_sync/job_batches/jobs/managed_batch_job.rb +170 -0
- data/lib/canvas_sync/job_batches/jobs/serial_batch_job.rb +22 -0
- data/lib/canvas_sync/job_batches/pool.rb +245 -0
- data/lib/canvas_sync/job_batches/pool_refill.lua +47 -0
- data/lib/canvas_sync/job_batches/redis_model.rb +69 -0
- data/lib/canvas_sync/job_batches/redis_script.rb +163 -0
- data/lib/canvas_sync/job_batches/schedule_callback.lua +14 -0
- data/lib/canvas_sync/job_batches/sidekiq/web/batches_assets/css/styles.less +182 -0
- data/lib/canvas_sync/job_batches/sidekiq/web/batches_assets/js/batch_tree.js +108 -0
- data/lib/canvas_sync/job_batches/sidekiq/web/batches_assets/js/util.js +2 -0
- data/lib/canvas_sync/job_batches/sidekiq/web/helpers.rb +41 -0
- data/lib/canvas_sync/job_batches/sidekiq/web/views/_batch_tree.erb +6 -0
- data/lib/canvas_sync/job_batches/sidekiq/web/views/_batches_table.erb +44 -0
- data/lib/canvas_sync/job_batches/sidekiq/web/views/_common.erb +13 -0
- data/lib/canvas_sync/job_batches/sidekiq/web/views/_jobs_table.erb +21 -0
- data/lib/canvas_sync/job_batches/sidekiq/web/views/_pagination.erb +26 -0
- data/lib/canvas_sync/job_batches/sidekiq/web/views/batch.erb +81 -0
- data/lib/canvas_sync/job_batches/sidekiq/web/views/batches.erb +23 -0
- data/lib/canvas_sync/job_batches/sidekiq/web/views/pool.erb +137 -0
- data/lib/canvas_sync/job_batches/sidekiq/web/views/pools.erb +47 -0
- data/lib/canvas_sync/job_batches/sidekiq/web.rb +218 -0
- data/lib/canvas_sync/job_batches/sidekiq.rb +136 -0
- data/lib/canvas_sync/job_batches/status.rb +91 -0
- data/lib/canvas_sync/jobs/begin_sync_chain_job.rb +99 -0
- data/lib/canvas_sync/jobs/canvas_process_waiter.rb +41 -0
- data/lib/canvas_sync/jobs/report_checker.rb +70 -8
- data/lib/canvas_sync/jobs/report_processor_job.rb +4 -7
- data/lib/canvas_sync/jobs/report_starter.rb +34 -20
- data/lib/canvas_sync/jobs/sync_accounts_job.rb +3 -5
- data/lib/canvas_sync/jobs/sync_admins_job.rb +2 -4
- data/lib/canvas_sync/jobs/sync_assignment_groups_job.rb +2 -4
- data/lib/canvas_sync/jobs/sync_assignments_job.rb +2 -4
- data/lib/canvas_sync/jobs/sync_content_migrations_job.rb +20 -0
- data/lib/canvas_sync/jobs/sync_context_module_items_job.rb +2 -4
- data/lib/canvas_sync/jobs/sync_context_modules_job.rb +2 -4
- data/lib/canvas_sync/jobs/sync_provisioning_report_job.rb +16 -50
- data/lib/canvas_sync/jobs/sync_roles_job.rb +2 -5
- data/lib/canvas_sync/jobs/sync_rubric_assessments_job.rb +15 -0
- data/lib/canvas_sync/jobs/sync_rubric_associations_job.rb +15 -0
- data/lib/canvas_sync/jobs/sync_rubrics_job.rb +15 -0
- data/lib/canvas_sync/jobs/sync_simple_table_job.rb +11 -32
- data/lib/canvas_sync/jobs/sync_submissions_job.rb +6 -4
- data/lib/canvas_sync/jobs/sync_terms_job.rb +9 -8
- data/lib/canvas_sync/jobs/term_batches_job.rb +50 -0
- data/lib/canvas_sync/{generators/templates/services/live_events/base_event.rb → live_events/base_handler.rb} +6 -10
- data/lib/canvas_sync/live_events/process_event_job.rb +26 -0
- data/lib/canvas_sync/live_events.rb +38 -0
- data/lib/canvas_sync/misc_helper.rb +63 -0
- data/lib/canvas_sync/processors/assignment_groups_processor.rb +3 -8
- data/lib/canvas_sync/processors/assignments_processor.rb +3 -8
- data/lib/canvas_sync/processors/content_migrations_processor.rb +19 -0
- data/lib/canvas_sync/processors/context_module_items_processor.rb +3 -8
- data/lib/canvas_sync/processors/context_modules_processor.rb +3 -8
- data/lib/canvas_sync/processors/model_mappings.yml +420 -0
- data/lib/canvas_sync/processors/normal_processor.rb +3 -3
- data/lib/canvas_sync/processors/provisioning_report_processor.rb +42 -55
- data/lib/canvas_sync/processors/report_processor.rb +15 -9
- data/lib/canvas_sync/processors/rubric_assessments_processor.rb +19 -0
- data/lib/canvas_sync/processors/rubric_associations_processor.rb +19 -0
- data/lib/canvas_sync/processors/rubrics_processor.rb +19 -0
- data/lib/canvas_sync/processors/submissions_processor.rb +3 -8
- data/lib/canvas_sync/record.rb +103 -0
- data/lib/canvas_sync/version.rb +1 -1
- data/lib/canvas_sync.rb +124 -125
- data/spec/canvas_sync/canvas_sync_spec.rb +224 -155
- data/spec/canvas_sync/jobs/canvas_process_waiter_spec.rb +34 -0
- data/spec/canvas_sync/jobs/job_spec.rb +9 -17
- data/spec/canvas_sync/jobs/report_checker_spec.rb +1 -3
- data/spec/canvas_sync/jobs/report_processor_job_spec.rb +0 -3
- data/spec/canvas_sync/jobs/report_starter_spec.rb +19 -28
- data/spec/canvas_sync/jobs/sync_admins_job_spec.rb +1 -4
- data/spec/canvas_sync/jobs/sync_assignment_groups_job_spec.rb +2 -1
- data/spec/canvas_sync/jobs/sync_assignments_job_spec.rb +3 -2
- data/spec/canvas_sync/jobs/sync_content_migrations_job_spec.rb +30 -0
- data/spec/canvas_sync/jobs/sync_context_module_items_job_spec.rb +3 -2
- data/spec/canvas_sync/jobs/sync_context_modules_job_spec.rb +3 -2
- data/spec/canvas_sync/jobs/sync_provisioning_report_job_spec.rb +7 -41
- data/spec/canvas_sync/jobs/sync_roles_job_spec.rb +1 -4
- data/spec/canvas_sync/jobs/sync_simple_table_job_spec.rb +5 -12
- data/spec/canvas_sync/jobs/sync_submissions_job_spec.rb +8 -2
- data/spec/canvas_sync/jobs/sync_terms_job_spec.rb +1 -4
- data/spec/canvas_sync/live_events/live_event_sync_spec.rb +27 -0
- data/spec/canvas_sync/live_events/live_events_controller_spec.rb +54 -0
- data/spec/canvas_sync/live_events/process_event_job_spec.rb +38 -0
- data/spec/canvas_sync/misc_helper_spec.rb +58 -0
- data/spec/canvas_sync/models/assignment_spec.rb +1 -1
- data/spec/canvas_sync/processors/content_migrations_processor_spec.rb +13 -0
- data/spec/canvas_sync/processors/provisioning_report_processor_spec.rb +101 -1
- data/spec/canvas_sync/processors/rubric_assessments_spec.rb +16 -0
- data/spec/canvas_sync/processors/rubric_associations_spec.rb +16 -0
- data/spec/canvas_sync/processors/rubrics_processor_spec.rb +17 -0
- data/spec/dummy/app/models/account.rb +6 -0
- data/spec/dummy/app/models/admin.rb +2 -0
- data/spec/dummy/app/models/assignment.rb +3 -0
- data/spec/dummy/app/models/assignment_group.rb +3 -0
- data/spec/dummy/app/models/content_migration.rb +18 -0
- data/spec/dummy/app/models/context_module.rb +3 -0
- data/spec/dummy/app/models/context_module_item.rb +3 -0
- data/spec/dummy/app/models/course.rb +11 -0
- data/spec/dummy/app/models/course_nickname.rb +19 -0
- data/spec/dummy/app/models/enrollment.rb +14 -0
- data/spec/dummy/app/models/grading_period.rb +16 -0
- data/spec/dummy/app/models/grading_period_group.rb +15 -0
- data/spec/dummy/app/models/group.rb +2 -0
- data/spec/dummy/app/models/group_membership.rb +2 -0
- data/spec/dummy/app/models/learning_outcome.rb +30 -0
- data/spec/dummy/app/models/learning_outcome_result.rb +54 -0
- data/spec/dummy/app/models/pseudonym.rb +16 -0
- data/spec/dummy/app/models/role.rb +2 -0
- data/spec/dummy/app/models/rubric.rb +35 -0
- data/spec/dummy/app/models/rubric_assessment.rb +22 -0
- data/spec/dummy/app/models/rubric_association.rb +20 -0
- data/spec/dummy/app/models/section.rb +9 -0
- data/spec/dummy/app/models/submission.rb +4 -0
- data/spec/dummy/app/models/term.rb +3 -0
- data/spec/dummy/app/models/user.rb +11 -0
- data/spec/dummy/app/models/user_observer.rb +19 -0
- data/spec/dummy/app/services/live_events/assignment_event.rb +1 -1
- data/spec/dummy/app/services/live_events/course_event.rb +1 -3
- data/spec/dummy/app/services/live_events/course_section_event.rb +1 -1
- data/spec/dummy/app/services/live_events/enrollment_event.rb +1 -1
- data/spec/dummy/app/services/live_events/grade_event.rb +1 -1
- data/spec/dummy/app/services/live_events/module_event.rb +1 -1
- data/spec/dummy/app/services/live_events/module_item_event.rb +1 -1
- data/spec/dummy/app/services/live_events/submission_event.rb +1 -1
- data/spec/dummy/app/services/live_events/syllabus_event.rb +1 -1
- data/spec/dummy/app/services/live_events/user_event.rb +1 -3
- data/spec/dummy/config/environments/test.rb +2 -0
- data/spec/dummy/config/routes.rb +1 -0
- data/spec/dummy/db/migrate/20201016181346_create_pseudonyms.rb +24 -0
- data/spec/dummy/db/migrate/20210907233329_create_user_observers.rb +23 -0
- data/spec/dummy/db/migrate/20210907233330_create_grading_periods.rb +28 -0
- data/spec/dummy/db/migrate/20211001184920_create_grading_period_groups.rb +24 -0
- data/spec/dummy/db/migrate/20220308072643_create_content_migrations.rb +30 -0
- data/spec/dummy/db/migrate/20220712210559_create_learning_outcomes.rb +36 -0
- data/spec/dummy/db/migrate/{20190702203620_create_users.rb → 20220926221926_create_users.rb} +0 -1
- data/spec/dummy/db/migrate/20240408223326_create_course_nicknames.rb +23 -0
- data/spec/dummy/db/migrate/20240509105100_create_rubrics.rb +44 -0
- data/spec/dummy/db/migrate/20240510094100_create_rubric_associations.rb +42 -0
- data/spec/dummy/db/migrate/20240510101100_create_rubric_assessments.rb +37 -0
- data/spec/dummy/db/migrate/20240523101010_create_learning_outcome_results.rb +52 -0
- data/spec/dummy/db/schema.rb +244 -5
- data/spec/factories/user_factory.rb +0 -1
- data/spec/job_batching/active_job_spec.rb +107 -0
- data/spec/job_batching/batch_spec.rb +489 -0
- data/spec/job_batching/callback_spec.rb +38 -0
- data/spec/job_batching/context_hash_spec.rb +54 -0
- data/spec/job_batching/flow_spec.rb +82 -0
- data/spec/job_batching/integration/fail_then_succeed.rb +42 -0
- data/spec/job_batching/integration/integration.rb +57 -0
- data/spec/job_batching/integration/nested.rb +88 -0
- data/spec/job_batching/integration/simple.rb +47 -0
- data/spec/job_batching/integration/workflow.rb +134 -0
- data/spec/job_batching/integration_helper.rb +50 -0
- data/spec/job_batching/pool_spec.rb +161 -0
- data/spec/job_batching/sidekiq_spec.rb +125 -0
- data/spec/job_batching/status_spec.rb +76 -0
- data/spec/job_batching/support/base_job.rb +14 -0
- data/spec/job_batching/support/sample_callback.rb +2 -0
- data/spec/spec_helper.rb +17 -0
- data/spec/support/fixtures/reports/content_migrations.csv +3 -0
- data/spec/support/fixtures/reports/course_nicknames.csv +3 -0
- data/spec/support/fixtures/reports/grading_period_groups.csv +2 -0
- data/spec/support/fixtures/reports/grading_periods.csv +3 -0
- data/spec/support/fixtures/reports/learning_outcome_results.csv +3 -0
- data/spec/support/fixtures/reports/learning_outcomes.csv +3 -0
- data/spec/support/fixtures/reports/provisioning_csv_unzipped/courses.csv +3 -0
- data/spec/support/fixtures/reports/provisioning_csv_unzipped/users.csv +4 -0
- data/spec/support/fixtures/reports/rubric_assessments.csv +3 -0
- data/spec/support/fixtures/reports/rubric_associations.csv +3 -0
- data/spec/support/fixtures/reports/rubrics.csv +3 -0
- data/spec/support/fixtures/reports/user_observers.csv +3 -0
- data/spec/support/fixtures/reports/users.csv +3 -2
- data/spec/support/fixtures/reports/xlist.csv +1 -1
- metadata +329 -27
- data/app/controllers/api/v1/live_events_controller.rb +0 -18
- data/lib/canvas_sync/job_chain.rb +0 -57
- data/lib/canvas_sync/jobs/fork_gather.rb +0 -59
- data/spec/canvas_sync/jobs/fork_gather_spec.rb +0 -73
data/spec/dummy/db/schema.rb
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
#
|
11
11
|
# It's strongly recommended that you check this file into your version control system.
|
12
12
|
|
13
|
-
ActiveRecord::Schema.define(version:
|
13
|
+
ActiveRecord::Schema.define(version: 2024_05_23_101010) do
|
14
14
|
|
15
15
|
# These are extensions that must be enabled in order to support this database
|
16
16
|
enable_extension "plpgsql"
|
@@ -83,7 +83,7 @@ ActiveRecord::Schema.define(version: 2020_04_16_214248) do
|
|
83
83
|
t.index ["canvas_id"], name: "index_assignments_on_canvas_id", unique: true
|
84
84
|
end
|
85
85
|
|
86
|
-
create_table "canvas_sync_job_logs", force: :cascade do |t|
|
86
|
+
create_table "canvas_sync_job_logs", id: :serial, force: :cascade do |t|
|
87
87
|
t.datetime "started_at"
|
88
88
|
t.datetime "completed_at"
|
89
89
|
t.string "exception"
|
@@ -92,13 +92,42 @@ ActiveRecord::Schema.define(version: 2020_04_16_214248) do
|
|
92
92
|
t.string "status"
|
93
93
|
t.text "metadata"
|
94
94
|
t.text "job_arguments"
|
95
|
-
t.datetime "created_at"
|
96
|
-
t.datetime "updated_at"
|
95
|
+
t.datetime "created_at"
|
96
|
+
t.datetime "updated_at"
|
97
97
|
t.string "job_id"
|
98
98
|
t.integer "fork_count"
|
99
99
|
t.index ["job_id"], name: "index_canvas_sync_job_logs_on_job_id"
|
100
100
|
end
|
101
101
|
|
102
|
+
create_table "canvas_sync_sync_batches", id: :serial, force: :cascade do |t|
|
103
|
+
t.datetime "started_at"
|
104
|
+
t.datetime "completed_at"
|
105
|
+
t.string "status"
|
106
|
+
t.datetime "created_at"
|
107
|
+
t.datetime "updated_at"
|
108
|
+
t.boolean "full_sync", default: false
|
109
|
+
t.string "batch_genre"
|
110
|
+
t.string "batch_bid"
|
111
|
+
end
|
112
|
+
|
113
|
+
create_table "content_migrations", force: :cascade do |t|
|
114
|
+
t.bigint "canvas_id"
|
115
|
+
t.bigint "canvas_context_id"
|
116
|
+
t.string "canvas_context_type"
|
117
|
+
t.string "workflow_state"
|
118
|
+
t.text "migration_settings"
|
119
|
+
t.datetime "started_at"
|
120
|
+
t.datetime "finished_at"
|
121
|
+
t.float "progress"
|
122
|
+
t.bigint "canvas_source_course_id"
|
123
|
+
t.string "migration_type"
|
124
|
+
t.bigint "canvas_child_subscription_id"
|
125
|
+
t.bigint "canvas_root_account_id"
|
126
|
+
t.datetime "created_at", null: false
|
127
|
+
t.datetime "updated_at", null: false
|
128
|
+
t.index ["canvas_id"], name: "index_content_migrations_on_canvas_id", unique: true
|
129
|
+
end
|
130
|
+
|
102
131
|
create_table "context_module_items", force: :cascade do |t|
|
103
132
|
t.bigint "canvas_id"
|
104
133
|
t.bigint "canvas_context_module_id"
|
@@ -128,6 +157,17 @@ ActiveRecord::Schema.define(version: 2020_04_16_214248) do
|
|
128
157
|
t.index ["canvas_id"], name: "index_context_modules_on_canvas_id", unique: true
|
129
158
|
end
|
130
159
|
|
160
|
+
create_table "course_nicknames", force: :cascade do |t|
|
161
|
+
t.bigint "canvas_user_preference_value_id", null: false
|
162
|
+
t.integer "canvas_user_id"
|
163
|
+
t.integer "canvas_course_id"
|
164
|
+
t.string "nickname"
|
165
|
+
t.datetime "created_at", null: false
|
166
|
+
t.datetime "updated_at", null: false
|
167
|
+
t.index ["canvas_course_id", "canvas_user_id"], name: "index_course_nicknames_on_canvas_course_id_and_canvas_user_id", unique: true
|
168
|
+
t.index ["canvas_user_preference_value_id"], name: "index_course_nicknames_on_canvas_user_preference_value_id", unique: true
|
169
|
+
end
|
170
|
+
|
131
171
|
create_table "courses", force: :cascade do |t|
|
132
172
|
t.bigint "canvas_id", null: false
|
133
173
|
t.string "sis_id"
|
@@ -162,6 +202,32 @@ ActiveRecord::Schema.define(version: 2020_04_16_214248) do
|
|
162
202
|
t.index ["canvas_user_id"], name: "index_enrollments_on_canvas_user_id"
|
163
203
|
end
|
164
204
|
|
205
|
+
create_table "grading_period_groups", force: :cascade do |t|
|
206
|
+
t.bigint "canvas_id", null: false
|
207
|
+
t.string "title"
|
208
|
+
t.boolean "weighted"
|
209
|
+
t.boolean "display_totals_for_all_grading_periods"
|
210
|
+
t.string "workflow_state"
|
211
|
+
t.datetime "created_at", null: false
|
212
|
+
t.datetime "updated_at", null: false
|
213
|
+
t.index ["canvas_id"], name: "index_grading_period_groups_on_canvas_id", unique: true
|
214
|
+
end
|
215
|
+
|
216
|
+
create_table "grading_periods", force: :cascade do |t|
|
217
|
+
t.bigint "canvas_id", null: false
|
218
|
+
t.string "title"
|
219
|
+
t.float "weight"
|
220
|
+
t.datetime "start_date"
|
221
|
+
t.datetime "end_date"
|
222
|
+
t.datetime "close_date"
|
223
|
+
t.bigint "canvas_grading_period_group_id"
|
224
|
+
t.string "workflow_state"
|
225
|
+
t.datetime "created_at", null: false
|
226
|
+
t.datetime "updated_at", null: false
|
227
|
+
t.index ["canvas_grading_period_group_id"], name: "index_grading_periods_on_canvas_grading_period_group_id"
|
228
|
+
t.index ["canvas_id"], name: "index_grading_periods_on_canvas_id", unique: true
|
229
|
+
end
|
230
|
+
|
165
231
|
create_table "group_memberships", force: :cascade do |t|
|
166
232
|
t.bigint "canvas_id", null: false
|
167
233
|
t.bigint "canvas_user_id", null: false
|
@@ -191,6 +257,82 @@ ActiveRecord::Schema.define(version: 2020_04_16_214248) do
|
|
191
257
|
t.index ["canvas_id"], name: "index_groups_on_canvas_id", unique: true
|
192
258
|
end
|
193
259
|
|
260
|
+
create_table "learning_outcomes", force: :cascade do |t|
|
261
|
+
t.bigint "canvas_id", null: false
|
262
|
+
t.integer "canvas_context_id"
|
263
|
+
t.string "canvas_context_type"
|
264
|
+
t.string "name"
|
265
|
+
t.string "friendly_name"
|
266
|
+
t.string "workflow_state"
|
267
|
+
t.datetime "canvas_created_at"
|
268
|
+
t.datetime "canvas_updated_at"
|
269
|
+
t.string "migration_id"
|
270
|
+
t.string "vendor_guid"
|
271
|
+
t.string "low_grade"
|
272
|
+
t.string "high_grade"
|
273
|
+
t.string "calculation_method"
|
274
|
+
t.string "calculation_int"
|
275
|
+
t.integer "outcome_import_id"
|
276
|
+
t.integer "root_account_ids", default: [], array: true
|
277
|
+
t.text "description"
|
278
|
+
t.datetime "created_at", null: false
|
279
|
+
t.datetime "updated_at", null: false
|
280
|
+
t.index ["canvas_context_id", "canvas_context_type"], name: "index_learning_outcomes_on_context"
|
281
|
+
t.index ["canvas_id"], name: "index_learning_outcomes_on_canvas_id", unique: true
|
282
|
+
end
|
283
|
+
|
284
|
+
create_table "learning_outcome_results", force: :cascade do |t|
|
285
|
+
t.bigint "canvas_id", null: false
|
286
|
+
t.bigint "canvas_context_id"
|
287
|
+
t.string "canvas_context_type"
|
288
|
+
t.bigint "canvas_association_id"
|
289
|
+
t.string "canvas_association_type"
|
290
|
+
t.bigint "canvas_content_tag_id"
|
291
|
+
t.bigint "canvas_learning_outcome_id"
|
292
|
+
t.bigint "canvas_user_id"
|
293
|
+
t.boolean "mastery"
|
294
|
+
t.boolean "original_mastery"
|
295
|
+
t.bigint "canvas_artifact_id"
|
296
|
+
t.string "canvas_artifact_type"
|
297
|
+
t.datetime "assessed_at"
|
298
|
+
t.string "title"
|
299
|
+
t.float "percent"
|
300
|
+
t.bigint "canvas_associated_asset_id"
|
301
|
+
t.string "canvas_associated_asset_type"
|
302
|
+
t.integer "attempt"
|
303
|
+
t.float "score"
|
304
|
+
t.float "possible"
|
305
|
+
t.float "original_score"
|
306
|
+
t.float "original_possible"
|
307
|
+
t.string "workflow_state"
|
308
|
+
t.datetime "created_at", null: false
|
309
|
+
t.datetime "updated_at", null: false
|
310
|
+
t.index "canvas_id", unique: true
|
311
|
+
t.index [
|
312
|
+
"canvas_user_id",
|
313
|
+
"canvas_content_tag_id",
|
314
|
+
"canvas_association_id",
|
315
|
+
"canvas_association_type",
|
316
|
+
"canvas_associated_asset_id",
|
317
|
+
"canvas_associated_asset_type"
|
318
|
+
], unique: true, name: 'index_learning_outcome_results_association'
|
319
|
+
t.index "canvas_content_tag_id"
|
320
|
+
t.index "canvas_learning_outcome_id"
|
321
|
+
t.index ["canvas_artifact_id", "canvas_artifact_type"], name: "index_learning_outcome_results_on_canvas_arid_and_artype"
|
322
|
+
end
|
323
|
+
|
324
|
+
create_table "pseudonyms", force: :cascade do |t|
|
325
|
+
t.bigint "canvas_id", null: false
|
326
|
+
t.bigint "canvas_user_id"
|
327
|
+
t.string "sis_id"
|
328
|
+
t.string "unique_id"
|
329
|
+
t.string "workflow_state"
|
330
|
+
t.datetime "created_at", null: false
|
331
|
+
t.datetime "updated_at", null: false
|
332
|
+
t.index ["canvas_id"], name: "index_pseudonyms_on_canvas_id", unique: true
|
333
|
+
t.index ["canvas_user_id"], name: "index_pseudonyms_on_canvas_user_id"
|
334
|
+
end
|
335
|
+
|
194
336
|
create_table "roles", force: :cascade do |t|
|
195
337
|
t.integer "canvas_id", null: false
|
196
338
|
t.string "label"
|
@@ -204,6 +346,93 @@ ActiveRecord::Schema.define(version: 2020_04_16_214248) do
|
|
204
346
|
t.index ["canvas_id"], name: "index_roles_on_canvas_id", unique: true
|
205
347
|
end
|
206
348
|
|
349
|
+
create_table "rubrics", force: :cascade do |t|
|
350
|
+
t.bigint "canvas_id", null: false
|
351
|
+
t.bigint "canvas_user_id"
|
352
|
+
t.bigint "canvas_rubric_id"
|
353
|
+
t.bigint "canvas_context_id"
|
354
|
+
t.string "canvas_context_type"
|
355
|
+
t.text "data"
|
356
|
+
t.float "points_possible"
|
357
|
+
t.string "title"
|
358
|
+
t.text "description"
|
359
|
+
t.boolean "reusable"
|
360
|
+
t.boolean "public"
|
361
|
+
t.boolean "read_only"
|
362
|
+
t.integer "association_count"
|
363
|
+
t.boolean "free_form_criterion_comments"
|
364
|
+
t.string "context_code"
|
365
|
+
t.string "migration_id"
|
366
|
+
t.boolean "hide_score_total"
|
367
|
+
t.string "workflow_state"
|
368
|
+
t.bigint "canvas_root_account_id"
|
369
|
+
t.boolean "hide_points"
|
370
|
+
t.string "rating_order"
|
371
|
+
t.string "button_display"
|
372
|
+
t.datetime "created_at", null: false
|
373
|
+
t.datetime "updated_at", null: false
|
374
|
+
t.index "canvas_id", name: "index_rubrics_on_canvas_id", unique: true
|
375
|
+
t.index ["canvas_context_id", "canvas_context_type"], name: "index_rubrics_on_canvas_context_id_and_canvas_context_type"
|
376
|
+
t.index "canvas_rubric_id", name: "index_rubrics_on_canvas_rubric_id"
|
377
|
+
t.index "canvas_user_id", name: "index_rubrics_on_canvas_user_id"
|
378
|
+
t.index "canvas_root_account_id", name: "index_rubrics_on_canvas_root_account_id"
|
379
|
+
end
|
380
|
+
|
381
|
+
create_table "rubric_associations", force: :cascade do |t|
|
382
|
+
t.integer "canvas_id", null: false
|
383
|
+
t.integer "canvas_rubric_id"
|
384
|
+
t.integer "canvas_association_id"
|
385
|
+
t.string "canvas_association_type"
|
386
|
+
t.boolean "use_for_grading"
|
387
|
+
t.datetime "created_at"
|
388
|
+
t.datetime "updated_at"
|
389
|
+
t.string "title"
|
390
|
+
t.text "description"
|
391
|
+
t.text "summary_data"
|
392
|
+
t.string "purpose"
|
393
|
+
t.string "url"
|
394
|
+
t.integer "canvas_context_id"
|
395
|
+
t.string "canvas_context_type"
|
396
|
+
t.boolean "hide_score_total"
|
397
|
+
t.string "context_code"
|
398
|
+
t.boolean "bookmarked"
|
399
|
+
t.boolean "hide_points"
|
400
|
+
t.boolean "hide_outcome_results"
|
401
|
+
t.bigint "canvas_root_account_id"
|
402
|
+
t.string "workflow_state"
|
403
|
+
t.index ["canvas_id"], name: "index_rubric_associations_on_canvas_id", unique: true
|
404
|
+
t.index ["canvas_association_id", "canvas_association_type"], name: "index_rubric_associations_on_canvas_aid_and_canvas_atype"
|
405
|
+
t.index ["context_code"], name: "index_rubric_associations_on_context_code"
|
406
|
+
t.index ["canvas_context_id", "canvas_context_type"], name: "index_rubric_associations_on_canvas_cid_and_canvas_ctype"
|
407
|
+
t.index ["canvas_rubric_id"], name: "index_rubric_associations_on_canvas_rubric_id"
|
408
|
+
t.index ["canvas_root_account_id"], name: "index_rubric_associations_on_canvas_root_account_id"
|
409
|
+
end
|
410
|
+
|
411
|
+
create_table "rubric_assessments", force: :cascade do |t|
|
412
|
+
t.bigint "canvas_id"
|
413
|
+
t.bigint "canvas_user_id"
|
414
|
+
t.bigint "canvas_rubric_id"
|
415
|
+
t.bigint "canvas_rubric_association_id"
|
416
|
+
t.float "score"
|
417
|
+
t.text "data"
|
418
|
+
t.datetime "created_at"
|
419
|
+
t.datetime "updated_at"
|
420
|
+
t.bigint "canvas_artifact_id"
|
421
|
+
t.string "canvas_artifact_type"
|
422
|
+
t.string "assessment_type"
|
423
|
+
t.bigint "canvas_assessor_id"
|
424
|
+
t.integer "artifact_attempt"
|
425
|
+
t.boolean "hide_points"
|
426
|
+
t.bigint "canvas_root_account_id"
|
427
|
+
t.index ["canvas_id"], name: "index_rubric_assessments_on_canvas_id", unique: true
|
428
|
+
t.index ["canvas_artifact_id", "canvas_artifact_type"], name: "index_rubric_assessments_on_canvas_aid_and_canvas_atype"
|
429
|
+
t.index ["canvas_assessor_id"], name: "index_rubric_assessments_on_canvas_assessor_id"
|
430
|
+
t.index ["canvas_rubric_association_id"], name: "index_rubric_assessments_on_canvas_rubric_association_id"
|
431
|
+
t.index ["canvas_rubric_id"], name: "index_rubric_assessments_on_canvas_rubric_id"
|
432
|
+
t.index ["canvas_user_id"], name: "index_rubric_assessments_on_canvas_user_id"
|
433
|
+
t.index ["canvas_root_account_id"], name: "index_rubric_assessments_on_canvas_root_account_id"
|
434
|
+
end
|
435
|
+
|
207
436
|
create_table "sections", force: :cascade do |t|
|
208
437
|
t.bigint "canvas_id", null: false
|
209
438
|
t.string "sis_id"
|
@@ -252,9 +481,19 @@ ActiveRecord::Schema.define(version: 2020_04_16_214248) do
|
|
252
481
|
t.index ["canvas_id"], name: "index_terms_on_canvas_id", unique: true
|
253
482
|
end
|
254
483
|
|
484
|
+
create_table "user_observers", force: :cascade do |t|
|
485
|
+
t.bigint "observing_user_id"
|
486
|
+
t.bigint "observed_user_id"
|
487
|
+
t.string "workflow_state"
|
488
|
+
t.datetime "created_at", null: false
|
489
|
+
t.datetime "updated_at", null: false
|
490
|
+
t.index ["observed_user_id", "observing_user_id"], name: "index_user_observers_on_observed_user_id_and_observing_user_id", unique: true
|
491
|
+
t.index ["observed_user_id"], name: "index_user_observers_on_observed_user_id"
|
492
|
+
t.index ["observing_user_id"], name: "index_user_observers_on_observing_user_id"
|
493
|
+
end
|
494
|
+
|
255
495
|
create_table "users", force: :cascade do |t|
|
256
496
|
t.bigint "canvas_id", null: false
|
257
|
-
t.string "sis_id"
|
258
497
|
t.string "email"
|
259
498
|
t.string "first_name"
|
260
499
|
t.string "last_name"
|
@@ -0,0 +1,107 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe CanvasSync::JobBatches::ActiveJob do
|
4
|
+
describe CanvasSync::JobBatches::ActiveJob::BatchAwareJob do
|
5
|
+
include ActiveJob::TestHelper
|
6
|
+
|
7
|
+
after do
|
8
|
+
clear_enqueued_jobs
|
9
|
+
clear_performed_jobs
|
10
|
+
end
|
11
|
+
|
12
|
+
context "When Performing" do
|
13
|
+
context 'when without batch' do
|
14
|
+
it 'just yields' do
|
15
|
+
expect(CanvasSync::JobBatches::Batch).not_to receive(:process_successful_job)
|
16
|
+
expect(CanvasSync::JobBatches::Batch).not_to receive(:process_failed_job)
|
17
|
+
expect_any_instance_of(BatchTestJobBase).to receive(:perform)
|
18
|
+
|
19
|
+
BatchTestJobBase.perform_now
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
context 'when in batch' do
|
24
|
+
let(:bid) { 'SAMPLEBID' }
|
25
|
+
|
26
|
+
context 'when successful' do
|
27
|
+
it 'yields' do
|
28
|
+
expect_any_instance_of(BatchTestJobBase).to receive(:perform)
|
29
|
+
BatchTestJobBase.perform_now
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'calls process_successful_job' do
|
33
|
+
job = BatchTestJobBase.new
|
34
|
+
job.instance_variable_set(:@bid, bid)
|
35
|
+
expect(CanvasSync::JobBatches::Batch).to receive(:process_successful_job).with(bid, job.job_id)
|
36
|
+
job.perform_now
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
context 'when failed' do
|
41
|
+
it 'calls process_failed_job and reraises exception' do
|
42
|
+
reraised = false
|
43
|
+
job = FailingBatchTestJobBase.new
|
44
|
+
job.instance_variable_set(:@bid, bid)
|
45
|
+
expect(CanvasSync::JobBatches::Batch).to receive(:process_failed_job)
|
46
|
+
begin
|
47
|
+
job.perform_now
|
48
|
+
rescue
|
49
|
+
reraised = true
|
50
|
+
end
|
51
|
+
expect(reraised).to be_truthy
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
context "When Enqueueing" do
|
58
|
+
context 'when without batch' do
|
59
|
+
it 'just yields' do
|
60
|
+
expect(CanvasSync::JobBatches::Batch).not_to receive(:increment_job_queue)
|
61
|
+
BatchTestJobBase.perform_later
|
62
|
+
expect(BatchTestJobBase).to have_been_enqueued
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
context 'when in batch' do
|
67
|
+
let(:bid) { 'SAMPLEBID' }
|
68
|
+
|
69
|
+
before do
|
70
|
+
Thread.current[CanvasSync::JobBatches::CURRENT_BATCH_THREAD_KEY] = CanvasSync::JobBatches::Batch.new(bid)
|
71
|
+
Thread.current[CanvasSync::JobBatches::CURRENT_BATCH_THREAD_KEY].instance_variable_set(:@open, true)
|
72
|
+
end
|
73
|
+
after { Thread.current[CanvasSync::JobBatches::CURRENT_BATCH_THREAD_KEY] = nil }
|
74
|
+
|
75
|
+
it 'yields' do
|
76
|
+
expect {
|
77
|
+
BatchTestJobBase.perform_later
|
78
|
+
}.to enqueue_job(BatchTestJobBase)
|
79
|
+
end
|
80
|
+
|
81
|
+
it 'assigns bid to job metadata' do
|
82
|
+
job = BatchTestJobBase.perform_later
|
83
|
+
expect(job.bid).to eq bid
|
84
|
+
expect(job.serialize['batch_id']).to eq bid
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
context 'worker' do
|
90
|
+
it 'defines method bid' do
|
91
|
+
expect(ActiveJob::Base.instance_methods).to include(:bid)
|
92
|
+
end
|
93
|
+
|
94
|
+
it 'defines method batch' do
|
95
|
+
expect(ActiveJob::Base.instance_methods).to include(:batch)
|
96
|
+
end
|
97
|
+
|
98
|
+
it 'defines method valid_within_batch?' do
|
99
|
+
expect(ActiveJob::Base.instance_methods).to include(:valid_within_batch?)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
describe ".handle_job_death" do
|
105
|
+
|
106
|
+
end
|
107
|
+
end
|