canvas_sync 0.19.2 → 0.19.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/lib/canvas_sync/concerns/auto_relations.rb +11 -0
  3. data/lib/canvas_sync/generators/templates/migrations/create_rubric_assessments.rb +31 -0
  4. data/lib/canvas_sync/generators/templates/migrations/create_rubric_associations.rb +36 -0
  5. data/lib/canvas_sync/generators/templates/migrations/create_rubrics.rb +38 -0
  6. data/lib/canvas_sync/generators/templates/models/course.rb +1 -0
  7. data/lib/canvas_sync/generators/templates/models/rubric.rb +29 -0
  8. data/lib/canvas_sync/generators/templates/models/rubric_assessment.rb +18 -0
  9. data/lib/canvas_sync/generators/templates/models/rubric_association.rb +14 -0
  10. data/lib/canvas_sync/generators/templates/models/user.rb +1 -0
  11. data/lib/canvas_sync/jobs/sync_rubric_assessments_job.rb +15 -0
  12. data/lib/canvas_sync/jobs/sync_rubric_associations_job.rb +15 -0
  13. data/lib/canvas_sync/jobs/sync_rubrics_job.rb +15 -0
  14. data/lib/canvas_sync/processors/model_mappings.yml +168 -0
  15. data/lib/canvas_sync/processors/rubric_assessments_processor.rb +19 -0
  16. data/lib/canvas_sync/processors/rubric_associations_processor.rb +19 -0
  17. data/lib/canvas_sync/processors/rubrics_processor.rb +19 -0
  18. data/lib/canvas_sync/version.rb +1 -1
  19. data/lib/canvas_sync.rb +12 -0
  20. data/spec/canvas_sync/processors/rubric_assessments_spec.rb +16 -0
  21. data/spec/canvas_sync/processors/rubric_associations_spec.rb +16 -0
  22. data/spec/canvas_sync/processors/rubrics_processor_spec.rb +17 -0
  23. data/spec/dummy/app/models/course.rb +1 -0
  24. data/spec/dummy/app/models/rubric.rb +35 -0
  25. data/spec/dummy/app/models/rubric_assessment.rb +23 -0
  26. data/spec/dummy/app/models/rubric_association.rb +20 -0
  27. data/spec/dummy/db/migrate/20240509105100_create_rubrics.rb +44 -0
  28. data/spec/dummy/db/migrate/20240510094100_create_rubric_associations.rb +42 -0
  29. data/spec/dummy/db/migrate/20240510101100_create_rubric_assessments.rb +37 -0
  30. data/spec/dummy/db/schema.rb +88 -1
  31. data/spec/support/fixtures/reports/rubric_assessments.csv +3 -0
  32. data/spec/support/fixtures/reports/rubric_associations.csv +3 -0
  33. data/spec/support/fixtures/reports/rubrics.csv +3 -0
  34. metadata +200 -163
@@ -0,0 +1,20 @@
1
+ # #
2
+ # AUTO GENERATED MODEL
3
+ # This model was auto generated by the CanvasSync Gem.
4
+ # You can customize it as needed, but make sure you test
5
+ # any changes you make to the auto generated methods.
6
+ #
7
+
8
+
9
+ class RubricAssociation < ApplicationRecord
10
+ include CanvasSync::Record
11
+
12
+ canvas_sync_features :defaults
13
+
14
+ validates :canvas_id, uniqueness: true, presence: true
15
+ belongs_to :rubric, primary_key: :canvas_id, foreign_key: :canvas_rubric_id, optional: true
16
+ belongs_to :association_object, polymorphic: true, primary_key: :canvas_id, foreign_type: :canvas_association_type, foreign_key: :canvas_association_id, optional: true
17
+ belongs_to :context, polymorphic: true, primary_key: :canvas_id, foreign_key: :canvas_context_id, foreign_type: :canvas_context_type, optional: true
18
+
19
+ has_many :rubric_assessments
20
+ end
@@ -0,0 +1,44 @@
1
+ # #
2
+ # AUTO GENERATED MIGRATION
3
+ # This migration was auto generated by the CanvasSync Gem.
4
+ # You can add new columns to this table, but removing or
5
+ # re-naming ones created here may break Canvas Syncing.
6
+ #
7
+
8
+
9
+ class CreateRubrics < ActiveRecord::Migration[5.1]
10
+ def change
11
+ create_table :rubrics do |t|
12
+ t.bigint :canvas_id, null: false
13
+ t.bigint :canvas_user_id
14
+ t.bigint :canvas_rubric_id
15
+ t.bigint :canvas_context_id
16
+ t.string :canvas_context_type
17
+ t.text :data
18
+ t.float :points_possible
19
+ t.string :title
20
+ t.text :description
21
+ t.boolean :reusable
22
+ t.boolean :public
23
+ t.boolean :read_only
24
+ t.integer :association_count
25
+ t.boolean :free_form_criterion_comments
26
+ t.string :context_code
27
+ t.string :migration_id
28
+ t.boolean :hide_score_total
29
+ t.string :workflow_state
30
+ t.bigint :canvas_root_account_id
31
+ t.boolean :hide_points
32
+ t.string :rating_order
33
+ t.string :button_display
34
+
35
+ t.timestamps
36
+ end
37
+
38
+ add_index :rubrics, [:canvas_id], unique: true
39
+ add_index :rubrics, [:canvas_context_id, :canvas_context_type]
40
+ add_index :rubrics, [:canvas_rubric_id]
41
+ add_index :rubrics, [:canvas_user_id]
42
+ add_index :rubrics, [:canvas_root_account_id]
43
+ end
44
+ end
@@ -0,0 +1,42 @@
1
+ # #
2
+ # AUTO GENERATED MIGRATION
3
+ # This migration was auto generated by the CanvasSync Gem.
4
+ # You can add new columns to this table, but removing or
5
+ # re-naming ones created here may break Canvas Syncing.
6
+ #
7
+
8
+
9
+ class CreateRubricAssociations < ActiveRecord::Migration[5.1]
10
+ def change
11
+ create_table :rubric_associations do |t|
12
+ t.bigint :canvas_id, null: false
13
+ t.bigint :canvas_rubric_id
14
+ t.bigint :canvas_association_id
15
+ t.string :canvas_association_type
16
+ t.boolean :use_for_grading
17
+ t.string :title
18
+ t.text :description
19
+ t.text :summary_data
20
+ t.string :purpose
21
+ t.string :url
22
+ t.bigint :canvas_context_id
23
+ t.string :canvas_context_type
24
+ t.boolean :hide_score_total
25
+ t.boolean :bookmarked
26
+ t.string :context_code
27
+ t.boolean :hide_points
28
+ t.boolean :hide_outcome_results
29
+ t.bigint :canvas_root_account_id
30
+ t.string :workflow_state
31
+
32
+ t.timestamps
33
+ end
34
+
35
+ add_index :rubric_associations, [:canvas_id], :name => :index_rubric_associations_on_canvas_id, unique: true
36
+ add_index :rubric_associations, [:canvas_association_id, :canvas_association_type], :name => :index_rubric_associations_on_canvas_aid_and_canvas_atype
37
+ add_index :rubric_associations, [:context_code], :name => :index_rubric_associations_on_context_code
38
+ add_index :rubric_associations, [:canvas_context_id, :canvas_context_type], :name => :index_rubric_associations_on_canvas_cid_and_canvas_ctype
39
+ add_index :rubric_associations, [:canvas_rubric_id], :name => :index_rubric_associations_on_canvas_rubric_id
40
+ add_index :rubric_associations, [:canvas_root_account_id], :name => :index_rubric_associations_on_canvas_root_account_id
41
+ end
42
+ end
@@ -0,0 +1,37 @@
1
+ # #
2
+ # AUTO GENERATED MIGRATION
3
+ # This migration was auto generated by the CanvasSync Gem.
4
+ # You can add new columns to this table, but removing or
5
+ # re-naming ones created here may break Canvas Syncing.
6
+ #
7
+
8
+
9
+ class CreateRubricAssessments < ActiveRecord::Migration[5.1]
10
+ def change
11
+ create_table :rubric_assessments do |t|
12
+ t.bigint :canvas_id
13
+ t.bigint :canvas_user_id
14
+ t.bigint :canvas_rubric_id
15
+ t.bigint :canvas_rubric_association_id
16
+ t.float :score
17
+ t.text :data
18
+ t.bigint :canvas_artifact_id
19
+ t.string :canvas_artifact_type
20
+ t.string :assessment_type
21
+ t.bigint :canvas_assessor_id
22
+ t.integer :artifact_attempt
23
+ t.boolean :hide_points
24
+ t.bigint :canvas_root_account_id
25
+
26
+ t.timestamps
27
+ end
28
+
29
+ add_index :rubric_assessments, [:canvas_id], name: :index_rubric_assessments_on_canvas_id, unique: true
30
+ add_index :rubric_assessments, [:canvas_artifact_id, :canvas_artifact_type], name: :index_rubric_assessments_on_canvas_aid_and_canvas_atype
31
+ add_index :rubric_assessments, [:canvas_assessor_id], name: :index_rubric_assessments_on_canvas_assessor_id
32
+ add_index :rubric_assessments, [:canvas_rubric_association_id], name: :index_rubric_assessments_on_canvas_rubric_association_id
33
+ add_index :rubric_assessments, [:canvas_rubric_id], name: :index_rubric_assessments_on_canvas_rubric_id
34
+ add_index :rubric_assessments, [:canvas_user_id], name: :index_rubric_assessments_on_canvas_user_id
35
+ add_index :rubric_assessments, [:canvas_root_account_id], name: :index_rubric_assessments_on_canvas_root_account_id
36
+ end
37
+ end
@@ -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: 2024_04_08_223326) do
13
+ ActiveRecord::Schema.define(version: 2024_05_10_101100) do
14
14
 
15
15
  # These are extensions that must be enabled in order to support this database
16
16
  enable_extension "plpgsql"
@@ -306,6 +306,93 @@ ActiveRecord::Schema.define(version: 2024_04_08_223326) do
306
306
  t.index ["canvas_id"], name: "index_roles_on_canvas_id", unique: true
307
307
  end
308
308
 
309
+ create_table "rubrics", force: :cascade do |t|
310
+ t.bigint "canvas_id", null: false
311
+ t.bigint "canvas_user_id"
312
+ t.bigint "canvas_rubric_id"
313
+ t.bigint "canvas_context_id"
314
+ t.string "canvas_context_type"
315
+ t.text "data"
316
+ t.float "points_possible"
317
+ t.string "title"
318
+ t.text "description"
319
+ t.boolean "reusable"
320
+ t.boolean "public"
321
+ t.boolean "read_only"
322
+ t.integer "association_count"
323
+ t.boolean "free_form_criterion_comments"
324
+ t.string "context_code"
325
+ t.string "migration_id"
326
+ t.boolean "hide_score_total"
327
+ t.string "workflow_state"
328
+ t.bigint "canvas_root_account_id"
329
+ t.boolean "hide_points"
330
+ t.string "rating_order"
331
+ t.string "button_display"
332
+ t.datetime "created_at", null: false
333
+ t.datetime "updated_at", null: false
334
+ t.index "canvas_id", name: "index_rubrics_on_canvas_id", unique: true
335
+ t.index ["canvas_context_id", "canvas_context_type"], name: "index_rubrics_on_canvas_context_id_and_canvas_context_type"
336
+ t.index "canvas_rubric_id", name: "index_rubrics_on_canvas_rubric_id"
337
+ t.index "canvas_user_id", name: "index_rubrics_on_canvas_user_id"
338
+ t.index "canvas_root_account_id", name: "index_rubrics_on_canvas_root_account_id"
339
+ end
340
+
341
+ create_table "rubric_associations", force: :cascade do |t|
342
+ t.integer "canvas_id", null: false
343
+ t.integer "canvas_rubric_id"
344
+ t.integer "canvas_association_id"
345
+ t.string "canvas_association_type"
346
+ t.boolean "use_for_grading"
347
+ t.datetime "created_at"
348
+ t.datetime "updated_at"
349
+ t.string "title"
350
+ t.text "description"
351
+ t.text "summary_data"
352
+ t.string "purpose"
353
+ t.string "url"
354
+ t.integer "canvas_context_id"
355
+ t.string "canvas_context_type"
356
+ t.boolean "hide_score_total"
357
+ t.string "context_code"
358
+ t.boolean "bookmarked"
359
+ t.boolean "hide_points"
360
+ t.boolean "hide_outcome_results"
361
+ t.bigint "canvas_root_account_id"
362
+ t.string "workflow_state"
363
+ t.index ["canvas_id"], name: "index_rubric_associations_on_canvas_id", unique: true
364
+ t.index ["canvas_association_id", "canvas_association_type"], name: "index_rubric_associations_on_canvas_aid_and_canvas_atype"
365
+ t.index ["context_code"], name: "index_rubric_associations_on_context_code"
366
+ t.index ["canvas_context_id", "canvas_context_type"], name: "index_rubric_associations_on_canvas_cid_and_canvas_ctype"
367
+ t.index ["canvas_rubric_id"], name: "index_rubric_associations_on_canvas_rubric_id"
368
+ t.index ["canvas_root_account_id"], name: "index_rubric_associations_on_canvas_root_account_id"
369
+ end
370
+
371
+ create_table "rubric_assessments", force: :cascade do |t|
372
+ t.bigint "canvas_id"
373
+ t.bigint "canvas_user_id"
374
+ t.bigint "canvas_rubric_id"
375
+ t.bigint "canvas_rubric_association_id"
376
+ t.float "score"
377
+ t.text "data"
378
+ t.datetime "created_at"
379
+ t.datetime "updated_at"
380
+ t.bigint "canvas_artifact_id"
381
+ t.string "canvas_artifact_type"
382
+ t.string "assessment_type"
383
+ t.bigint "canvas_assessor_id"
384
+ t.integer "artifact_attempt"
385
+ t.boolean "hide_points"
386
+ t.bigint "canvas_root_account_id"
387
+ t.index ["canvas_id"], name: "index_rubric_assessments_on_canvas_id", unique: true
388
+ t.index ["canvas_artifact_id", "canvas_artifact_type"], name: "index_rubric_assessments_on_canvas_aid_and_canvas_atype"
389
+ t.index ["canvas_assessor_id"], name: "index_rubric_assessments_on_canvas_assessor_id"
390
+ t.index ["canvas_rubric_association_id"], name: "index_rubric_assessments_on_canvas_rubric_association_id"
391
+ t.index ["canvas_rubric_id"], name: "index_rubric_assessments_on_canvas_rubric_id"
392
+ t.index ["canvas_user_id"], name: "index_rubric_assessments_on_canvas_user_id"
393
+ t.index ["canvas_root_account_id"], name: "index_rubric_assessments_on_canvas_root_account_id"
394
+ end
395
+
309
396
  create_table "sections", force: :cascade do |t|
310
397
  t.bigint "canvas_id", null: false
311
398
  t.string "sis_id"
@@ -0,0 +1,3 @@
1
+ id,user_id,rubric_id,rubric_association_id,score,data,created_at,updated_at,artifact_id,artifact_type,assessment_type,assessor_id,artifact_attempt,hide_points,root_account_id,
2
+ 1,1,1,1,10,"","2019-09-0900:00:00","2019-09-0900:00:00",1,"Assignment","grading",1,1,0,1
3
+ 2,2,2,2,5,"","2019-09-0900:00:00","2019-09-0900:00:00",1,"Assignment","grading",1,1,0,1
@@ -0,0 +1,3 @@
1
+ id,rubric_id,association_id,association_type,use_for_grading,created_at,updated_at,title,summary_data,purpose,url,context_id,context_type,hide_score_total,bookmarked,context_code,hide_points,hide_outcome_results,root_account_id,workflow_state
2
+ 1,1,1,Assignment,0,2024-01-01T00:00:00Z,2024-01-01T00:00:00Z,"Rubric Association Title","Rubric Association Summary Data","Rubric Association Purpose","Rubric Association URL",1,Course,0,0,"Context Code",0,0,1,active
3
+ 2,2,2,Assignment,0,2024-01-01T00:00:00Z,2024-01-01T00:00:00Z,"Rubric Association Title 2","Rubric Association Summary Data 2","Rubric Association Purpose","Rubric Association URL",1,Course,0,0,"Context Code",0,0,1,active
@@ -0,0 +1,3 @@
1
+ id,user_id,rubric_id,context_id,context_type,data,points_possible,title,description,created_at,updated_at,reusable,public,read_only,association_count,free_form_criterion_comments,context_code,migration_id,hide_score_total,workflow_state,root_account_id
2
+ 1,1,1,1,Assignment,,"10","Assignment 1","Assignment 1 description","2013-01-01 00:00:00","2013-01-01 00:00:00",0,0,0,0,0,"Context code 1",1,0,0,1
3
+ 2,1,1,1,Assignment,,"10","Assignment 2","Assignment 2 description","2013-01-01 00:00:00","2013-01-01 00:00:00",0,0,0,0,0,"Context code 2",2,0,0,2