canvas_sync 0.20.1 → 0.20.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6d62d3319fd41f63dfadc619b59f28949b9e418f4017c0ca395ba98f62cea3a5
4
- data.tar.gz: 789f76fc7c75a901a93e841fe1d883c635af40e1772191e30682e1837d92ca7e
3
+ metadata.gz: 43303b8631013b7ccf949d391e027e98fb8c18abfbd36f22cddedc8ee2bfda7d
4
+ data.tar.gz: 35ded010f078affa8a164f7168c313318e90c9c1415afbc1c049a059912204d5
5
5
  SHA512:
6
- metadata.gz: 373e4d1f08b87e585620625aa0fd15fd153fbd277b8ee81f195333a0fbc7e9e2b24aa558d63e06b9b71bbe9cbffa2f7f10f3a5b7c7a82f33566b515762356cc2
7
- data.tar.gz: 856f8387e65df480460780a881d20764fce8dc7c78878940ba46f6b58cf6012be83cbb824c3cc5dd1c995b798a41b35492d9ab77c9194332a0748ace9dbca608
6
+ metadata.gz: 214cf249fbadc69713bd7a29159874fc64891e886438f72a43f02c08d2f45b46f8d52fd7c3916d12fe260d94f669df42a1f9c46f69c8c56915760fd73878ff14
7
+ data.tar.gz: b8c1b5b0038f12a676704e8b957894441f9566dfcfa1a91132436520aa12b0d86590a57f5d74fccc27f769fc82b1530ad908e88693d2213b7888ad739e07a087
@@ -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,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
@@ -569,6 +569,79 @@ learning_outcomes:
569
569
  database_column_name: short_description
570
570
  type: text
571
571
 
572
+ learning_outcome_results:
573
+ conflict_target: id
574
+ report_columns:
575
+ id:
576
+ database_column_name: canvas_id
577
+ type: integer
578
+ context_id:
579
+ database_column_name: canvas_context_id
580
+ type: integer
581
+ context_type:
582
+ database_column_name: canvas_context_type
583
+ type: string
584
+ association_id:
585
+ database_column_name: canvas_association_id
586
+ type: integer
587
+ association_type:
588
+ database_column_name: canvas_association_type
589
+ type: string
590
+ content_tag_id:
591
+ database_column_name: canvas_content_tag_id
592
+ type: integer
593
+ learning_outcome_id:
594
+ database_column_name: canvas_learning_outcome_id
595
+ type: integer
596
+ user_id:
597
+ database_column_name: canvas_user_id
598
+ type: integer
599
+ mastery:
600
+ database_column_name: mastery
601
+ type: boolean
602
+ original_mastery:
603
+ database_column_name: original_mastery
604
+ type: boolean
605
+ artifact_id:
606
+ database_column_name: canvas_artifact_id
607
+ type: integer
608
+ artifact_type:
609
+ database_column_name: canvas_artifact_type
610
+ type: string
611
+ assessed_at:
612
+ database_column_name: assessed_at
613
+ type: datetime
614
+ title:
615
+ database_column_name: title
616
+ type: string
617
+ percent:
618
+ database_column_name: percent
619
+ type: float
620
+ associated_asset_id:
621
+ database_column_name: canvas_associated_asset_id
622
+ type: integer
623
+ associated_asset_type:
624
+ database_column_name: canvas_associated_asset_type
625
+ type: string
626
+ attempt:
627
+ database_column_name: attempt
628
+ type: integer
629
+ score:
630
+ database_column_name: score
631
+ type: float
632
+ possible:
633
+ database_column_name: possible
634
+ type: float
635
+ original_score:
636
+ database_column_name: original_score
637
+ type: float
638
+ original_possible:
639
+ database_column_name: original_possible
640
+ type: float
641
+ workflow_state:
642
+ database_column_name: workflow_state
643
+ type: string
644
+
572
645
  course_nicknames:
573
646
  conflict_target:
574
647
  - canvas_user_id
@@ -124,6 +124,10 @@ module CanvasSync
124
124
  end
125
125
  end
126
126
 
127
+ def bulk_process_learning_outcome_results(report_file_path)
128
+ do_bulk_import(report_file_path, LearningOutcomeResult, options: @options)
129
+ end
130
+
127
131
  def bulk_process_course_nicknames(report_file_path)
128
132
  exists = []
129
133
  do_bulk_import(report_file_path, CourseNickname, options: @options) do |row|
@@ -1,3 +1,3 @@
1
1
  module CanvasSync
2
- VERSION = "0.20.1".freeze
2
+ VERSION = "0.20.3".freeze
3
3
  end
data/lib/canvas_sync.rb CHANGED
@@ -46,6 +46,7 @@ module CanvasSync
46
46
  grading_period_groups
47
47
  content_migrations
48
48
  learning_outcomes
49
+ learning_outcome_results
49
50
  course_nicknames
50
51
  rubrics
51
52
  rubric_associations
@@ -214,7 +215,7 @@ module CanvasSync
214
215
  end
215
216
 
216
217
  current_chain.insert(
217
- generate_provisioning_jobs(models, options)
218
+ generate_provisioning_jobs(models - ['terms'], options)
218
219
  )
219
220
 
220
221
  # Skip syncing terms if not required
@@ -131,6 +131,18 @@ RSpec.describe CanvasSync::Processors::ProvisioningReportProcessor do
131
131
  }.to change { LearningOutcome.count }.by(2)
132
132
  end
133
133
 
134
+ it 'processes learning_outcome_results' do
135
+ expect {
136
+ subject.process('spec/support/fixtures/reports/learning_outcome_results.csv', { models: ['learning_outcome_results'] }, 1)
137
+ }.to change { LearningOutcomeResult.count }.by(2)
138
+
139
+ columns = LearningOutcomeResult.attribute_names - ['id', 'created_at', 'updated_at']
140
+ expect(LearningOutcomeResult.all.pluck(columns.join(','))).to eq([
141
+ [1, 1, 'Course', 1, 'RubricAssociation', 1, 1, 1, true, true, 1, 'RubricAssessment', '2012-01-01T00:00:00Z', 'Learning Outcome Result 1', 1.0, 1, 'LearningOutcomeGroup', 1, 5.0, 5.0, 5.0, 5.0, 'active'],
142
+ [2, 2, 'Course', 2, 'RubricAssociation', 2, 2, 2, true, true, 2, 'RubricAssessment', '2013-01-01T00:00:00Z', 'Learning Outcome Result 2', 2.0, 2, 'LearningOutcomeGroup', 1, 10.0, 10.0, 10.0, 10.0, 'active']
143
+ ])
144
+ end
145
+
134
146
  it 'processes course_nicknames' do
135
147
  CourseNickname.create(canvas_user_preference_value_id: 42, canvas_course_id: 42, canvas_user_id: 42, nickname: 'test')
136
148
  expect(CourseNickname.all.pluck(:canvas_user_preference_value_id)).to include(42)
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ # # #
4
+ # AUTO GENERATED MIGRATION
5
+ # This migration was auto generated by the CanvasSync Gem.
6
+ # You can add new columns to this table, but removing or
7
+ # re-naming ones created here may break Canvas Syncing.
8
+ #
9
+
10
+
11
+ class LearningOutcomeResult < ActiveRecord::Base
12
+ include CanvasSync::Record
13
+ include CanvasSync::Concerns::ApiSyncable
14
+
15
+ belongs_to :user, primary_key: :canvas_id, foreign_key: :canvas_user_id, optional: true
16
+ belongs_to :learning_outcome, primary_key: :canvas_id, foreign_key: :canvas_learning_outcome_id, optional: true
17
+ belongs_to :alignment, class_name: "ContentTag", primary_key: :canvas_id, foreign_key: :canvas_content_tag_id, optional: true
18
+ belongs_to :association_object,
19
+ polymorphic: [:rubric_association, :assignment],
20
+ foreign_key: :association_id,
21
+ foreign_type: :association_type,
22
+ optional: true
23
+ belongs_to :artifact,
24
+ polymorphic: [:rubric_assessment, :submission],
25
+ primary_key: :canvas_artifact_id,
26
+ foreign_key: :canvas_artifact_id,
27
+ foreign_type: :canvas_artifact_type,
28
+ optional: true
29
+
30
+ belongs_to :context, polymorphic: [:course], primary_key: :canvas_id, foreign_key: :canvas_context_id, foreign_type: :canvas_context_type, optional: true
31
+
32
+ # Not yet implemented in CanvasSync
33
+ # belongs_to :associated_asset,
34
+ # polymorphic:
35
+ # [:assessment_question,
36
+ # :assignment,
37
+ # { quiz: "Quizzes::Quiz", assessment: "LiveAssessments::Assessment" }],
38
+ # polymorphic_prefix: true
39
+
40
+ # Not yet implemented in CanvasSync
41
+ # has_many :learning_outcome_question_results, dependent: :destroy
42
+
43
+ api_syncable({
44
+ canvas_id: :id,
45
+ canvas_content_tag_id: :links&.[]("alignment"),
46
+ canvas_learning_outcome_id: :links&.[]("learning_outcome"),
47
+ canvas_user_id: :links&.[]("user"),
48
+ score: :score,
49
+ assessed_at: :submitted_or_assessed_at,
50
+ percent: :percent
51
+ }, ->(api) {
52
+ api.get("/api/v1/courses/#{self.canvas_context_id}/#{self.canvas_id}")&.find { |item| item[:id] == self.canvas_id }
53
+ })
54
+ end
@@ -0,0 +1,52 @@
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 CreateLearningOutcomeResults < ActiveRecord::Migration[5.1]
10
+ def change
11
+ create_table :learning_outcome_results do |t|
12
+ t.bigint :canvas_id, null: false
13
+ t.bigint :canvas_context_id
14
+ t.string :canvas_context_type
15
+ t.bigint :canvas_association_id
16
+ t.string :canvas_association_type
17
+ t.bigint :canvas_content_tag_id
18
+ t.bigint :canvas_learning_outcome_id
19
+ t.bigint :canvas_user_id
20
+ t.boolean :mastery
21
+ t.boolean :original_mastery
22
+ t.bigint :canvas_artifact_id
23
+ t.string :canvas_artifact_type
24
+ t.datetime :assessed_at
25
+ t.string :title
26
+ t.float :percent
27
+ t.bigint :canvas_associated_asset_id
28
+ t.string :canvas_associated_asset_type
29
+ t.integer :attempt
30
+ t.float :score
31
+ t.float :possible
32
+ t.float :original_score
33
+ t.float :original_possible
34
+ t.string :workflow_state
35
+
36
+ t.timestamps
37
+ end
38
+
39
+ add_index :learning_outcome_results, :canvas_id, unique: true
40
+ add_index :learning_outcome_results, %i[
41
+ canvas_user_id
42
+ canvas_content_tag_id
43
+ canvas_association_id
44
+ canvas_association_type
45
+ canvas_associated_asset_id
46
+ canvas_associated_asset_type
47
+ ], unique: true, name: :index_learning_outcome_results_association
48
+ add_index :learning_outcome_results, :canvas_content_tag_id
49
+ add_index :learning_outcome_results, :canvas_learning_outcome_id
50
+ add_index :learning_outcome_results, %i[canvas_artifact_id canvas_artifact_type], name: :index_learning_outcome_results_on_canvas_arid_and_artype
51
+ end
52
+ 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_05_10_101100) do
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"
@@ -282,6 +282,46 @@ ActiveRecord::Schema.define(version: 2024_05_10_101100) do
282
282
  t.index ["canvas_id"], name: "index_learning_outcomes_on_canvas_id", unique: true
283
283
  end
284
284
 
285
+ create_table "learning_outcome_results", force: :cascade do |t|
286
+ t.bigint "canvas_id", null: false
287
+ t.bigint "canvas_context_id"
288
+ t.string "canvas_context_type"
289
+ t.bigint "canvas_association_id"
290
+ t.string "canvas_association_type"
291
+ t.bigint "canvas_content_tag_id"
292
+ t.bigint "canvas_learning_outcome_id"
293
+ t.bigint "canvas_user_id"
294
+ t.boolean "mastery"
295
+ t.boolean "original_mastery"
296
+ t.bigint "canvas_artifact_id"
297
+ t.string "canvas_artifact_type"
298
+ t.datetime "assessed_at"
299
+ t.string "title"
300
+ t.float "percent"
301
+ t.bigint "canvas_associated_asset_id"
302
+ t.string "canvas_associated_asset_type"
303
+ t.integer "attempt"
304
+ t.float "score"
305
+ t.float "possible"
306
+ t.float "original_score"
307
+ t.float "original_possible"
308
+ t.string "workflow_state"
309
+ t.datetime "created_at", null: false
310
+ t.datetime "updated_at", null: false
311
+ t.index "canvas_id", unique: true
312
+ t.index [
313
+ "canvas_user_id",
314
+ "canvas_content_tag_id",
315
+ "canvas_association_id",
316
+ "canvas_association_type",
317
+ "canvas_associated_asset_id",
318
+ "canvas_associated_asset_type"
319
+ ], unique: true, name: 'index_learning_outcome_results_association'
320
+ t.index "canvas_content_tag_id"
321
+ t.index "canvas_learning_outcome_id"
322
+ t.index ["canvas_artifact_id", "canvas_artifact_type"], name: "index_learning_outcome_results_on_canvas_arid_and_artype"
323
+ end
324
+
285
325
  create_table "pseudonyms", force: :cascade do |t|
286
326
  t.bigint "canvas_id", null: false
287
327
  t.bigint "canvas_user_id"
@@ -0,0 +1,3 @@
1
+ id,context_id,context_type,association_id,association_type,content_tag_id,learning_outcome_id,user_id,mastery,original_mastery,artifact_id,artifact_type,assessed_at,title,percent,associated_asset_id,associated_asset_type,attempt,score,possible,original_score,original_possible,workflow_state
2
+ 1,1,Course,1,RubricAssociation,1,1,1,true,true,1,RubricAssessment,2012-01-01T00:00:00Z,Learning Outcome Result 1,1.0,1,LearningOutcomeGroup,1,5.0,5.0,5.0,5.0,active
3
+ 2,2,Course,2,RubricAssociation,2,2,2,true,true,2,RubricAssessment,2013-01-01T00:00:00Z,Learning Outcome Result 2,2.0,2,LearningOutcomeGroup,1,10.0,10.0,10.0,10.0,active
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: canvas_sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.1
4
+ version: 0.20.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Instructure CustomDev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-28 00:00:00.000000000 Z
11
+ date: 2024-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -437,6 +437,7 @@ files:
437
437
  - lib/canvas_sync/generators/templates/migrations/create_grading_periods.rb
438
438
  - lib/canvas_sync/generators/templates/migrations/create_group_memberships.rb
439
439
  - lib/canvas_sync/generators/templates/migrations/create_groups.rb
440
+ - lib/canvas_sync/generators/templates/migrations/create_learning_outcome_results.rb
440
441
  - lib/canvas_sync/generators/templates/migrations/create_learning_outcomes.rb
441
442
  - lib/canvas_sync/generators/templates/migrations/create_pseudonyms.rb
442
443
  - lib/canvas_sync/generators/templates/migrations/create_roles.rb
@@ -463,6 +464,7 @@ files:
463
464
  - lib/canvas_sync/generators/templates/models/group.rb
464
465
  - lib/canvas_sync/generators/templates/models/group_membership.rb
465
466
  - lib/canvas_sync/generators/templates/models/learning_outcome.rb
467
+ - lib/canvas_sync/generators/templates/models/learning_outcome_result.rb
466
468
  - lib/canvas_sync/generators/templates/models/pseudonym.rb
467
469
  - lib/canvas_sync/generators/templates/models/role.rb
468
470
  - lib/canvas_sync/generators/templates/models/rubric.rb
@@ -621,6 +623,7 @@ files:
621
623
  - spec/dummy/app/models/group.rb
622
624
  - spec/dummy/app/models/group_membership.rb
623
625
  - spec/dummy/app/models/learning_outcome.rb
626
+ - spec/dummy/app/models/learning_outcome_result.rb
624
627
  - spec/dummy/app/models/pseudonym.rb
625
628
  - spec/dummy/app/models/role.rb
626
629
  - spec/dummy/app/models/rubric.rb
@@ -698,6 +701,7 @@ files:
698
701
  - spec/dummy/db/migrate/20240509105100_create_rubrics.rb
699
702
  - spec/dummy/db/migrate/20240510094100_create_rubric_associations.rb
700
703
  - spec/dummy/db/migrate/20240510101100_create_rubric_assessments.rb
704
+ - spec/dummy/db/migrate/20240523101010_create_learning_outcome_results.rb
701
705
  - spec/dummy/db/schema.rb
702
706
  - spec/factories/account_factory.rb
703
707
  - spec/factories/admin_factory.rb
@@ -749,6 +753,7 @@ files:
749
753
  - spec/support/fixtures/reports/grading_periods.csv
750
754
  - spec/support/fixtures/reports/group_memberships.csv
751
755
  - spec/support/fixtures/reports/groups.csv
756
+ - spec/support/fixtures/reports/learning_outcome_results.csv
752
757
  - spec/support/fixtures/reports/learning_outcomes.csv
753
758
  - spec/support/fixtures/reports/provisioning_csv
754
759
  - spec/support/fixtures/reports/provisioning_csv_unzipped/courses.csv
@@ -866,6 +871,7 @@ test_files:
866
871
  - spec/support/fixtures/reports/group_memberships.csv
867
872
  - spec/support/fixtures/reports/rubric_assessments.csv
868
873
  - spec/support/fixtures/reports/enrollments.csv
874
+ - spec/support/fixtures/reports/learning_outcome_results.csv
869
875
  - spec/support/fixtures/reports/course_nicknames.csv
870
876
  - spec/support/fixtures/reports/provisioning_csv
871
877
  - spec/support/fixtures/reports/grading_periods.csv
@@ -896,6 +902,7 @@ test_files:
896
902
  - spec/dummy/db/migrate/20190927204545_create_roles.rb
897
903
  - spec/dummy/db/migrate/20190702203622_create_accounts.rb
898
904
  - spec/dummy/db/migrate/20190702203626_create_assignments.rb
905
+ - spec/dummy/db/migrate/20240523101010_create_learning_outcome_results.rb
899
906
  - spec/dummy/db/migrate/20200415171620_create_groups.rb
900
907
  - spec/dummy/db/migrate/20190927204546_create_admins.rb
901
908
  - spec/dummy/db/migrate/20190702203625_create_sections.rb
@@ -946,6 +953,7 @@ test_files:
946
953
  - spec/dummy/app/models/admin.rb
947
954
  - spec/dummy/app/models/rubric_assessment.rb
948
955
  - spec/dummy/app/models/learning_outcome.rb
956
+ - spec/dummy/app/models/learning_outcome_result.rb
949
957
  - spec/dummy/app/models/grading_period.rb
950
958
  - spec/dummy/app/models/context_module.rb
951
959
  - spec/dummy/app/models/context_module_item.rb