canvas_sync 0.10.2 → 0.10.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/canvas_sync/generators/install_live_events_generator.rb +5 -1
- data/lib/canvas_sync/generators/templates/migrations/create_accounts.rb +1 -1
- data/lib/canvas_sync/generators/templates/migrations/create_admins.rb +1 -1
- data/lib/canvas_sync/generators/templates/migrations/create_assignment_groups.rb +1 -1
- data/lib/canvas_sync/generators/templates/migrations/create_assignments.rb +1 -1
- data/lib/canvas_sync/generators/templates/migrations/create_context_module_items.rb +1 -1
- data/lib/canvas_sync/generators/templates/migrations/create_context_modules.rb +1 -1
- data/lib/canvas_sync/generators/templates/migrations/create_courses.rb +1 -1
- data/lib/canvas_sync/generators/templates/migrations/create_enrollments.rb +1 -1
- data/lib/canvas_sync/generators/templates/migrations/create_roles.rb +1 -1
- data/lib/canvas_sync/generators/templates/migrations/create_sections.rb +1 -1
- data/lib/canvas_sync/generators/templates/migrations/create_submissions.rb +1 -1
- data/lib/canvas_sync/generators/templates/migrations/create_terms.rb +1 -1
- data/lib/canvas_sync/generators/templates/migrations/create_users.rb +1 -1
- data/lib/canvas_sync/generators/templates/models/account.rb +1 -1
- data/lib/canvas_sync/generators/templates/models/admin.rb +1 -1
- data/lib/canvas_sync/generators/templates/models/assignment.rb +1 -1
- data/lib/canvas_sync/generators/templates/models/assignment_group.rb +1 -1
- data/lib/canvas_sync/generators/templates/models/context_module.rb +8 -1
- data/lib/canvas_sync/generators/templates/models/context_module_item.rb +8 -1
- data/lib/canvas_sync/generators/templates/models/course.rb +1 -1
- data/lib/canvas_sync/generators/templates/models/enrollment.rb +1 -1
- data/lib/canvas_sync/generators/templates/models/role.rb +1 -1
- data/lib/canvas_sync/generators/templates/models/section.rb +2 -1
- data/lib/canvas_sync/generators/templates/models/submission.rb +1 -1
- data/lib/canvas_sync/generators/templates/models/term.rb +1 -1
- data/lib/canvas_sync/generators/templates/models/user.rb +1 -1
- data/lib/canvas_sync/generators/templates/services/live_events/assignment_event.rb +33 -0
- data/lib/canvas_sync/generators/templates/services/live_events/assignment_group_event.rb +24 -0
- data/lib/canvas_sync/generators/templates/services/live_events/base_event.rb +22 -0
- data/lib/canvas_sync/generators/templates/services/live_events/course_event.rb +20 -0
- data/lib/canvas_sync/generators/templates/services/live_events/course_section_event.rb +18 -0
- data/lib/canvas_sync/generators/templates/services/live_events/enrollment_event.rb +20 -0
- data/lib/canvas_sync/generators/templates/services/live_events/grade_event.rb +26 -0
- data/lib/canvas_sync/generators/templates/services/live_events/module_event.rb +16 -0
- data/lib/canvas_sync/generators/templates/services/live_events/module_item_event.rb +15 -0
- data/lib/canvas_sync/generators/templates/services/live_events/submission_event.rb +18 -0
- data/lib/canvas_sync/generators/templates/services/live_events/syllabus_event.rb +21 -0
- data/lib/canvas_sync/generators/templates/services/live_events/user_event.rb +19 -0
- data/lib/canvas_sync/version.rb +1 -1
- data/spec/canvas_sync/services/module_event_spec.rb +2 -2
- data/spec/canvas_sync/services/module_item_event_spec.rb +2 -2
- data/spec/dummy/app/models/account.rb +1 -1
- data/spec/dummy/app/models/admin.rb +1 -1
- data/spec/dummy/app/models/assignment.rb +1 -1
- data/spec/dummy/app/models/assignment_group.rb +3 -2
- data/spec/dummy/app/models/context_module.rb +8 -1
- data/spec/dummy/app/models/context_module_item.rb +8 -1
- data/spec/dummy/app/models/course.rb +1 -1
- data/spec/dummy/app/models/enrollment.rb +1 -1
- data/spec/dummy/app/models/role.rb +1 -1
- data/spec/dummy/app/models/section.rb +2 -1
- data/spec/dummy/app/models/submission.rb +1 -1
- data/spec/dummy/app/models/term.rb +1 -1
- data/spec/dummy/app/models/user.rb +1 -1
- data/spec/dummy/app/services/live_events/assignment_event.rb +19 -36
- data/spec/dummy/app/services/live_events/base_event.rb +26 -0
- data/spec/dummy/app/services/live_events/course_event.rb +15 -27
- data/spec/dummy/app/services/live_events/course_section_event.rb +13 -39
- data/spec/dummy/app/services/live_events/enrollment_event.rb +17 -48
- data/spec/dummy/app/services/live_events/grade_event.rb +9 -34
- data/spec/dummy/app/services/live_events/module_event.rb +10 -29
- data/spec/dummy/app/services/live_events/module_item_event.rb +10 -28
- data/spec/dummy/app/services/live_events/submission_event.rb +12 -42
- data/spec/dummy/app/services/live_events/syllabus_event.rb +11 -20
- data/spec/dummy/app/services/live_events/user_event.rb +14 -25
- data/spec/dummy/db/migrate/{20190603215718_create_users.rb → 20190702203620_create_users.rb} +1 -1
- data/spec/dummy/db/migrate/{20190603220011_create_courses.rb → 20190702203621_create_courses.rb} +1 -1
- data/spec/dummy/db/migrate/{20190604193942_create_accounts.rb → 20190702203622_create_accounts.rb} +1 -1
- data/spec/dummy/db/migrate/{20190603215721_create_terms.rb → 20190702203623_create_terms.rb} +1 -1
- data/spec/dummy/db/migrate/{20190603220013_create_enrollments.rb → 20190702203624_create_enrollments.rb} +1 -1
- data/spec/dummy/db/migrate/{20190603215722_create_sections.rb → 20190702203625_create_sections.rb} +1 -1
- data/spec/dummy/db/migrate/{20190603192310_create_assignments.rb → 20190702203626_create_assignments.rb} +1 -1
- data/spec/dummy/db/migrate/{20190521003447_create_submissions.rb → 20190702203627_create_submissions.rb} +1 -1
- data/spec/dummy/db/migrate/{20190606161037_create_roles.rb → 20190702203628_create_roles.rb} +1 -1
- data/spec/dummy/db/migrate/{20190521003449_create_admins.rb → 20190702203629_create_admins.rb} +1 -1
- data/spec/dummy/db/migrate/{20190521003450_create_assignment_groups.rb → 20190702203630_create_assignment_groups.rb} +1 -1
- data/spec/dummy/db/migrate/{20190521003451_create_context_modules.rb → 20190702203631_create_context_modules.rb} +1 -1
- data/spec/dummy/db/migrate/{20190603193502_create_context_module_items.rb → 20190702203632_create_context_module_items.rb} +1 -1
- data/spec/dummy/db/schema.rb +1 -1
- metadata +41 -67
- data/lib/canvas_sync/generators/templates/services/live_events/assignment/assignment_created_event.rb +0 -6
- data/lib/canvas_sync/generators/templates/services/live_events/assignment/assignment_event.rb +0 -54
- data/lib/canvas_sync/generators/templates/services/live_events/assignment/assignment_updated_event.rb +0 -6
- data/lib/canvas_sync/generators/templates/services/live_events/course/course_created_event.rb +0 -6
- data/lib/canvas_sync/generators/templates/services/live_events/course/course_event.rb +0 -36
- data/lib/canvas_sync/generators/templates/services/live_events/course/course_updated_event.rb +0 -6
- data/lib/canvas_sync/generators/templates/services/live_events/course_section/course_section_created_event.rb +0 -6
- data/lib/canvas_sync/generators/templates/services/live_events/course_section/course_section_event.rb +0 -48
- data/lib/canvas_sync/generators/templates/services/live_events/course_section/course_section_updated_event.rb +0 -6
- data/lib/canvas_sync/generators/templates/services/live_events/enrollment/enrollment_created_event.rb +0 -6
- data/lib/canvas_sync/generators/templates/services/live_events/enrollment/enrollment_event.rb +0 -55
- data/lib/canvas_sync/generators/templates/services/live_events/enrollment/enrollment_updated_event.rb +0 -6
- data/lib/canvas_sync/generators/templates/services/live_events/grade/grade_changed_event.rb +0 -6
- data/lib/canvas_sync/generators/templates/services/live_events/grade/grade_event.rb +0 -55
- data/lib/canvas_sync/generators/templates/services/live_events/module/module_created_event.rb +0 -6
- data/lib/canvas_sync/generators/templates/services/live_events/module/module_event.rb +0 -39
- data/lib/canvas_sync/generators/templates/services/live_events/module/module_updated_event.rb +0 -6
- data/lib/canvas_sync/generators/templates/services/live_events/module_item/module_item_created_event.rb +0 -6
- data/lib/canvas_sync/generators/templates/services/live_events/module_item/module_item_event.rb +0 -37
- data/lib/canvas_sync/generators/templates/services/live_events/module_item/module_item_updated_event.rb +0 -6
- data/lib/canvas_sync/generators/templates/services/live_events/submission/submission_created_event.rb +0 -6
- data/lib/canvas_sync/generators/templates/services/live_events/submission/submission_event.rb +0 -52
- data/lib/canvas_sync/generators/templates/services/live_events/submission/submission_updated_event.rb +0 -6
- data/lib/canvas_sync/generators/templates/services/live_events/syllabus/syllabus_event.rb +0 -34
- data/lib/canvas_sync/generators/templates/services/live_events/syllabus/syllabus_updated_event.rb +0 -6
- data/lib/canvas_sync/generators/templates/services/live_events/user/user_created_event.rb +0 -6
- data/lib/canvas_sync/generators/templates/services/live_events/user/user_event.rb +0 -34
- data/lib/canvas_sync/generators/templates/services/live_events/user/user_updated_event.rb +0 -6
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +0 -1248
- data/spec/dummy/log/test.log +0 -43258
- data/spec/support/fixtures/reports/provisioning_csv_unzipped/courses.csv +0 -3
- data/spec/support/fixtures/reports/provisioning_csv_unzipped/users.csv +0 -4
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: 20190702203632) do
|
14
14
|
|
15
15
|
# These are extensions that must be enabled in order to support this database
|
16
16
|
enable_extension "plpgsql"
|
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.10.
|
4
|
+
version: 0.10.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: 2019-
|
11
|
+
date: 2019-07-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -351,35 +351,18 @@ files:
|
|
351
351
|
- lib/canvas_sync/generators/templates/models/submission.rb
|
352
352
|
- lib/canvas_sync/generators/templates/models/term.rb
|
353
353
|
- lib/canvas_sync/generators/templates/models/user.rb
|
354
|
-
- lib/canvas_sync/generators/templates/services/live_events/
|
355
|
-
- lib/canvas_sync/generators/templates/services/live_events/
|
356
|
-
- lib/canvas_sync/generators/templates/services/live_events/assignment/assignment_updated_event.rb
|
354
|
+
- lib/canvas_sync/generators/templates/services/live_events/assignment_event.rb
|
355
|
+
- lib/canvas_sync/generators/templates/services/live_events/assignment_group_event.rb
|
357
356
|
- lib/canvas_sync/generators/templates/services/live_events/base_event.rb
|
358
|
-
- lib/canvas_sync/generators/templates/services/live_events/
|
359
|
-
- lib/canvas_sync/generators/templates/services/live_events/
|
360
|
-
- lib/canvas_sync/generators/templates/services/live_events/
|
361
|
-
- lib/canvas_sync/generators/templates/services/live_events/
|
362
|
-
- lib/canvas_sync/generators/templates/services/live_events/
|
363
|
-
- lib/canvas_sync/generators/templates/services/live_events/
|
364
|
-
- lib/canvas_sync/generators/templates/services/live_events/
|
365
|
-
- lib/canvas_sync/generators/templates/services/live_events/
|
366
|
-
- lib/canvas_sync/generators/templates/services/live_events/
|
367
|
-
- lib/canvas_sync/generators/templates/services/live_events/grade/grade_changed_event.rb
|
368
|
-
- lib/canvas_sync/generators/templates/services/live_events/grade/grade_event.rb
|
369
|
-
- lib/canvas_sync/generators/templates/services/live_events/module/module_created_event.rb
|
370
|
-
- lib/canvas_sync/generators/templates/services/live_events/module/module_event.rb
|
371
|
-
- lib/canvas_sync/generators/templates/services/live_events/module/module_updated_event.rb
|
372
|
-
- lib/canvas_sync/generators/templates/services/live_events/module_item/module_item_created_event.rb
|
373
|
-
- lib/canvas_sync/generators/templates/services/live_events/module_item/module_item_event.rb
|
374
|
-
- lib/canvas_sync/generators/templates/services/live_events/module_item/module_item_updated_event.rb
|
375
|
-
- lib/canvas_sync/generators/templates/services/live_events/submission/submission_created_event.rb
|
376
|
-
- lib/canvas_sync/generators/templates/services/live_events/submission/submission_event.rb
|
377
|
-
- lib/canvas_sync/generators/templates/services/live_events/submission/submission_updated_event.rb
|
378
|
-
- lib/canvas_sync/generators/templates/services/live_events/syllabus/syllabus_event.rb
|
379
|
-
- lib/canvas_sync/generators/templates/services/live_events/syllabus/syllabus_updated_event.rb
|
380
|
-
- lib/canvas_sync/generators/templates/services/live_events/user/user_created_event.rb
|
381
|
-
- lib/canvas_sync/generators/templates/services/live_events/user/user_event.rb
|
382
|
-
- lib/canvas_sync/generators/templates/services/live_events/user/user_updated_event.rb
|
357
|
+
- lib/canvas_sync/generators/templates/services/live_events/course_event.rb
|
358
|
+
- lib/canvas_sync/generators/templates/services/live_events/course_section_event.rb
|
359
|
+
- lib/canvas_sync/generators/templates/services/live_events/enrollment_event.rb
|
360
|
+
- lib/canvas_sync/generators/templates/services/live_events/grade_event.rb
|
361
|
+
- lib/canvas_sync/generators/templates/services/live_events/module_event.rb
|
362
|
+
- lib/canvas_sync/generators/templates/services/live_events/module_item_event.rb
|
363
|
+
- lib/canvas_sync/generators/templates/services/live_events/submission_event.rb
|
364
|
+
- lib/canvas_sync/generators/templates/services/live_events/syllabus_event.rb
|
365
|
+
- lib/canvas_sync/generators/templates/services/live_events/user_event.rb
|
383
366
|
- lib/canvas_sync/importers/bulk_importer.rb
|
384
367
|
- lib/canvas_sync/importers/legacy_importer.rb
|
385
368
|
- lib/canvas_sync/job.rb
|
@@ -504,23 +487,20 @@ files:
|
|
504
487
|
- spec/dummy/config/initializers/wrap_parameters.rb
|
505
488
|
- spec/dummy/config/routes.rb
|
506
489
|
- spec/dummy/config/secrets.yml
|
507
|
-
- spec/dummy/db/migrate/
|
508
|
-
- spec/dummy/db/migrate/
|
509
|
-
- spec/dummy/db/migrate/
|
510
|
-
- spec/dummy/db/migrate/
|
511
|
-
- spec/dummy/db/migrate/
|
512
|
-
- spec/dummy/db/migrate/
|
513
|
-
- spec/dummy/db/migrate/
|
514
|
-
- spec/dummy/db/migrate/
|
515
|
-
- spec/dummy/db/migrate/
|
516
|
-
- spec/dummy/db/migrate/
|
517
|
-
- spec/dummy/db/migrate/
|
518
|
-
- spec/dummy/db/migrate/
|
519
|
-
- spec/dummy/db/migrate/
|
490
|
+
- spec/dummy/db/migrate/20190702203620_create_users.rb
|
491
|
+
- spec/dummy/db/migrate/20190702203621_create_courses.rb
|
492
|
+
- spec/dummy/db/migrate/20190702203622_create_accounts.rb
|
493
|
+
- spec/dummy/db/migrate/20190702203623_create_terms.rb
|
494
|
+
- spec/dummy/db/migrate/20190702203624_create_enrollments.rb
|
495
|
+
- spec/dummy/db/migrate/20190702203625_create_sections.rb
|
496
|
+
- spec/dummy/db/migrate/20190702203626_create_assignments.rb
|
497
|
+
- spec/dummy/db/migrate/20190702203627_create_submissions.rb
|
498
|
+
- spec/dummy/db/migrate/20190702203628_create_roles.rb
|
499
|
+
- spec/dummy/db/migrate/20190702203629_create_admins.rb
|
500
|
+
- spec/dummy/db/migrate/20190702203630_create_assignment_groups.rb
|
501
|
+
- spec/dummy/db/migrate/20190702203631_create_context_modules.rb
|
502
|
+
- spec/dummy/db/migrate/20190702203632_create_context_module_items.rb
|
520
503
|
- spec/dummy/db/schema.rb
|
521
|
-
- spec/dummy/db/test.sqlite3
|
522
|
-
- spec/dummy/log/development.log
|
523
|
-
- spec/dummy/log/test.log
|
524
504
|
- spec/factories/account_factory.rb
|
525
505
|
- spec/factories/admin_factory.rb
|
526
506
|
- spec/factories/assignment_factory.rb
|
@@ -548,8 +528,6 @@ files:
|
|
548
528
|
- spec/support/fixtures/reports/courses.csv
|
549
529
|
- spec/support/fixtures/reports/enrollments.csv
|
550
530
|
- spec/support/fixtures/reports/provisioning_csv
|
551
|
-
- spec/support/fixtures/reports/provisioning_csv_unzipped/courses.csv
|
552
|
-
- spec/support/fixtures/reports/provisioning_csv_unzipped/users.csv
|
553
531
|
- spec/support/fixtures/reports/sections.csv
|
554
532
|
- spec/support/fixtures/reports/submissions.csv
|
555
533
|
- spec/support/fixtures/reports/users.csv
|
@@ -572,7 +550,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
572
550
|
- !ruby/object:Gem::Version
|
573
551
|
version: '0'
|
574
552
|
requirements: []
|
575
|
-
|
553
|
+
rubyforge_project:
|
554
|
+
rubygems_version: 2.5.2.1
|
576
555
|
signing_key:
|
577
556
|
specification_version: 4
|
578
557
|
summary: Gem for generating Canvas models and migrations and syncing data from Canvas
|
@@ -673,23 +652,20 @@ test_files:
|
|
673
652
|
- spec/dummy/config/initializers/wrap_parameters.rb
|
674
653
|
- spec/dummy/config/routes.rb
|
675
654
|
- spec/dummy/config/secrets.yml
|
676
|
-
- spec/dummy/db/migrate/
|
677
|
-
- spec/dummy/db/migrate/
|
678
|
-
- spec/dummy/db/migrate/
|
679
|
-
- spec/dummy/db/migrate/
|
680
|
-
- spec/dummy/db/migrate/
|
681
|
-
- spec/dummy/db/migrate/
|
682
|
-
- spec/dummy/db/migrate/
|
683
|
-
- spec/dummy/db/migrate/
|
684
|
-
- spec/dummy/db/migrate/
|
685
|
-
- spec/dummy/db/migrate/
|
686
|
-
- spec/dummy/db/migrate/
|
687
|
-
- spec/dummy/db/migrate/
|
688
|
-
- spec/dummy/db/migrate/
|
655
|
+
- spec/dummy/db/migrate/20190702203620_create_users.rb
|
656
|
+
- spec/dummy/db/migrate/20190702203621_create_courses.rb
|
657
|
+
- spec/dummy/db/migrate/20190702203622_create_accounts.rb
|
658
|
+
- spec/dummy/db/migrate/20190702203623_create_terms.rb
|
659
|
+
- spec/dummy/db/migrate/20190702203624_create_enrollments.rb
|
660
|
+
- spec/dummy/db/migrate/20190702203625_create_sections.rb
|
661
|
+
- spec/dummy/db/migrate/20190702203626_create_assignments.rb
|
662
|
+
- spec/dummy/db/migrate/20190702203627_create_submissions.rb
|
663
|
+
- spec/dummy/db/migrate/20190702203628_create_roles.rb
|
664
|
+
- spec/dummy/db/migrate/20190702203629_create_admins.rb
|
665
|
+
- spec/dummy/db/migrate/20190702203630_create_assignment_groups.rb
|
666
|
+
- spec/dummy/db/migrate/20190702203631_create_context_modules.rb
|
667
|
+
- spec/dummy/db/migrate/20190702203632_create_context_module_items.rb
|
689
668
|
- spec/dummy/db/schema.rb
|
690
|
-
- spec/dummy/db/test.sqlite3
|
691
|
-
- spec/dummy/log/development.log
|
692
|
-
- spec/dummy/log/test.log
|
693
669
|
- spec/factories/account_factory.rb
|
694
670
|
- spec/factories/admin_factory.rb
|
695
671
|
- spec/factories/assignment_factory.rb
|
@@ -717,8 +693,6 @@ test_files:
|
|
717
693
|
- spec/support/fixtures/reports/courses.csv
|
718
694
|
- spec/support/fixtures/reports/enrollments.csv
|
719
695
|
- spec/support/fixtures/reports/provisioning_csv
|
720
|
-
- spec/support/fixtures/reports/provisioning_csv_unzipped/courses.csv
|
721
|
-
- spec/support/fixtures/reports/provisioning_csv_unzipped/users.csv
|
722
696
|
- spec/support/fixtures/reports/sections.csv
|
723
697
|
- spec/support/fixtures/reports/submissions.csv
|
724
698
|
- spec/support/fixtures/reports/users.csv
|
data/lib/canvas_sync/generators/templates/services/live_events/assignment/assignment_event.rb
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
# <%= autogenerated_event_warning %>
|
2
|
-
|
3
|
-
module LiveEvents
|
4
|
-
class AssignmentEvent < LiveEvents::BaseEvent
|
5
|
-
# The following is provided in the live events call:
|
6
|
-
# {
|
7
|
-
# assignment_id: assignment.global_id,
|
8
|
-
# context_id: assignment.global_context_id,
|
9
|
-
# context_type: assignment.context_type,
|
10
|
-
# workflow_state: assignment.workflow_state,
|
11
|
-
# title: LiveEvents.truncate(assignment.title),
|
12
|
-
# description: LiveEvents.truncate(assignment.description),
|
13
|
-
# due_at: assignment.due_at,
|
14
|
-
# unlock_at: assignment.unlock_at,
|
15
|
-
# lock_at: assignment.lock_at,
|
16
|
-
# updated_at: assignment.updated_at,
|
17
|
-
# points_possible: assignment.points_possible
|
18
|
-
# }
|
19
|
-
|
20
|
-
def perform(event_payload)
|
21
|
-
super
|
22
|
-
attrs = {
|
23
|
-
canvas_assignment_id: local_canvas_id(payload[:assignment_id]),
|
24
|
-
title: payload[:title],
|
25
|
-
workflow_state: payload[:workflow_state],
|
26
|
-
description: payload[:description],
|
27
|
-
due_at: payload[:due_at],
|
28
|
-
unlock_at: payload[:unlock_at],
|
29
|
-
lock_at: payload[:lock_at],
|
30
|
-
points_possible: payload[:points_possible],
|
31
|
-
}
|
32
|
-
create_or_update(attrs)
|
33
|
-
end
|
34
|
-
|
35
|
-
private
|
36
|
-
|
37
|
-
def create_or_update(attrs)
|
38
|
-
assignment = Assignment.where(canvas_assignment_id: attrs[:canvas_assignment_id]).first_or_initialize
|
39
|
-
assignment.assign_attributes(attrs)
|
40
|
-
assignment.save!
|
41
|
-
assignment
|
42
|
-
end
|
43
|
-
|
44
|
-
# This could be nil if the context type for this assignment is not 'Course' of if a local course was not found
|
45
|
-
def canvas_course_id
|
46
|
-
payload[:context_type] == "Course" ? local_canvas_id(payload[:context_id]) : nil
|
47
|
-
end
|
48
|
-
|
49
|
-
# This could be nil if the context type for this assignment is not 'Course' of if a local course was not found
|
50
|
-
def course
|
51
|
-
@course ||= Course.find_by(canvas_course_id: canvas_course_id)
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
# <%= autogenerated_event_warning %>
|
2
|
-
|
3
|
-
module LiveEvents
|
4
|
-
class CourseEvent < LiveEvents::BaseEvent
|
5
|
-
# The following is provided in the live events call:
|
6
|
-
# {
|
7
|
-
# course_id: course.global_id,
|
8
|
-
# uuid: course.uuid,
|
9
|
-
# account_id: course.global_account_id,
|
10
|
-
# name: course.name,
|
11
|
-
# created_at: course.created_at,
|
12
|
-
# updated_at: course.updated_at,
|
13
|
-
# workflow_state: course.workflow_state
|
14
|
-
# }
|
15
|
-
|
16
|
-
def perform(event_payload)
|
17
|
-
super
|
18
|
-
attrs = {
|
19
|
-
canvas_course_id: local_canvas_id(payload[:course_id]),
|
20
|
-
canvas_account_id: local_canvas_id(payload[:account_id]),
|
21
|
-
name: payload[:name],
|
22
|
-
status: payload[:workflow_state],
|
23
|
-
}
|
24
|
-
create_or_update(attrs)
|
25
|
-
end
|
26
|
-
|
27
|
-
private
|
28
|
-
|
29
|
-
def create_or_update(attrs)
|
30
|
-
course = Course.where(canvas_course_id: attrs[:canvas_course_id]).first_or_initialize
|
31
|
-
course.assign_attributes(attrs)
|
32
|
-
course.save!
|
33
|
-
course
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
# <%= autogenerated_event_warning %>
|
2
|
-
|
3
|
-
module LiveEvents
|
4
|
-
class CourseSectionEvent < LiveEvents::BaseEvent
|
5
|
-
# The following is provided in the live events call:
|
6
|
-
# {
|
7
|
-
# course_section_id: section.id,
|
8
|
-
# sis_id: section.sis_id,
|
9
|
-
# sis_batch_id: section.sis_batch_id,
|
10
|
-
# course_id: section.course_id,
|
11
|
-
# root_account_id: section.root_account_id,
|
12
|
-
# enrollment_term_id: section.enrollment_term_id,
|
13
|
-
# name: section.name,
|
14
|
-
# default_section: section.default_section,
|
15
|
-
# accepting_enrollments: section.accepting_enrollments,
|
16
|
-
# can_manually_enroll: section.can_manually_enroll,
|
17
|
-
# start_at: section.start_at,
|
18
|
-
# end_at: section.end_at,
|
19
|
-
# workflow_state: section.workflow_state,
|
20
|
-
# restrict_enrollments_to_section_dates: section.restrict_enrollments_to_section_dates,
|
21
|
-
# nonxlist_course_id: section.nonxlist_course_id,
|
22
|
-
# stuck_sis_fields: section.stuck_sis_fields,
|
23
|
-
# integration_id: section.integration_id
|
24
|
-
# }
|
25
|
-
|
26
|
-
def perform(_event_payload)
|
27
|
-
super
|
28
|
-
attrs = {
|
29
|
-
canvas_section_id: local_canvas_id(payload[:course_section_id]),
|
30
|
-
canvas_course_id: local_canvas_id(payload[:course_id]),
|
31
|
-
name: payload[:name],
|
32
|
-
workflow_state: payload[:workflow_state],
|
33
|
-
start_at: payload[:start_at],
|
34
|
-
end_at: payload[:end_at],
|
35
|
-
canvas_nonxlist_course_id: payload[:nonxlist_course_id],
|
36
|
-
}
|
37
|
-
create_or_update(attrs)
|
38
|
-
end
|
39
|
-
|
40
|
-
private
|
41
|
-
|
42
|
-
def create_or_update(attrs)
|
43
|
-
section = Section.where(canvas_section_id: attrs[:canvas_section_id]).first_or_initialize
|
44
|
-
section.assign_attributes(attrs)
|
45
|
-
section.save!
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|