canvas_sync 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/canvas_sync/generators/templates/create_sections.rb +1 -0
- data/lib/canvas_sync/processors/provisioning_report_processor.rb +14 -0
- data/lib/canvas_sync/version.rb +1 -1
- data/spec/canvas_sync/processors/provisioning_report_processor_spec.rb +8 -0
- data/spec/dummy/db/migrate/{20170906203438_create_sections.rb → 20171107213207_create_sections.rb} +1 -0
- data/spec/dummy/db/schema.rb +2 -1
- data/spec/support/fixtures/reports/xlist.csv +2 -0
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 430c8ec60a8869bd4c7ed65b24057496793115af
|
4
|
+
data.tar.gz: cde2e6c7f4016df8b4d2c225e35469e750f3f4d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
@@ -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
|
data/lib/canvas_sync/version.rb
CHANGED
@@ -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
|
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: 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"
|
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.
|
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-
|
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
|