canvas_sync 0.2.2 → 0.2.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a0780224f72afc0ad3ea1f5cafa3646b46bd4fb4
4
- data.tar.gz: 2ca1592e6775e66eba9dc6f6c827db826f800014
3
+ metadata.gz: 430c8ec60a8869bd4c7ed65b24057496793115af
4
+ data.tar.gz: cde2e6c7f4016df8b4d2c225e35469e750f3f4d3
5
5
  SHA512:
6
- metadata.gz: 9c0467c8a2e272692cf978f70abb24372caef8a5c7b1684a0906ff0c5e2d63a98e3232e587d3663dc828cb2786a72d79ed04605243041e4a95adf782a8214cc1
7
- data.tar.gz: 4bd4a204f5186bb38614846297b5ae74eb59ba0b6c520f303f4a550a69d160365c839cbf92e7e9a31bba4b0b1334afbcd50b53973d5d6632f99be2d45dbe574e
6
+ metadata.gz: '08ca7f817cbcf1ce58cf0c0c8fee4fe4afe9c1f09fbc2b89859f4fdc0332f9430d02c8ee800caf30caecd06a4a8e8a42db31bdf0d6016c7ece0cad344da0287c'
7
+ data.tar.gz: 3c7528cad8053d81c6e95f6e8126d872e1334cb8793521cf1b9027a5eadc16962504a4db78d1470a780ce752e683165b2d136e252c6b85ea9c9a878e4470b900
data/README.md CHANGED
@@ -57,6 +57,8 @@ Once that's done and you've used the generator to create your models and migrati
57
57
  CanvasSync.provisioning_sync(<array of models to sync>, term_scope: <optional term scope>)
58
58
  ```
59
59
 
60
+ Note: pass in 'xlist' if you would like sections to include cross listing information
61
+
60
62
  Example:
61
63
 
62
64
  ```ruby
@@ -6,6 +6,7 @@ class CreateSections < ActiveRecord::Migration[5.1]
6
6
  t.bigint :canvas_section_id, null: false
7
7
  t.string :sis_id
8
8
  t.bigint :canvas_course_id
9
+ t.bigint :canvas_nonxlist_course_id
9
10
  t.string :name
10
11
  t.string :status
11
12
  t.datetime :start_date
@@ -54,6 +54,11 @@ module CanvasSync
54
54
  end_date: :end_date
55
55
  }
56
56
 
57
+ XLIST_CSV_MAPPING = {
58
+ canvas_section_id: :canvas_section_id,
59
+ canvas_nonxlist_course_id: :canvas_nonxlist_course_id
60
+ }
61
+
57
62
  # Processes a provisioning report using the bulk importer.
58
63
  #
59
64
  # options must contain a models key. If there is only one model
@@ -142,6 +147,15 @@ module CanvasSync
142
147
  :canvas_section_id
143
148
  )
144
149
  end
150
+
151
+ def bulk_process_xlist(report_file_path)
152
+ CanvasSync::Importers::BulkImporter.import(
153
+ report_file_path,
154
+ XLIST_CSV_MAPPING,
155
+ Section,
156
+ :canvas_section_id,
157
+ )
158
+ end
145
159
  end
146
160
  end
147
161
  end
@@ -1,3 +1,3 @@
1
1
  module CanvasSync
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
@@ -28,6 +28,14 @@ RSpec.describe CanvasSync::Processors::ProvisioningReportProcessor do
28
28
  }.to change { Section.count }.by(2)
29
29
  end
30
30
 
31
+ it 'processes xlist' do
32
+ subject.process('spec/support/fixtures/reports/xlist.csv', { models: ['xlist'] })
33
+ expect(Section.where.not(canvas_nonxlist_course_id: nil).count).to eq 1
34
+ cross_listed_section = Section.where.not(canvas_nonxlist_course_id: nil).first
35
+ expect(cross_listed_section.canvas_section_id).to eq 2
36
+ expect(cross_listed_section.canvas_nonxlist_course_id).to eq 2
37
+ end
38
+
31
39
  context 'options[:models] is multiple models' do
32
40
  it 'extracts the ZIP and processes each model' do
33
41
  user_count = User.count
@@ -12,6 +12,7 @@ class CreateSections < ActiveRecord::Migration[5.1]
12
12
  t.bigint :canvas_section_id, null: false
13
13
  t.string :sis_id
14
14
  t.bigint :canvas_course_id
15
+ t.bigint :canvas_nonxlist_course_id
15
16
  t.string :name
16
17
  t.string :status
17
18
  t.datetime :start_date
@@ -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: 20170918221413) do
13
+ ActiveRecord::Schema.define(version: 20171107213207) do
14
14
 
15
15
  create_table "canvas_sync_job_logs", force: :cascade do |t|
16
16
  t.datetime "started_at"
@@ -64,6 +64,7 @@ ActiveRecord::Schema.define(version: 20170918221413) do
64
64
  t.bigint "canvas_section_id", null: false
65
65
  t.string "sis_id"
66
66
  t.bigint "canvas_course_id"
67
+ t.bigint "canvas_nonxlist_course_id"
67
68
  t.string "name"
68
69
  t.string "status"
69
70
  t.datetime "start_date"
@@ -0,0 +1,2 @@
1
+ canvas_xlist_course_id,xlist_course_id,canvas_section_id,section_id,status,canvas_nonxlist_course_id,nonxlist_course_id
2
+ 1,sis_course_1,2,sis_section_2,active,2,sis_course_2
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.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nate Collings
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-02 00:00:00.000000000 Z
11
+ date: 2017-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -349,9 +349,9 @@ files:
349
349
  - spec/dummy/db/development.sqlite3
350
350
  - spec/dummy/db/migrate/20170905192509_create_enrollments.rb
351
351
  - spec/dummy/db/migrate/20170906193506_create_terms.rb
352
- - spec/dummy/db/migrate/20170906203438_create_sections.rb
353
352
  - spec/dummy/db/migrate/20170914181345_create_courses.rb
354
353
  - spec/dummy/db/migrate/20170918221413_create_users.rb
354
+ - spec/dummy/db/migrate/20171107213207_create_sections.rb
355
355
  - spec/dummy/db/schema.rb
356
356
  - spec/dummy/db/test.sqlite3
357
357
  - spec/dummy/log/development.log
@@ -371,6 +371,7 @@ files:
371
371
  - spec/support/fixtures/reports/provisioning_csv_unzipped/users.csv
372
372
  - spec/support/fixtures/reports/sections.csv
373
373
  - spec/support/fixtures/reports/users.csv
374
+ - spec/support/fixtures/reports/xlist.csv
374
375
  homepage: https://instructure.com
375
376
  licenses: []
376
377
  metadata: {}
@@ -433,9 +434,9 @@ test_files:
433
434
  - spec/dummy/db/development.sqlite3
434
435
  - spec/dummy/db/migrate/20170905192509_create_enrollments.rb
435
436
  - spec/dummy/db/migrate/20170906193506_create_terms.rb
436
- - spec/dummy/db/migrate/20170906203438_create_sections.rb
437
437
  - spec/dummy/db/migrate/20170914181345_create_courses.rb
438
438
  - spec/dummy/db/migrate/20170918221413_create_users.rb
439
+ - spec/dummy/db/migrate/20171107213207_create_sections.rb
439
440
  - spec/dummy/db/schema.rb
440
441
  - spec/dummy/db/test.sqlite3
441
442
  - spec/dummy/log/development.log
@@ -455,3 +456,4 @@ test_files:
455
456
  - spec/support/fixtures/reports/provisioning_csv_unzipped/users.csv
456
457
  - spec/support/fixtures/reports/sections.csv
457
458
  - spec/support/fixtures/reports/users.csv
459
+ - spec/support/fixtures/reports/xlist.csv