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.
Files changed (260) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +235 -151
  3. data/app/controllers/{api → canvas_sync/api}/v1/health_check_controller.rb +1 -1
  4. data/app/controllers/canvas_sync/api/v1/live_events_controller.rb +122 -0
  5. data/app/models/canvas_sync/sync_batch.rb +5 -0
  6. data/config/initializers/apartment.rb +10 -1
  7. data/config/routes.rb +7 -0
  8. data/db/migrate/20170915210836_create_canvas_sync_job_log.rb +12 -31
  9. data/db/migrate/20180725155729_add_job_id_to_canvas_sync_job_logs.rb +4 -13
  10. data/db/migrate/20190916154829_add_fork_count_to_canvas_sync_job_logs.rb +3 -11
  11. data/db/migrate/20201018210836_create_canvas_sync_sync_batches.rb +11 -0
  12. data/db/migrate/20201030210836_add_full_sync_to_canvas_sync_sync_batch.rb +7 -0
  13. data/lib/canvas_sync/batch_processor.rb +41 -0
  14. data/lib/canvas_sync/concerns/ability_helper.rb +72 -0
  15. data/lib/canvas_sync/concerns/account/ancestry.rb +2 -0
  16. data/lib/canvas_sync/concerns/account/base.rb +15 -0
  17. data/lib/canvas_sync/concerns/api_syncable.rb +17 -10
  18. data/lib/canvas_sync/concerns/live_event_sync.rb +46 -0
  19. data/lib/canvas_sync/concerns/role/base.rb +57 -0
  20. data/lib/canvas_sync/concerns/sync_mapping.rb +120 -0
  21. data/lib/canvas_sync/engine.rb +80 -0
  22. data/lib/canvas_sync/generators/install_generator.rb +1 -0
  23. data/lib/canvas_sync/generators/install_live_events_generator.rb +0 -1
  24. data/lib/canvas_sync/generators/templates/migrations/create_content_migrations.rb +24 -0
  25. data/lib/canvas_sync/generators/templates/migrations/create_course_nicknames.rb +17 -0
  26. data/lib/canvas_sync/generators/templates/migrations/create_grading_period_groups.rb +18 -0
  27. data/lib/canvas_sync/generators/templates/migrations/create_grading_periods.rb +22 -0
  28. data/lib/canvas_sync/generators/templates/migrations/create_learning_outcome_results.rb +46 -0
  29. data/lib/canvas_sync/generators/templates/migrations/create_learning_outcomes.rb +30 -0
  30. data/lib/canvas_sync/generators/templates/migrations/create_rubric_assessments.rb +31 -0
  31. data/lib/canvas_sync/generators/templates/migrations/create_rubric_associations.rb +36 -0
  32. data/lib/canvas_sync/generators/templates/migrations/create_rubrics.rb +38 -0
  33. data/lib/canvas_sync/generators/templates/migrations/create_user_observers.rb +17 -0
  34. data/lib/canvas_sync/generators/templates/migrations/create_users.rb +0 -1
  35. data/lib/canvas_sync/generators/templates/models/account.rb +3 -0
  36. data/lib/canvas_sync/generators/templates/models/admin.rb +2 -0
  37. data/lib/canvas_sync/generators/templates/models/assignment.rb +3 -0
  38. data/lib/canvas_sync/generators/templates/models/assignment_group.rb +3 -0
  39. data/lib/canvas_sync/generators/templates/models/content_migration.rb +12 -0
  40. data/lib/canvas_sync/generators/templates/models/context_module.rb +3 -0
  41. data/lib/canvas_sync/generators/templates/models/context_module_item.rb +3 -0
  42. data/lib/canvas_sync/generators/templates/models/course.rb +11 -0
  43. data/lib/canvas_sync/generators/templates/models/course_nickname.rb +13 -0
  44. data/lib/canvas_sync/generators/templates/models/enrollment.rb +14 -0
  45. data/lib/canvas_sync/generators/templates/models/grading_period.rb +10 -0
  46. data/lib/canvas_sync/generators/templates/models/grading_period_group.rb +9 -0
  47. data/lib/canvas_sync/generators/templates/models/group.rb +2 -0
  48. data/lib/canvas_sync/generators/templates/models/group_membership.rb +2 -0
  49. data/lib/canvas_sync/generators/templates/models/learning_outcome.rb +24 -0
  50. data/lib/canvas_sync/generators/templates/models/learning_outcome_result.rb +48 -0
  51. data/lib/canvas_sync/generators/templates/models/pseudonym.rb +2 -0
  52. data/lib/canvas_sync/generators/templates/models/role.rb +2 -0
  53. data/lib/canvas_sync/generators/templates/models/rubric.rb +29 -0
  54. data/lib/canvas_sync/generators/templates/models/rubric_assessment.rb +17 -0
  55. data/lib/canvas_sync/generators/templates/models/rubric_association.rb +14 -0
  56. data/lib/canvas_sync/generators/templates/models/section.rb +9 -0
  57. data/lib/canvas_sync/generators/templates/models/submission.rb +3 -0
  58. data/lib/canvas_sync/generators/templates/models/term.rb +3 -0
  59. data/lib/canvas_sync/generators/templates/models/user.rb +11 -0
  60. data/lib/canvas_sync/generators/templates/models/user_observer.rb +13 -0
  61. data/lib/canvas_sync/generators/templates/services/live_events/assignment_event.rb +1 -1
  62. data/lib/canvas_sync/generators/templates/services/live_events/assignment_group_event.rb +1 -1
  63. data/lib/canvas_sync/generators/templates/services/live_events/course_event.rb +1 -3
  64. data/lib/canvas_sync/generators/templates/services/live_events/course_section_event.rb +1 -1
  65. data/lib/canvas_sync/generators/templates/services/live_events/enrollment_event.rb +1 -1
  66. data/lib/canvas_sync/generators/templates/services/live_events/grade_event.rb +1 -1
  67. data/lib/canvas_sync/generators/templates/services/live_events/module_event.rb +1 -1
  68. data/lib/canvas_sync/generators/templates/services/live_events/module_item_event.rb +1 -1
  69. data/lib/canvas_sync/generators/templates/services/live_events/submission_event.rb +1 -1
  70. data/lib/canvas_sync/generators/templates/services/live_events/syllabus_event.rb +1 -1
  71. data/lib/canvas_sync/generators/templates/services/live_events/user_event.rb +1 -3
  72. data/lib/canvas_sync/importers/bulk_importer.rb +138 -31
  73. data/lib/canvas_sync/job.rb +7 -5
  74. data/lib/canvas_sync/job_batches/active_job.rb +108 -0
  75. data/lib/canvas_sync/job_batches/batch.rb +543 -0
  76. data/lib/canvas_sync/job_batches/callback.rb +149 -0
  77. data/lib/canvas_sync/job_batches/chain_builder.rb +249 -0
  78. data/lib/canvas_sync/job_batches/context_hash.rb +159 -0
  79. data/lib/canvas_sync/job_batches/hier_batch_ids.lua +25 -0
  80. data/lib/canvas_sync/job_batches/jobs/base_job.rb +7 -0
  81. data/lib/canvas_sync/job_batches/jobs/concurrent_batch_job.rb +22 -0
  82. data/lib/canvas_sync/job_batches/jobs/managed_batch_job.rb +170 -0
  83. data/lib/canvas_sync/job_batches/jobs/serial_batch_job.rb +22 -0
  84. data/lib/canvas_sync/job_batches/pool.rb +245 -0
  85. data/lib/canvas_sync/job_batches/pool_refill.lua +47 -0
  86. data/lib/canvas_sync/job_batches/redis_model.rb +69 -0
  87. data/lib/canvas_sync/job_batches/redis_script.rb +163 -0
  88. data/lib/canvas_sync/job_batches/schedule_callback.lua +14 -0
  89. data/lib/canvas_sync/job_batches/sidekiq/web/batches_assets/css/styles.less +182 -0
  90. data/lib/canvas_sync/job_batches/sidekiq/web/batches_assets/js/batch_tree.js +108 -0
  91. data/lib/canvas_sync/job_batches/sidekiq/web/batches_assets/js/util.js +2 -0
  92. data/lib/canvas_sync/job_batches/sidekiq/web/helpers.rb +41 -0
  93. data/lib/canvas_sync/job_batches/sidekiq/web/views/_batch_tree.erb +6 -0
  94. data/lib/canvas_sync/job_batches/sidekiq/web/views/_batches_table.erb +44 -0
  95. data/lib/canvas_sync/job_batches/sidekiq/web/views/_common.erb +13 -0
  96. data/lib/canvas_sync/job_batches/sidekiq/web/views/_jobs_table.erb +21 -0
  97. data/lib/canvas_sync/job_batches/sidekiq/web/views/_pagination.erb +26 -0
  98. data/lib/canvas_sync/job_batches/sidekiq/web/views/batch.erb +81 -0
  99. data/lib/canvas_sync/job_batches/sidekiq/web/views/batches.erb +23 -0
  100. data/lib/canvas_sync/job_batches/sidekiq/web/views/pool.erb +137 -0
  101. data/lib/canvas_sync/job_batches/sidekiq/web/views/pools.erb +47 -0
  102. data/lib/canvas_sync/job_batches/sidekiq/web.rb +218 -0
  103. data/lib/canvas_sync/job_batches/sidekiq.rb +136 -0
  104. data/lib/canvas_sync/job_batches/status.rb +91 -0
  105. data/lib/canvas_sync/jobs/begin_sync_chain_job.rb +99 -0
  106. data/lib/canvas_sync/jobs/canvas_process_waiter.rb +41 -0
  107. data/lib/canvas_sync/jobs/report_checker.rb +70 -8
  108. data/lib/canvas_sync/jobs/report_processor_job.rb +4 -7
  109. data/lib/canvas_sync/jobs/report_starter.rb +34 -20
  110. data/lib/canvas_sync/jobs/sync_accounts_job.rb +3 -5
  111. data/lib/canvas_sync/jobs/sync_admins_job.rb +2 -4
  112. data/lib/canvas_sync/jobs/sync_assignment_groups_job.rb +2 -4
  113. data/lib/canvas_sync/jobs/sync_assignments_job.rb +2 -4
  114. data/lib/canvas_sync/jobs/sync_content_migrations_job.rb +20 -0
  115. data/lib/canvas_sync/jobs/sync_context_module_items_job.rb +2 -4
  116. data/lib/canvas_sync/jobs/sync_context_modules_job.rb +2 -4
  117. data/lib/canvas_sync/jobs/sync_provisioning_report_job.rb +16 -50
  118. data/lib/canvas_sync/jobs/sync_roles_job.rb +2 -5
  119. data/lib/canvas_sync/jobs/sync_rubric_assessments_job.rb +15 -0
  120. data/lib/canvas_sync/jobs/sync_rubric_associations_job.rb +15 -0
  121. data/lib/canvas_sync/jobs/sync_rubrics_job.rb +15 -0
  122. data/lib/canvas_sync/jobs/sync_simple_table_job.rb +11 -32
  123. data/lib/canvas_sync/jobs/sync_submissions_job.rb +6 -4
  124. data/lib/canvas_sync/jobs/sync_terms_job.rb +9 -8
  125. data/lib/canvas_sync/jobs/term_batches_job.rb +50 -0
  126. data/lib/canvas_sync/{generators/templates/services/live_events/base_event.rb → live_events/base_handler.rb} +6 -10
  127. data/lib/canvas_sync/live_events/process_event_job.rb +26 -0
  128. data/lib/canvas_sync/live_events.rb +38 -0
  129. data/lib/canvas_sync/misc_helper.rb +63 -0
  130. data/lib/canvas_sync/processors/assignment_groups_processor.rb +3 -8
  131. data/lib/canvas_sync/processors/assignments_processor.rb +3 -8
  132. data/lib/canvas_sync/processors/content_migrations_processor.rb +19 -0
  133. data/lib/canvas_sync/processors/context_module_items_processor.rb +3 -8
  134. data/lib/canvas_sync/processors/context_modules_processor.rb +3 -8
  135. data/lib/canvas_sync/processors/model_mappings.yml +420 -0
  136. data/lib/canvas_sync/processors/normal_processor.rb +3 -3
  137. data/lib/canvas_sync/processors/provisioning_report_processor.rb +42 -55
  138. data/lib/canvas_sync/processors/report_processor.rb +15 -9
  139. data/lib/canvas_sync/processors/rubric_assessments_processor.rb +19 -0
  140. data/lib/canvas_sync/processors/rubric_associations_processor.rb +19 -0
  141. data/lib/canvas_sync/processors/rubrics_processor.rb +19 -0
  142. data/lib/canvas_sync/processors/submissions_processor.rb +3 -8
  143. data/lib/canvas_sync/record.rb +103 -0
  144. data/lib/canvas_sync/version.rb +1 -1
  145. data/lib/canvas_sync.rb +124 -125
  146. data/spec/canvas_sync/canvas_sync_spec.rb +224 -155
  147. data/spec/canvas_sync/jobs/canvas_process_waiter_spec.rb +34 -0
  148. data/spec/canvas_sync/jobs/job_spec.rb +9 -17
  149. data/spec/canvas_sync/jobs/report_checker_spec.rb +1 -3
  150. data/spec/canvas_sync/jobs/report_processor_job_spec.rb +0 -3
  151. data/spec/canvas_sync/jobs/report_starter_spec.rb +19 -28
  152. data/spec/canvas_sync/jobs/sync_admins_job_spec.rb +1 -4
  153. data/spec/canvas_sync/jobs/sync_assignment_groups_job_spec.rb +2 -1
  154. data/spec/canvas_sync/jobs/sync_assignments_job_spec.rb +3 -2
  155. data/spec/canvas_sync/jobs/sync_content_migrations_job_spec.rb +30 -0
  156. data/spec/canvas_sync/jobs/sync_context_module_items_job_spec.rb +3 -2
  157. data/spec/canvas_sync/jobs/sync_context_modules_job_spec.rb +3 -2
  158. data/spec/canvas_sync/jobs/sync_provisioning_report_job_spec.rb +7 -41
  159. data/spec/canvas_sync/jobs/sync_roles_job_spec.rb +1 -4
  160. data/spec/canvas_sync/jobs/sync_simple_table_job_spec.rb +5 -12
  161. data/spec/canvas_sync/jobs/sync_submissions_job_spec.rb +8 -2
  162. data/spec/canvas_sync/jobs/sync_terms_job_spec.rb +1 -4
  163. data/spec/canvas_sync/live_events/live_event_sync_spec.rb +27 -0
  164. data/spec/canvas_sync/live_events/live_events_controller_spec.rb +54 -0
  165. data/spec/canvas_sync/live_events/process_event_job_spec.rb +38 -0
  166. data/spec/canvas_sync/misc_helper_spec.rb +58 -0
  167. data/spec/canvas_sync/models/assignment_spec.rb +1 -1
  168. data/spec/canvas_sync/processors/content_migrations_processor_spec.rb +13 -0
  169. data/spec/canvas_sync/processors/provisioning_report_processor_spec.rb +101 -1
  170. data/spec/canvas_sync/processors/rubric_assessments_spec.rb +16 -0
  171. data/spec/canvas_sync/processors/rubric_associations_spec.rb +16 -0
  172. data/spec/canvas_sync/processors/rubrics_processor_spec.rb +17 -0
  173. data/spec/dummy/app/models/account.rb +6 -0
  174. data/spec/dummy/app/models/admin.rb +2 -0
  175. data/spec/dummy/app/models/assignment.rb +3 -0
  176. data/spec/dummy/app/models/assignment_group.rb +3 -0
  177. data/spec/dummy/app/models/content_migration.rb +18 -0
  178. data/spec/dummy/app/models/context_module.rb +3 -0
  179. data/spec/dummy/app/models/context_module_item.rb +3 -0
  180. data/spec/dummy/app/models/course.rb +11 -0
  181. data/spec/dummy/app/models/course_nickname.rb +19 -0
  182. data/spec/dummy/app/models/enrollment.rb +14 -0
  183. data/spec/dummy/app/models/grading_period.rb +16 -0
  184. data/spec/dummy/app/models/grading_period_group.rb +15 -0
  185. data/spec/dummy/app/models/group.rb +2 -0
  186. data/spec/dummy/app/models/group_membership.rb +2 -0
  187. data/spec/dummy/app/models/learning_outcome.rb +30 -0
  188. data/spec/dummy/app/models/learning_outcome_result.rb +54 -0
  189. data/spec/dummy/app/models/pseudonym.rb +16 -0
  190. data/spec/dummy/app/models/role.rb +2 -0
  191. data/spec/dummy/app/models/rubric.rb +35 -0
  192. data/spec/dummy/app/models/rubric_assessment.rb +22 -0
  193. data/spec/dummy/app/models/rubric_association.rb +20 -0
  194. data/spec/dummy/app/models/section.rb +9 -0
  195. data/spec/dummy/app/models/submission.rb +4 -0
  196. data/spec/dummy/app/models/term.rb +3 -0
  197. data/spec/dummy/app/models/user.rb +11 -0
  198. data/spec/dummy/app/models/user_observer.rb +19 -0
  199. data/spec/dummy/app/services/live_events/assignment_event.rb +1 -1
  200. data/spec/dummy/app/services/live_events/course_event.rb +1 -3
  201. data/spec/dummy/app/services/live_events/course_section_event.rb +1 -1
  202. data/spec/dummy/app/services/live_events/enrollment_event.rb +1 -1
  203. data/spec/dummy/app/services/live_events/grade_event.rb +1 -1
  204. data/spec/dummy/app/services/live_events/module_event.rb +1 -1
  205. data/spec/dummy/app/services/live_events/module_item_event.rb +1 -1
  206. data/spec/dummy/app/services/live_events/submission_event.rb +1 -1
  207. data/spec/dummy/app/services/live_events/syllabus_event.rb +1 -1
  208. data/spec/dummy/app/services/live_events/user_event.rb +1 -3
  209. data/spec/dummy/config/environments/test.rb +2 -0
  210. data/spec/dummy/config/routes.rb +1 -0
  211. data/spec/dummy/db/migrate/20201016181346_create_pseudonyms.rb +24 -0
  212. data/spec/dummy/db/migrate/20210907233329_create_user_observers.rb +23 -0
  213. data/spec/dummy/db/migrate/20210907233330_create_grading_periods.rb +28 -0
  214. data/spec/dummy/db/migrate/20211001184920_create_grading_period_groups.rb +24 -0
  215. data/spec/dummy/db/migrate/20220308072643_create_content_migrations.rb +30 -0
  216. data/spec/dummy/db/migrate/20220712210559_create_learning_outcomes.rb +36 -0
  217. data/spec/dummy/db/migrate/{20190702203620_create_users.rb → 20220926221926_create_users.rb} +0 -1
  218. data/spec/dummy/db/migrate/20240408223326_create_course_nicknames.rb +23 -0
  219. data/spec/dummy/db/migrate/20240509105100_create_rubrics.rb +44 -0
  220. data/spec/dummy/db/migrate/20240510094100_create_rubric_associations.rb +42 -0
  221. data/spec/dummy/db/migrate/20240510101100_create_rubric_assessments.rb +37 -0
  222. data/spec/dummy/db/migrate/20240523101010_create_learning_outcome_results.rb +52 -0
  223. data/spec/dummy/db/schema.rb +244 -5
  224. data/spec/factories/user_factory.rb +0 -1
  225. data/spec/job_batching/active_job_spec.rb +107 -0
  226. data/spec/job_batching/batch_spec.rb +489 -0
  227. data/spec/job_batching/callback_spec.rb +38 -0
  228. data/spec/job_batching/context_hash_spec.rb +54 -0
  229. data/spec/job_batching/flow_spec.rb +82 -0
  230. data/spec/job_batching/integration/fail_then_succeed.rb +42 -0
  231. data/spec/job_batching/integration/integration.rb +57 -0
  232. data/spec/job_batching/integration/nested.rb +88 -0
  233. data/spec/job_batching/integration/simple.rb +47 -0
  234. data/spec/job_batching/integration/workflow.rb +134 -0
  235. data/spec/job_batching/integration_helper.rb +50 -0
  236. data/spec/job_batching/pool_spec.rb +161 -0
  237. data/spec/job_batching/sidekiq_spec.rb +125 -0
  238. data/spec/job_batching/status_spec.rb +76 -0
  239. data/spec/job_batching/support/base_job.rb +14 -0
  240. data/spec/job_batching/support/sample_callback.rb +2 -0
  241. data/spec/spec_helper.rb +17 -0
  242. data/spec/support/fixtures/reports/content_migrations.csv +3 -0
  243. data/spec/support/fixtures/reports/course_nicknames.csv +3 -0
  244. data/spec/support/fixtures/reports/grading_period_groups.csv +2 -0
  245. data/spec/support/fixtures/reports/grading_periods.csv +3 -0
  246. data/spec/support/fixtures/reports/learning_outcome_results.csv +3 -0
  247. data/spec/support/fixtures/reports/learning_outcomes.csv +3 -0
  248. data/spec/support/fixtures/reports/provisioning_csv_unzipped/courses.csv +3 -0
  249. data/spec/support/fixtures/reports/provisioning_csv_unzipped/users.csv +4 -0
  250. data/spec/support/fixtures/reports/rubric_assessments.csv +3 -0
  251. data/spec/support/fixtures/reports/rubric_associations.csv +3 -0
  252. data/spec/support/fixtures/reports/rubrics.csv +3 -0
  253. data/spec/support/fixtures/reports/user_observers.csv +3 -0
  254. data/spec/support/fixtures/reports/users.csv +3 -2
  255. data/spec/support/fixtures/reports/xlist.csv +1 -1
  256. metadata +329 -27
  257. data/app/controllers/api/v1/live_events_controller.rb +0 -18
  258. data/lib/canvas_sync/job_chain.rb +0 -57
  259. data/lib/canvas_sync/jobs/fork_gather.rb +0 -59
  260. data/spec/canvas_sync/jobs/fork_gather_spec.rb +0 -73
@@ -36,7 +36,6 @@ module CanvasSync
36
36
  template rb_file.to_s, "app/services/live_events/#{File.basename(rb_file)}"
37
37
  end
38
38
  end
39
- template "base_event.rb", "app/services/live_events/base_event.rb"
40
39
  end
41
40
  end
42
41
  end
@@ -0,0 +1,24 @@
1
+ # <%= autogenerated_migration_warning %>
2
+
3
+ class CreateContentMigrations < ActiveRecord::Migration[5.1]
4
+ def change
5
+ create_table :content_migrations do |t|
6
+ t.bigint :canvas_id
7
+ t.bigint :canvas_context_id
8
+ t.string :canvas_context_type
9
+ t.string :workflow_state
10
+ t.text :migration_settings
11
+ t.datetime :started_at
12
+ t.datetime :finished_at
13
+ t.float :progress
14
+ t.bigint :canvas_source_course_id
15
+ t.string :migration_type
16
+ t.bigint :canvas_child_subscription_id
17
+ t.bigint :canvas_root_account_id
18
+
19
+ t.timestamps
20
+ end
21
+
22
+ add_index :content_migrations, :canvas_id, unique: true
23
+ end
24
+ end
@@ -0,0 +1,17 @@
1
+ # <%= autogenerated_migration_warning %>
2
+
3
+ class CreateCourseNicknames < ActiveRecord::Migration[5.1]
4
+ def change
5
+ create_table :course_nicknames do |t|
6
+ t.bigint :canvas_user_preference_value_id, null: true
7
+ t.integer :canvas_user_id
8
+ t.integer :canvas_course_id
9
+ t.string :nickname
10
+
11
+ t.timestamps
12
+ end
13
+
14
+ add_index :course_nicknames, :canvas_user_preference_value_id, unique: true
15
+ add_index :course_nicknames, [:canvas_course_id, :canvas_user_id], unique: true
16
+ end
17
+ end
@@ -0,0 +1,18 @@
1
+ # <%= autogenerated_migration_warning %>
2
+
3
+ class CreateGradingPeriodGroups < ActiveRecord::Migration[5.1]
4
+ def change
5
+ create_table :grading_period_groups do |t|
6
+ t.bigint :canvas_id, null: false
7
+ t.string :title
8
+ t.boolean :weighted
9
+ t.boolean :display_totals_for_all_grading_periods
10
+
11
+ t.string :workflow_state
12
+
13
+ t.timestamps
14
+ end
15
+
16
+ add_index :grading_period_groups, :canvas_id, unique: true
17
+ end
18
+ end
@@ -0,0 +1,22 @@
1
+ # <%= autogenerated_migration_warning %>
2
+
3
+ class CreateGradingPeriods < ActiveRecord::Migration[5.1]
4
+ def change
5
+ create_table :grading_periods do |t|
6
+ t.bigint :canvas_id, null: false
7
+ t.string :title
8
+ t.float :weight
9
+ t.datetime :start_date
10
+ t.datetime :end_date
11
+ t.datetime :close_date
12
+ t.bigint :canvas_grading_period_group_id
13
+
14
+ t.string :workflow_state
15
+
16
+ t.timestamps
17
+ end
18
+
19
+ add_index :grading_periods, :canvas_id, unique: true
20
+ add_index :grading_periods, :canvas_grading_period_group_id
21
+ end
22
+ end
@@ -0,0 +1,46 @@
1
+ # <%= autogenerated_migration_warning %>
2
+
3
+ class CreateLearningOutcomeResults < ActiveRecord::Migration[5.1]
4
+ def change
5
+ create_table :learning_outcome_results do |t|
6
+ t.bigint :canvas_id, null: false
7
+ t.bigint :canvas_context_id
8
+ t.string :canvas_context_type
9
+ t.bigint :canvas_association_id
10
+ t.string :canvas_association_type
11
+ t.bigint :canvas_content_tag_id
12
+ t.bigint :canvas_learning_outcome_id
13
+ t.bigint :canvas_user_id
14
+ t.boolean :mastery
15
+ t.boolean :original_mastery
16
+ t.bigint :canvas_artifact_id
17
+ t.string :canvas_artifact_type
18
+ t.datetime :assessed_at
19
+ t.string :title
20
+ t.float :percent
21
+ t.bigint :canvas_associated_asset_id
22
+ t.string :canvas_associated_asset_type
23
+ t.integer :attempt
24
+ t.float :score
25
+ t.float :possible
26
+ t.float :original_score
27
+ t.float :original_possible
28
+ t.string :workflow_state
29
+
30
+ t.timestamps
31
+ end
32
+
33
+ add_index :learning_outcome_results, :canvas_id, unique: true
34
+ add_index :learning_outcome_results, %i[
35
+ canvas_user_id
36
+ canvas_content_tag_id
37
+ canvas_association_id
38
+ canvas_association_type
39
+ canvas_associated_asset_id
40
+ canvas_associated_asset_type
41
+ ], unique: true, name: :index_learning_outcome_results_association
42
+ add_index :learning_outcome_results, :canvas_content_tag_id
43
+ add_index :learning_outcome_results, :canvas_learning_outcome_id
44
+ add_index :learning_outcome_results, %i[canvas_artifact_id canvas_artifact_type], name: :index_learning_outcome_results_on_canvas_arid_and_artype
45
+ end
46
+ end
@@ -0,0 +1,30 @@
1
+ # <%= autogenerated_migration_warning %>
2
+
3
+ class CreateLearningOutcomes < ActiveRecord::Migration[5.1]
4
+ def change
5
+ create_table :learning_outcomes do |t|
6
+ t.bigint :canvas_id, null: false
7
+ t.integer :canvas_context_id
8
+ t.string :canvas_context_type
9
+ t.string :name
10
+ t.string :friendly_name
11
+ t.string :workflow_state
12
+ t.datetime :canvas_created_at
13
+ t.datetime :canvas_updated_at
14
+ t.string :migration_id
15
+ t.string :vendor_guid
16
+ t.string :low_grade
17
+ t.string :high_grade
18
+ t.string :calculation_method
19
+ t.string :calculation_int
20
+ t.integer :outcome_import_id
21
+ t.integer :root_account_ids, array: true, default: []
22
+ t.text :description
23
+
24
+ t.timestamps
25
+ end
26
+
27
+ add_index :learning_outcomes, :canvas_id, unique: true
28
+ add_index :learning_outcomes, [:canvas_context_id, :canvas_context_type], name: "index_learning_outcomes_on_context"
29
+ end
30
+ end
@@ -0,0 +1,31 @@
1
+ # <%= autogenerated_migration_warning %>
2
+
3
+ class CreateRubricAssessments < ActiveRecord::Migration[5.1]
4
+ def change
5
+ create_table :rubric_assessments do |t|
6
+ t.bigint :canvas_id
7
+ t.bigint :canvas_user_id
8
+ t.bigint :canvas_rubric_id
9
+ t.bigint :canvas_rubric_association_id
10
+ t.float :score
11
+ t.text :data
12
+ t.bigint :canvas_artifact_id
13
+ t.string :canvas_artifact_type
14
+ t.string :assessment_type
15
+ t.bigint :canvas_assessor_id
16
+ t.integer :artifact_attempt
17
+ t.boolean :hide_points
18
+ t.bigint :canvas_root_account_id
19
+
20
+ t.timestamps
21
+ end
22
+
23
+ add_index :rubric_assessments, [:canvas_id], name: :index_rubric_assessments_on_canvas_id, unique: true
24
+ add_index :rubric_assessments, [:canvas_artifact_id, :canvas_artifact_type], name: :index_rubric_assessments_on_canvas_aid_and_canvas_atype
25
+ add_index :rubric_assessments, [:canvas_assessor_id], name: :index_rubric_assessments_on_canvas_assessor_id
26
+ add_index :rubric_assessments, [:canvas_rubric_association_id], name: :index_rubric_assessments_on_canvas_rubric_association_id
27
+ add_index :rubric_assessments, [:canvas_rubric_id], name: :index_rubric_assessments_on_canvas_rubric_id
28
+ add_index :rubric_assessments, [:canvas_user_id], name: :index_rubric_assessments_on_canvas_user_id
29
+ add_index :rubric_assessments, [:canvas_root_account_id], name: :index_rubric_assessments_on_canvas_root_account_id
30
+ end
31
+ end
@@ -0,0 +1,36 @@
1
+ # <%= autogenerated_migration_warning %>
2
+
3
+ class CreateRubricAssociations < ActiveRecord::Migration[5.1]
4
+ def change
5
+ create_table :rubric_associations do |t|
6
+ t.bigint :canvas_id, null: false
7
+ t.bigint :canvas_rubric_id
8
+ t.bigint :canvas_association_id
9
+ t.string :canvas_association_type
10
+ t.boolean :use_for_grading
11
+ t.string :title
12
+ t.text :description
13
+ t.text :summary_data
14
+ t.string :purpose
15
+ t.string :url
16
+ t.bigint :canvas_context_id
17
+ t.string :canvas_context_type
18
+ t.boolean :hide_score_total
19
+ t.boolean :bookmarked
20
+ t.string :context_code
21
+ t.boolean :hide_points
22
+ t.boolean :hide_outcome_results
23
+ t.bigint :canvas_root_account_id
24
+ t.string :workflow_state
25
+
26
+ t.timestamps
27
+ end
28
+
29
+ add_index :rubric_associations, [:canvas_id], :name => :index_rubric_associations_on_canvas_id, unique: true
30
+ add_index :rubric_associations, [:canvas_association_id, :canvas_association_type], :name => :index_rubric_associations_on_canvas_aid_and_canvas_atype
31
+ add_index :rubric_associations, [:context_code], :name => :index_rubric_associations_on_context_code
32
+ add_index :rubric_associations, [:canvas_context_id, :canvas_context_type], :name => :index_rubric_associations_on_canvas_cid_and_canvas_ctype
33
+ add_index :rubric_associations, [:canvas_rubric_id], :name => :index_rubric_associations_on_canvas_rubric_id
34
+ add_index :rubric_associations, [:canvas_root_account_id], :name => :index_rubric_associations_on_canvas_root_account_id
35
+ end
36
+ end
@@ -0,0 +1,38 @@
1
+ # <%= autogenerated_model_warning %>
2
+
3
+ class CreateRubrics < ActiveRecord::Migration[5.1]
4
+ def change
5
+ create_table :rubrics do |t|
6
+ t.bigint :canvas_id, null: false
7
+ t.bigint :canvas_user_id
8
+ t.bigint :canvas_rubric_id
9
+ t.bigint :canvas_context_id
10
+ t.string :canvas_context_type
11
+ t.text :data
12
+ t.float :points_possible
13
+ t.string :title
14
+ t.text :description
15
+ t.boolean :reusable
16
+ t.boolean :public
17
+ t.boolean :read_only
18
+ t.integer :association_count
19
+ t.boolean :free_form_criterion_comments
20
+ t.string :context_code
21
+ t.string :migration_id
22
+ t.boolean :hide_score_total
23
+ t.string :workflow_state
24
+ t.bigint :canvas_root_account_id
25
+ t.boolean :hide_points
26
+ t.string :rating_order
27
+ t.string :button_display
28
+
29
+ t.timestamps
30
+ end
31
+
32
+ add_index :rubrics, [:canvas_id], unique: true
33
+ add_index :rubrics, [:canvas_context_id, :canvas_context_type]
34
+ add_index :rubrics, [:canvas_rubric_id]
35
+ add_index :rubrics, [:canvas_user_id]
36
+ add_index :rubrics, [:canvas_root_account_id]
37
+ end
38
+ end
@@ -0,0 +1,17 @@
1
+ # <%= autogenerated_migration_warning %>
2
+
3
+ class CreateUserObservers < ActiveRecord::Migration[5.1]
4
+ def change
5
+ create_table :user_observers do |t|
6
+ t.bigint :observing_user_id
7
+ t.bigint :observed_user_id
8
+ t.string :workflow_state
9
+
10
+ t.timestamps
11
+ end
12
+
13
+ add_index :user_observers, [:observed_user_id, :observing_user_id], unique: true
14
+ add_index :user_observers, :observing_user_id
15
+ add_index :user_observers, :observed_user_id
16
+ end
17
+ end
@@ -4,7 +4,6 @@ class CreateUsers < ActiveRecord::Migration[5.1]
4
4
  def change
5
5
  create_table :users do |t|
6
6
  t.bigint :canvas_id, null: false
7
- t.string :sis_id
8
7
  t.string :email
9
8
  t.string :first_name
10
9
  t.string :last_name
@@ -4,6 +4,9 @@ class Account < ApplicationRecord
4
4
  include CanvasSync::Record
5
5
  include CanvasSync::Concerns::ApiSyncable
6
6
  # include CanvasSync::Concerns::Account::Ancestry # Add support for the ancestry Gem
7
+ # include CanvasSync::Concerns::LiveEventSync
8
+
9
+ canvas_sync_features :defaults
7
10
 
8
11
  validates :canvas_id, uniqueness: true, presence: true
9
12
 
@@ -4,6 +4,8 @@ class Admin < ApplicationRecord
4
4
  include CanvasSync::Record
5
5
  include CanvasSync::Concerns::ApiSyncable
6
6
 
7
+ canvas_sync_features :defaults
8
+
7
9
  validates :canvas_id, uniqueness: true, presence: true
8
10
  belongs_to :account, primary_key: :canvas_id, foreign_key: :canvas_account_id, optional: true
9
11
  belongs_to :user, primary_key: :canvas_id, foreign_key: :canvas_user_id, optional: true
@@ -3,6 +3,9 @@
3
3
  class Assignment < ApplicationRecord
4
4
  include CanvasSync::Record
5
5
  include CanvasSync::Concerns::ApiSyncable
6
+ # include CanvasSync::Concerns::LiveEventSync
7
+
8
+ canvas_sync_features :defaults
6
9
 
7
10
  validates :canvas_id, uniqueness: true, presence: true
8
11
  belongs_to :context, polymorphic: true, optional: true, primary_key: :canvas_id, foreign_key: :canvas_context_id, foreign_type: :canvas_context_type
@@ -3,6 +3,9 @@
3
3
  class AssignmentGroup < ApplicationRecord
4
4
  include CanvasSync::Record
5
5
  include CanvasSync::Concerns::ApiSyncable
6
+ # include CanvasSync::Concerns::LiveEventSync
7
+
8
+ canvas_sync_features :defaults
6
9
 
7
10
  validates :canvas_id, uniqueness: true, presence: true
8
11
  belongs_to :course, primary_key: :canvas_id, foreign_key: :canvas_course_id, optional: true
@@ -0,0 +1,12 @@
1
+ # <%= autogenerated_model_warning %>
2
+
3
+ class ContentMigration < 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 :context, polymorphic: true, optional: true, primary_key: :canvas_id, foreign_key: :canvas_context_id, foreign_type: :canvas_context_type
11
+
12
+ end
@@ -6,6 +6,9 @@
6
6
  class ContextModule < ApplicationRecord
7
7
  include CanvasSync::Record
8
8
  include CanvasSync::Concerns::ApiSyncable
9
+ # include CanvasSync::Concerns::LiveEventSync
10
+
11
+ canvas_sync_features :defaults
9
12
 
10
13
  belongs_to :context, polymorphic: true, optional: true, primary_key: :canvas_id, foreign_key: :canvas_context_id, foreign_type: :canvas_context_type
11
14
  has_many :context_module_items, primary_key: :canvas_id, foreign_key: :canvas_context_module_id
@@ -3,6 +3,9 @@
3
3
  class ContextModuleItem < ApplicationRecord
4
4
  include CanvasSync::Record
5
5
  include CanvasSync::Concerns::ApiSyncable
6
+ # include CanvasSync::Concerns::LiveEventSync
7
+
8
+ canvas_sync_features :defaults
6
9
 
7
10
  belongs_to :context_module, primary_key: :canvas_id, foreign_key: :canvas_context_module_id, optional: true
8
11
  belongs_to :content, polymorphic: true, optional: true, primary_key: :canvas_id, foreign_key: :canvas_content_id, foreign_type: :canvas_content_type
@@ -4,6 +4,16 @@ class Course < ApplicationRecord
4
4
  include CanvasSync::Record
5
5
  include CanvasSync::Concerns::ApiSyncable
6
6
 
7
+ canvas_sync_features :defaults
8
+
9
+ # include CanvasSync::Concerns::LiveEventSync
10
+ # after_process_live_event do
11
+ # if account.nil?
12
+ # acc = Account.new(canvas_id: canvas_account_id)
13
+ # acc.sync_from_api
14
+ # end
15
+ # end
16
+
7
17
  validates :canvas_id, uniqueness: true, presence: true
8
18
  belongs_to :term, foreign_key: :canvas_term_id, primary_key: :canvas_id, optional: true
9
19
  has_many :enrollments, primary_key: :canvas_id, foreign_key: :canvas_course_id
@@ -12,6 +22,7 @@ class Course < ApplicationRecord
12
22
  has_many :submissions, primary_key: :canvas_id, foreign_key: :canvas_course_id
13
23
  has_many :assignment_groups, primary_key: :canvas_id, foreign_key: :canvas_course_id
14
24
  has_many :groups, primary_key: :canvas_id, foreign_key: :canvas_course_id
25
+ has_many :rubrics, as: :context, primary_key: :canvas_id, foreign_key: :canvas_context_id, foreign_type: :canvas_context_type
15
26
 
16
27
  api_syncable({
17
28
  sis_id: :sis_course_id,
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ # # <%= autogenerated_migration_warning %>
4
+
5
+ class CourseNickname < ApplicationRecord
6
+ include CanvasSync::Record
7
+ include CanvasSync::Concerns::ApiSyncable
8
+
9
+ canvas_sync_features :defaults
10
+
11
+ belongs_to :user, primary_key: :canvas_id, foreign_key: :canvas_user_id, optional: true
12
+ belongs_to :course, primary_key: :canvas_id, foreign_key: :canvas_course_id, optional: true
13
+ end
@@ -4,6 +4,20 @@ class Enrollment < ApplicationRecord
4
4
  include CanvasSync::Record
5
5
  include CanvasSync::Concerns::ApiSyncable
6
6
 
7
+ canvas_sync_features :defaults
8
+
9
+ # include CanvasSync::Concerns::LiveEventSync
10
+ # after_process_live_event do
11
+ # if user.nil?
12
+ # u = User.new(canvas_id: canvas_user_id)
13
+ # u.sync_from_api
14
+ # end
15
+ # if course.nil?
16
+ # c = Course.new(canvas_id: canvas_course_id)
17
+ # c.sync_from_api
18
+ # end
19
+ # end
20
+
7
21
  validates :canvas_id, uniqueness: true, presence: true
8
22
  belongs_to :user, primary_key: :canvas_id, foreign_key: :canvas_user_id, optional: true
9
23
  belongs_to :role, primary_key: :canvas_id, foreign_key: :canvas_role_id, optional: true
@@ -0,0 +1,10 @@
1
+ # <%= autogenerated_model_warning %>
2
+
3
+ class GradingPeriod < ApplicationRecord
4
+ include CanvasSync::Record
5
+
6
+ canvas_sync_features :defaults
7
+
8
+ validates :canvas_id, uniqueness: true, presence: true
9
+ belongs_to :grading_period_group, primary_key: :canvas_id, foreign_key: :canvas_grading_period_group_id, optional: true
10
+ end
@@ -0,0 +1,9 @@
1
+ # <%= autogenerated_model_warning %>
2
+
3
+ class GradingPeriodGroup < ApplicationRecord
4
+ include CanvasSync::Record
5
+
6
+ canvas_sync_features :defaults
7
+
8
+ validates :canvas_id, uniqueness: true, presence: true
9
+ end
@@ -4,6 +4,8 @@ class Group < ApplicationRecord
4
4
  include CanvasSync::Record
5
5
  include CanvasSync::Concerns::ApiSyncable
6
6
 
7
+ canvas_sync_features :defaults
8
+
7
9
  validates :canvas_id, uniqueness: true, presence: true
8
10
  belongs_to :course, primary_key: :canvas_id, foreign_key: :canvas_course_id, optional: true
9
11
  belongs_to :account, primary_key: :canvas_id, foreign_key: :canvas_account_id, optional: true
@@ -4,6 +4,8 @@ class GroupMembership < ApplicationRecord
4
4
  include CanvasSync::Record
5
5
  include CanvasSync::Concerns::ApiSyncable
6
6
 
7
+ canvas_sync_features :defaults
8
+
7
9
  validates :canvas_id, uniqueness: true, presence: true
8
10
  belongs_to :group, primary_key: :canvas_id, foreign_key: :canvas_group_id
9
11
  belongs_to :user, primary_key: :canvas_id, foreign_key: :canvas_user_id
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ # # <%= autogenerated_migration_warning %>
4
+
5
+ class LearningOutcome < ApplicationRecord
6
+ include CanvasSync::Record
7
+ include CanvasSync::Concerns::ApiSyncable
8
+
9
+ canvas_sync_features :defaults
10
+
11
+ belongs_to :context, polymorphic: true, optional: true, primary_key: :canvas_id, foreign_key: :canvas_context_id, foreign_type: :canvas_context_type
12
+
13
+ api_syncable({
14
+ canvas_id: :id,
15
+ canvas_context_id: :context_id,
16
+ canvas_context_type: :context_type,
17
+ name: :title,
18
+ friendly_name: :display_name,
19
+ vendor_guid: :vendor_guid,
20
+ calculation_method: :calculation_method,
21
+ calculation_int: :calculation_int,
22
+ description: :description
23
+ }, ->(api) { api.get("/api/v1/outcomes/#{canvas_id}") })
24
+ end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ # # <%= autogenerated_model_warning %>
4
+
5
+ class LearningOutcomeResult < ActiveRecord::Base
6
+ include CanvasSync::Record
7
+ include CanvasSync::Concerns::ApiSyncable
8
+
9
+ belongs_to :user, primary_key: :canvas_id, foreign_key: :canvas_user_id, optional: true
10
+ belongs_to :learning_outcome, primary_key: :canvas_id, foreign_key: :canvas_learning_outcome_id, optional: true
11
+ belongs_to :alignment, class_name: "ContentTag", primary_key: :canvas_id, foreign_key: :canvas_content_tag_id, optional: true
12
+ belongs_to :association_object,
13
+ polymorphic: [:rubric_association, :assignment],
14
+ foreign_key: :association_id,
15
+ foreign_type: :association_type,
16
+ optional: true
17
+ belongs_to :artifact,
18
+ polymorphic: [:rubric_assessment, :submission],
19
+ primary_key: :canvas_artifact_id,
20
+ foreign_key: :canvas_artifact_id,
21
+ foreign_type: :canvas_artifact_type,
22
+ optional: true
23
+
24
+ belongs_to :context, polymorphic: [:course], primary_key: :canvas_id, foreign_key: :canvas_context_id, foreign_type: :canvas_context_type, optional: true
25
+
26
+ # Not yet implemented in CanvasSync
27
+ # belongs_to :associated_asset,
28
+ # polymorphic:
29
+ # [:assessment_question,
30
+ # :assignment,
31
+ # { quiz: "Quizzes::Quiz", assessment: "LiveAssessments::Assessment" }],
32
+ # polymorphic_prefix: true
33
+
34
+ # Not yet implemented in CanvasSync
35
+ # has_many :learning_outcome_question_results, dependent: :destroy
36
+
37
+ api_syncable({
38
+ canvas_id: :id,
39
+ canvas_content_tag_id: :links&.[]("alignment"),
40
+ canvas_learning_outcome_id: :links&.[]("learning_outcome"),
41
+ canvas_user_id: :links&.[]("user"),
42
+ score: :score,
43
+ assessed_at: :submitted_or_assessed_at,
44
+ percent: :percent
45
+ }, ->(api) {
46
+ api.get("/api/v1/courses/#{self.canvas_context_id}/#{self.canvas_id}")&.find { |item| item[:id] == self.canvas_id }
47
+ })
48
+ end
@@ -3,6 +3,8 @@
3
3
  class Pseudonym < ApplicationRecord
4
4
  include CanvasSync::Record
5
5
 
6
+ canvas_sync_features :defaults
7
+
6
8
  validates :canvas_id, uniqueness: true, presence: true
7
9
  belongs_to :user, primary_key: :canvas_id, foreign_key: :canvas_user_id
8
10
  end
@@ -4,6 +4,8 @@ class Role < ApplicationRecord
4
4
  include CanvasSync::Record
5
5
  include CanvasSync::Concerns::ApiSyncable
6
6
 
7
+ canvas_sync_features :defaults
8
+
7
9
  validates :canvas_id, uniqueness: true, presence: true
8
10
  has_many :admins, foreign_key: :canvas_role_id, primary_key: :canvas_id
9
11
 
@@ -0,0 +1,29 @@
1
+ # <%= autogenerated_model_warning %>
2
+
3
+ class Rubric < 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 :user, primary_key: :canvas_id, foreign_key: :canvas_user_id
11
+ belongs_to :rubric, primary_key: :canvas_id, foreign_key: :canvas_rubric_id # based on another rubric
12
+ belongs_to :context, polymorphic: true, primary_key: :canvas_id, foreign_key: :canvas_context_id, foreign_type: :canvas_context_type
13
+
14
+ has_many :rubric_associations, primary_key: :canvas_id, foreign_key: :canvas_association_id, foreign_type: :canvas_association_type
15
+ has_many :rubric_assessments, through: :rubric_associations, dependent: :destroy
16
+
17
+ api_syncable({
18
+ canvas_id: :id,
19
+ title: :title,
20
+ canvas_context_id: :context_id,
21
+ canvas_context_type: :context_type,
22
+ points_possible: :points_possible,
23
+ reusable: :reusable,
24
+ read_only: :read_only,
25
+ free_form_criterion_comments: :free_form_criterion_comments,
26
+ hide_score_total: :hide_score_total,
27
+ data: :data,
28
+ }, -> (api) { api.rubrics("self", canvas_id) })
29
+ end
@@ -0,0 +1,17 @@
1
+ # <%= autogenerated_model_warning %>
2
+
3
+ class RubricAssessment < 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
+
11
+ belongs_to :rubric, primary_key: :canvas_id, foreign_key: :canvas_rubric_id, optional: true
12
+ belongs_to :rubric_association, primary_key: :canvas_id, foreign_key: :canvas_rubric_association_id, optional: true
13
+ belongs_to :user, primary_key: :canvas_id, foreign_key: :canvas_user_id, optional: true
14
+ belongs_to :assessor, class_name: "User", primary_key: :canvas_id, foreign_key: :canvas_assessor_id, optional: true
15
+ belongs_to :artifact, polymorphic: true, primary_key: :canvas_id, foreign_type: :canvas_artifact_type, foreign_key: :canvas_artifact_id, optional: true
16
+
17
+ end
@@ -0,0 +1,14 @@
1
+ # <%= autogenerated_model_warning %>
2
+
3
+ class RubricAssociation < 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 :rubric, primary_key: :canvas_id, foreign_key: :canvas_rubric_id, optional: true
11
+ belongs_to :association_object, polymorphic: true, primary_key: :canvas_id, foreign_type: :canvas_association_type, optional: true
12
+ belongs_to :context, polymorphic: true, primary_key: :canvas_id, foreign_key: :canvas_context_id, optional: true
13
+ has_many :rubric_assessments
14
+ end