canvas_sync 0.27.13 → 0.27.15
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 +4 -4
- data/app/controllers/canvas_sync/api/v1/health_check_controller.rb +0 -0
- data/app/models/canvas_sync/job_log.rb +0 -0
- data/app/models/canvas_sync/sync_batch.rb +0 -0
- data/config/initializers/apartment.rb +0 -0
- data/config/routes.rb +0 -0
- data/db/migrate/20170915210836_create_canvas_sync_job_log.rb +0 -0
- data/db/migrate/20180725155729_add_job_id_to_canvas_sync_job_logs.rb +0 -0
- data/db/migrate/20190916154829_add_fork_count_to_canvas_sync_job_logs.rb +0 -0
- data/db/migrate/20201018210836_create_canvas_sync_sync_batches.rb +0 -0
- data/db/migrate/20201030210836_add_full_sync_to_canvas_sync_sync_batch.rb +0 -0
- data/lib/canvas_sync/api_syncable.rb +0 -0
- data/lib/canvas_sync/batch_processor.rb +0 -0
- data/lib/canvas_sync/class_callback_executor.rb +0 -0
- data/lib/canvas_sync/concerns/ability_helper.rb +43 -2
- data/lib/canvas_sync/concerns/account/ancestry.rb +0 -0
- data/lib/canvas_sync/concerns/account/base.rb +0 -0
- data/lib/canvas_sync/concerns/api_syncable.rb +0 -0
- data/lib/canvas_sync/concerns/canvas_id_as_primary.rb +0 -0
- data/lib/canvas_sync/concerns/jit_syncing.rb +0 -0
- data/lib/canvas_sync/concerns/legacy_columns.rb +0 -0
- data/lib/canvas_sync/concerns/role/base.rb +0 -0
- data/lib/canvas_sync/generators/install_generator.rb +0 -0
- data/lib/canvas_sync/generators/install_live_events_generator.rb +0 -0
- data/lib/canvas_sync/generators/templates/migrations/create_accounts.rb +0 -0
- data/lib/canvas_sync/generators/templates/migrations/create_admins.rb +0 -0
- data/lib/canvas_sync/generators/templates/migrations/create_assignment_groups.rb +0 -0
- data/lib/canvas_sync/generators/templates/migrations/create_assignments.rb +0 -0
- data/lib/canvas_sync/generators/templates/migrations/create_content_migrations.rb +0 -0
- data/lib/canvas_sync/generators/templates/migrations/create_context_module_items.rb +0 -0
- data/lib/canvas_sync/generators/templates/migrations/create_context_modules.rb +0 -0
- data/lib/canvas_sync/generators/templates/migrations/create_course_nicknames.rb +0 -0
- data/lib/canvas_sync/generators/templates/migrations/create_course_progresses.rb +0 -0
- data/lib/canvas_sync/generators/templates/migrations/create_grading_period_groups.rb +0 -0
- data/lib/canvas_sync/generators/templates/migrations/create_grading_periods.rb +0 -0
- data/lib/canvas_sync/generators/templates/migrations/create_group_memberships.rb +0 -0
- data/lib/canvas_sync/generators/templates/migrations/create_groups.rb +0 -0
- data/lib/canvas_sync/generators/templates/migrations/create_learning_outcome_results.rb +0 -0
- data/lib/canvas_sync/generators/templates/migrations/create_learning_outcomes.rb +0 -0
- data/lib/canvas_sync/generators/templates/migrations/create_pseudonyms.rb +0 -0
- data/lib/canvas_sync/generators/templates/migrations/create_rubric_assessments.rb +0 -0
- data/lib/canvas_sync/generators/templates/migrations/create_rubric_associations.rb +0 -0
- data/lib/canvas_sync/generators/templates/migrations/create_rubrics.rb +0 -0
- data/lib/canvas_sync/generators/templates/migrations/create_sections.rb +0 -0
- data/lib/canvas_sync/generators/templates/migrations/create_submissions.rb +0 -0
- data/lib/canvas_sync/generators/templates/migrations/create_terms.rb +0 -0
- data/lib/canvas_sync/generators/templates/migrations/create_user_observers.rb +0 -0
- data/lib/canvas_sync/generators/templates/migrations/create_users.rb +0 -0
- data/lib/canvas_sync/generators/templates/models/content_migration.rb +0 -0
- data/lib/canvas_sync/generators/templates/models/course_nickname.rb +0 -0
- data/lib/canvas_sync/generators/templates/models/rubric.rb +0 -0
- data/lib/canvas_sync/generators/templates/models/rubric_assessment.rb +0 -0
- data/lib/canvas_sync/generators/templates/models/rubric_association.rb +0 -0
- data/lib/canvas_sync/generators/templates/services/live_events/assignment_event.rb +0 -0
- data/lib/canvas_sync/generators/templates/services/live_events/assignment_group_event.rb +0 -0
- data/lib/canvas_sync/generators/templates/services/live_events/course_event.rb +0 -0
- data/lib/canvas_sync/generators/templates/services/live_events/course_section_event.rb +0 -0
- data/lib/canvas_sync/generators/templates/services/live_events/enrollment_event.rb +0 -0
- data/lib/canvas_sync/generators/templates/services/live_events/grade_event.rb +0 -0
- data/lib/canvas_sync/generators/templates/services/live_events/module_event.rb +0 -0
- data/lib/canvas_sync/generators/templates/services/live_events/module_item_event.rb +0 -0
- data/lib/canvas_sync/generators/templates/services/live_events/submission_event.rb +0 -0
- data/lib/canvas_sync/generators/templates/services/live_events/syllabus_event.rb +0 -0
- data/lib/canvas_sync/generators/templates/services/live_events/user_event.rb +0 -0
- data/lib/canvas_sync/importers/legacy_importer.rb +0 -0
- data/lib/canvas_sync/jobs/begin_sync_chain_job.rb +0 -0
- data/lib/canvas_sync/jobs/canvas_process_waiter.rb +0 -0
- data/lib/canvas_sync/jobs/report_starter.rb +5 -1
- data/lib/canvas_sync/jobs/report_sync_task.rb +4 -1
- data/lib/canvas_sync/jobs/sync_admins_job.rb +0 -0
- data/lib/canvas_sync/jobs/sync_assignment_groups_job.rb +0 -0
- data/lib/canvas_sync/jobs/sync_assignments_job.rb +0 -0
- data/lib/canvas_sync/jobs/sync_content_migrations_job.rb +0 -0
- data/lib/canvas_sync/jobs/sync_context_module_items_job.rb +0 -0
- data/lib/canvas_sync/jobs/sync_context_modules_job.rb +0 -0
- data/lib/canvas_sync/jobs/sync_provisioning_report_job.rb +1 -1
- data/lib/canvas_sync/jobs/sync_rubrics_job.rb +0 -0
- data/lib/canvas_sync/jobs/sync_simple_table_job.rb +0 -0
- data/lib/canvas_sync/live_events/base_handler.rb +0 -0
- data/lib/canvas_sync/live_events.rb +0 -0
- data/lib/canvas_sync/misc_helper.rb +0 -0
- data/lib/canvas_sync/processors/normal_processor.rb +0 -0
- data/lib/canvas_sync/sidekiq_job.rb +0 -0
- data/lib/canvas_sync/version.rb +1 -1
- data/lib/canvas_sync.rb +65 -86
- data/spec/canvas_sync/concerns/ability_helper_spec.rb +165 -0
- data/spec/canvas_sync/jobs/canvas_process_waiter_spec.rb +0 -0
- data/spec/canvas_sync/jobs/report_starter_spec.rb +0 -0
- data/spec/canvas_sync/jobs/sync_admins_job_spec.rb +0 -0
- data/spec/canvas_sync/jobs/sync_provisioning_report_job_spec.rb +2 -2
- data/spec/canvas_sync/jobs/sync_roles_job_spec.rb +0 -0
- data/spec/canvas_sync/jobs/sync_simple_table_job_spec.rb +0 -0
- data/spec/canvas_sync/jobs/sync_terms_job_spec.rb +0 -0
- data/spec/canvas_sync/live_events/live_event_sync_spec.rb +0 -0
- data/spec/canvas_sync/live_events/live_events_controller_spec.rb +0 -0
- data/spec/canvas_sync/misc_helper_spec.rb +0 -0
- data/spec/canvas_sync/models/accounts_spec.rb +0 -0
- data/spec/canvas_sync/models/admins_spec.rb +0 -0
- data/spec/canvas_sync/models/assignment_group_spec.rb +0 -0
- data/spec/canvas_sync/models/assignment_spec.rb +0 -0
- data/spec/canvas_sync/models/context_module_item_spec.rb +0 -0
- data/spec/canvas_sync/models/context_module_spec.rb +0 -0
- data/spec/canvas_sync/models/course_spec.rb +0 -0
- data/spec/canvas_sync/models/enrollment_spec.rb +0 -0
- data/spec/canvas_sync/models/group_membership_spec.rb +0 -0
- data/spec/canvas_sync/models/group_spec.rb +0 -0
- data/spec/canvas_sync/models/roles_spec.rb +0 -0
- data/spec/canvas_sync/models/section_spec.rb +0 -0
- data/spec/canvas_sync/models/submission_spec.rb +0 -0
- data/spec/canvas_sync/models/term_spec.rb +0 -0
- data/spec/canvas_sync/models/user_spec.rb +0 -0
- data/spec/canvas_sync/processors/assignment_groups_processor_spec.rb +0 -0
- data/spec/canvas_sync/processors/assignments_processor_spec.rb +0 -0
- data/spec/canvas_sync/processors/content_migrations_processor_spec.rb +0 -0
- data/spec/canvas_sync/processors/context_module_items_processor_spec.rb +0 -0
- data/spec/canvas_sync/processors/context_modules_processor_spec.rb +0 -0
- data/spec/canvas_sync/processors/course_completion_report_processor_spec.rb +0 -0
- data/spec/canvas_sync/processors/rubric_assessments_spec.rb +0 -0
- data/spec/canvas_sync/processors/rubric_associations_spec.rb +0 -0
- data/spec/canvas_sync/processors/rubrics_processor_spec.rb +0 -0
- data/spec/canvas_sync/processors/submissions_processor_spec.rb +0 -0
- data/spec/canvas_sync/services/module_event_spec.rb +0 -0
- data/spec/canvas_sync/services/module_item_event_spec.rb +0 -0
- data/spec/factories/admin_factory.rb +0 -0
- data/spec/factories/assignment_factory.rb +0 -0
- data/spec/factories/assignment_group_factory.rb +0 -0
- data/spec/factories/context_module_factory.rb +0 -0
- data/spec/factories/context_module_item_factory.rb +0 -0
- data/spec/factories/course_factory.rb +0 -0
- data/spec/factories/enrollment_factory.rb +0 -0
- data/spec/factories/group_factory.rb +0 -0
- data/spec/factories/group_membership_factory.rb +0 -0
- data/spec/factories/role_factory.rb +0 -0
- data/spec/factories/section_factory.rb +0 -0
- data/spec/factories/submission_factory.rb +0 -0
- data/spec/factories/term_factory.rb +0 -0
- data/spec/factories/user_factory.rb +0 -0
- data/spec/support/fixtures/canvas_responses/admins.json +0 -0
- data/spec/support/fixtures/canvas_responses/module.json +0 -0
- data/spec/support/fixtures/canvas_responses/module_item.json +0 -0
- data/spec/support/fixtures/canvas_responses/roles.json +0 -0
- data/spec/support/fixtures/canvas_responses/terms.json +0 -0
- data/spec/support/fixtures/reports/assignment_groups.csv +0 -0
- data/spec/support/fixtures/reports/assignments.csv +0 -0
- data/spec/support/fixtures/reports/content_migrations.csv +0 -0
- data/spec/support/fixtures/reports/context_module_items.csv +0 -0
- data/spec/support/fixtures/reports/context_modules.csv +0 -0
- data/spec/support/fixtures/reports/course_nicknames.csv +0 -0
- data/spec/support/fixtures/reports/course_progresses.csv +0 -0
- data/spec/support/fixtures/reports/course_progresses_conflict.csv +0 -0
- data/spec/support/fixtures/reports/grading_period_groups.csv +0 -0
- data/spec/support/fixtures/reports/grading_periods.csv +0 -0
- data/spec/support/fixtures/reports/group_memberships.csv +0 -0
- data/spec/support/fixtures/reports/groups.csv +0 -0
- data/spec/support/fixtures/reports/learning_outcome_results.csv +0 -0
- data/spec/support/fixtures/reports/learning_outcomes.csv +0 -0
- data/spec/support/fixtures/reports/provisioning_csv +0 -0
- data/spec/support/fixtures/reports/rubric_assessments.csv +0 -0
- data/spec/support/fixtures/reports/rubric_associations.csv +0 -0
- data/spec/support/fixtures/reports/rubrics.csv +0 -0
- data/spec/support/fixtures/reports/sections.csv +0 -0
- data/spec/support/fixtures/reports/submissions.csv +0 -0
- data/spec/support/fixtures/reports/user_observers.csv +0 -0
- data/spec/support/fixtures/reports/users.csv +0 -0
- data/spec/support/fixtures/reports/xlist.csv +0 -0
- metadata +3 -141
- data/spec/internal/app/models/account.rb +0 -35
- data/spec/internal/app/models/admin.rb +0 -35
- data/spec/internal/app/models/assignment.rb +0 -39
- data/spec/internal/app/models/assignment_group.rb +0 -31
- data/spec/internal/app/models/assignment_override.rb +0 -34
- data/spec/internal/app/models/content_migration.rb +0 -18
- data/spec/internal/app/models/context_module.rb +0 -69
- data/spec/internal/app/models/context_module_item.rb +0 -33
- data/spec/internal/app/models/course.rb +0 -57
- data/spec/internal/app/models/course_nickname.rb +0 -20
- data/spec/internal/app/models/course_progress.rb +0 -29
- data/spec/internal/app/models/enrollment.rb +0 -48
- data/spec/internal/app/models/grading_period.rb +0 -17
- data/spec/internal/app/models/grading_period_group.rb +0 -16
- data/spec/internal/app/models/group.rb +0 -28
- data/spec/internal/app/models/group_membership.rb +0 -26
- data/spec/internal/app/models/learning_outcome.rb +0 -30
- data/spec/internal/app/models/learning_outcome_result.rb +0 -54
- data/spec/internal/app/models/pseudonym.rb +0 -19
- data/spec/internal/app/models/role.rb +0 -27
- data/spec/internal/app/models/rubric.rb +0 -36
- data/spec/internal/app/models/rubric_assessment.rb +0 -23
- data/spec/internal/app/models/rubric_association.rb +0 -20
- data/spec/internal/app/models/score.rb +0 -18
- data/spec/internal/app/models/section.rb +0 -36
- data/spec/internal/app/models/submission.rb +0 -32
- data/spec/internal/app/models/term.rb +0 -46
- data/spec/internal/app/models/user.rb +0 -43
- data/spec/internal/app/models/user_observer.rb +0 -22
- data/spec/internal/app/services/live_events/assignment_event.rb +0 -43
- data/spec/internal/app/services/live_events/course_event.rb +0 -28
- data/spec/internal/app/services/live_events/course_section_event.rb +0 -28
- data/spec/internal/app/services/live_events/enrollment_event.rb +0 -30
- data/spec/internal/app/services/live_events/grade_event.rb +0 -36
- data/spec/internal/app/services/live_events/module_event.rb +0 -26
- data/spec/internal/app/services/live_events/module_item_event.rb +0 -25
- data/spec/internal/app/services/live_events/submission_event.rb +0 -28
- data/spec/internal/app/services/live_events/syllabus_event.rb +0 -31
- data/spec/internal/app/services/live_events/user_event.rb +0 -27
- data/spec/internal/db/migrate/20251029222307_create_users.rb +0 -26
- data/spec/internal/db/migrate/20251029222308_create_pseudonyms.rb +0 -24
- data/spec/internal/db/migrate/20251029222309_create_courses.rb +0 -30
- data/spec/internal/db/migrate/20251029222310_create_groups.rb +0 -29
- data/spec/internal/db/migrate/20251029222311_create_group_memberships.rb +0 -24
- data/spec/internal/db/migrate/20251029222312_create_accounts.rb +0 -23
- data/spec/internal/db/migrate/20251029222313_create_terms.rb +0 -24
- data/spec/internal/db/migrate/20251029222314_create_enrollments.rb +0 -31
- data/spec/internal/db/migrate/20251029222315_create_sections.rb +0 -27
- data/spec/internal/db/migrate/20251029222316_create_assignments.rb +0 -37
- data/spec/internal/db/migrate/20251029222317_create_submissions.rb +0 -32
- data/spec/internal/db/migrate/20251029222318_create_roles.rb +0 -24
- data/spec/internal/db/migrate/20251029222319_create_admins.rb +0 -26
- data/spec/internal/db/migrate/20251029222320_create_assignment_groups.rb +0 -28
- data/spec/internal/db/migrate/20251029222321_create_context_modules.rb +0 -28
- data/spec/internal/db/migrate/20251029222322_create_context_module_items.rb +0 -26
- data/spec/internal/db/migrate/20251029222324_create_grading_periods.rb +0 -28
- data/spec/internal/db/migrate/20251029222325_create_grading_period_groups.rb +0 -24
- data/spec/internal/db/migrate/20251029222326_create_content_migrations.rb +0 -30
- data/spec/internal/db/migrate/20251029222327_create_learning_outcomes.rb +0 -36
- data/spec/internal/db/migrate/20251029222328_create_learning_outcome_results.rb +0 -52
- data/spec/internal/db/migrate/20251029222330_create_rubrics.rb +0 -44
- data/spec/internal/db/migrate/20251029222331_create_rubric_associations.rb +0 -42
- data/spec/internal/db/migrate/20251029222332_create_rubric_assessments.rb +0 -37
- data/spec/internal/db/migrate/20251029222334_create_assignment_overrides.rb +0 -25
- data/spec/internal/db/migrate/20251029222335_create_scores.rb +0 -42
- data/spec/internal/db/migrate/20251029223411_create_user_observers.rb +0 -23
- data/spec/internal/db/migrate/20251029224009_create_course_nicknames.rb +0 -23
- data/spec/internal/db/migrate/20251029224010_create_course_progresses.rb +0 -26
- data/spec/support/fixtures/reports/provisioning_csv_unzipped/courses.csv +0 -3
- data/spec/support/fixtures/reports/provisioning_csv_unzipped/users.csv +0 -4
|
@@ -1,35 +0,0 @@
|
|
|
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 Admin < ApplicationRecord
|
|
10
|
-
include CanvasSync::Record
|
|
11
|
-
include CanvasSync::Concerns::ApiSyncable
|
|
12
|
-
# include CanvasSync::Concerns::DeletedScoping
|
|
13
|
-
|
|
14
|
-
canvas_sync_features :defaults
|
|
15
|
-
|
|
16
|
-
validates :canvas_id, uniqueness: true, presence: true
|
|
17
|
-
belongs_to :account, primary_key: :canvas_id, foreign_key: :canvas_account_id, optional: true
|
|
18
|
-
belongs_to :user, primary_key: :canvas_id, foreign_key: :canvas_user_id, optional: true
|
|
19
|
-
belongs_to :role, primary_key: :canvas_id, foreign_key: :canvas_role_id, optional: true
|
|
20
|
-
|
|
21
|
-
api_syncable({
|
|
22
|
-
canvas_id: :id,
|
|
23
|
-
role_name: :role,
|
|
24
|
-
canvas_role_id: :role_id,
|
|
25
|
-
canvas_user_id: ->(r) { r['user']['id'] },
|
|
26
|
-
# NOTICE: The :account_id field is added by CanvasSync - it is not included in the Canvas API response
|
|
27
|
-
canvas_account_id: :account_id,
|
|
28
|
-
workflow_state: :workflow_state,
|
|
29
|
-
}, -> (api) {
|
|
30
|
-
admins = api.account_admins(canvas_account_id).all_pages!
|
|
31
|
-
admin_data = admins.find{|admin| admin['id'] == canvas_id }
|
|
32
|
-
raise Footrest::HttpError::NotFound unless admin_data.present?
|
|
33
|
-
admin_data
|
|
34
|
-
})
|
|
35
|
-
end
|
|
@@ -1,39 +0,0 @@
|
|
|
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 Assignment < ApplicationRecord
|
|
10
|
-
include CanvasSync::Record
|
|
11
|
-
include CanvasSync::Concerns::ApiSyncable
|
|
12
|
-
# include CanvasSync::Concerns::LiveEventSync
|
|
13
|
-
# include CanvasSync::Concerns::DeletedScoping
|
|
14
|
-
|
|
15
|
-
canvas_sync_features :defaults
|
|
16
|
-
|
|
17
|
-
validates :canvas_id, uniqueness: true, presence: true
|
|
18
|
-
belongs_to :context, polymorphic: true, optional: true, primary_key: :canvas_id, foreign_key: :canvas_context_id, foreign_type: :canvas_context_type
|
|
19
|
-
belongs_to :assignment_group, optional: true, primary_key: :canvas_id, foreign_key: :canvas_assignment_group_id
|
|
20
|
-
has_many :submissions, primary_key: :canvas_id, foreign_key: :canvas_assignment_id
|
|
21
|
-
|
|
22
|
-
has_many :context_module_items, as: :content, primary_key: :canvas_id, foreign_key: :canvas_content_id, foreign_type: :canvas_content_type, dependent: :destroy
|
|
23
|
-
has_many :context_modules, through: :context_module_items
|
|
24
|
-
|
|
25
|
-
api_syncable({
|
|
26
|
-
title: :name,
|
|
27
|
-
description: :description,
|
|
28
|
-
due_at: :due_at,
|
|
29
|
-
unlock_at: :unlock_at,
|
|
30
|
-
lock_at: :lock_at,
|
|
31
|
-
points_possible: :points_possible,
|
|
32
|
-
grading_type: :grading_type,
|
|
33
|
-
submission_types: lambda { |p| p["submission_types"].join(",") },
|
|
34
|
-
canvas_context_id: :course_id,
|
|
35
|
-
canvas_context_type: lambda { |_p| "Course" },
|
|
36
|
-
canvas_assignment_group_id: :assignment_group_id,
|
|
37
|
-
canvas_grading_standard_id: :grading_standard_id,
|
|
38
|
-
}, -> (api) { api.assignment(canvas_context_id, canvas_id) })
|
|
39
|
-
end
|
|
@@ -1,31 +0,0 @@
|
|
|
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 AssignmentGroup < ApplicationRecord
|
|
10
|
-
include CanvasSync::Record
|
|
11
|
-
include CanvasSync::Concerns::ApiSyncable
|
|
12
|
-
# include CanvasSync::Concerns::LiveEventSync
|
|
13
|
-
# include CanvasSync::Concerns::DeletedScoping
|
|
14
|
-
|
|
15
|
-
canvas_sync_features :defaults
|
|
16
|
-
|
|
17
|
-
validates :canvas_id, uniqueness: true, presence: true
|
|
18
|
-
belongs_to :course, primary_key: :canvas_id, foreign_key: :canvas_course_id, optional: true
|
|
19
|
-
has_many :assignments, primary_key: :canvas_id, foreign_key: :canvas_assignment_group_id
|
|
20
|
-
|
|
21
|
-
serialize :rules
|
|
22
|
-
|
|
23
|
-
api_syncable({
|
|
24
|
-
canvas_id: :id,
|
|
25
|
-
name: :name,
|
|
26
|
-
position: :position,
|
|
27
|
-
rules: :rules,
|
|
28
|
-
group_weight: :group_weight,
|
|
29
|
-
workflow_state: ->(p) { 'available' },
|
|
30
|
-
}, -> (api) { api.assignment_group(canvas_course_id, canvas_id) })
|
|
31
|
-
end
|
|
@@ -1,34 +0,0 @@
|
|
|
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 AssignmentOverride < ApplicationRecord
|
|
10
|
-
include CanvasSync::Record
|
|
11
|
-
include CanvasSync::Concerns::ApiSyncable
|
|
12
|
-
|
|
13
|
-
canvas_sync_features :defaults
|
|
14
|
-
|
|
15
|
-
validates :canvas_id, uniqueness: true, presence: true
|
|
16
|
-
belongs_to :assignment, primary_key: :canvas_id, foreign_key: :canvas_assignment_id, optional: true
|
|
17
|
-
belongs_to :course, primary_key: :canvas_id, foreign_key: :canvas_course_id, optional: true
|
|
18
|
-
|
|
19
|
-
api_syncable({
|
|
20
|
-
canvas_id: :id,
|
|
21
|
-
canvas_assignment_id: :assignment_id,
|
|
22
|
-
title: :title,
|
|
23
|
-
workflow_state: :workflow_state,
|
|
24
|
-
due_at: :due_at,
|
|
25
|
-
all_day: :all_day,
|
|
26
|
-
all_day_date: :all_day_date,
|
|
27
|
-
unlock_at: :unlock_at,
|
|
28
|
-
lock_at: :lock_at,
|
|
29
|
-
student_ids: ->(r) { JSON.parse(r[:student_ids]) if r[:student_ids].present? },
|
|
30
|
-
canvas_group_id: :group_id,
|
|
31
|
-
canvas_section_id: :course_section_id,
|
|
32
|
-
canvas_course_id: -> (r) { r.dig(:assignment, :course_id) }
|
|
33
|
-
}, -> (api) { api.assignment_override(canvas_assignment_id, canvas_id) })
|
|
34
|
-
end
|
|
@@ -1,18 +0,0 @@
|
|
|
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 ContentMigration < ApplicationRecord
|
|
10
|
-
include CanvasSync::Record
|
|
11
|
-
include CanvasSync::Concerns::ApiSyncable
|
|
12
|
-
|
|
13
|
-
canvas_sync_features :defaults
|
|
14
|
-
|
|
15
|
-
validates :canvas_id, uniqueness: true, presence: true
|
|
16
|
-
belongs_to :context, polymorphic: true, optional: true, primary_key: :canvas_id, foreign_key: :canvas_context_id, foreign_type: :canvas_context_type
|
|
17
|
-
|
|
18
|
-
end
|
|
@@ -1,69 +0,0 @@
|
|
|
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
|
-
# A ContextModule is the same as a Canvas Module. They're called ContextModules for 2 reasons:
|
|
10
|
-
# 1 - Module is a reserved word in Rails and you can't call a model a Module
|
|
11
|
-
# 2 - Canvas calls them ContextModules
|
|
12
|
-
class ContextModule < ApplicationRecord
|
|
13
|
-
include CanvasSync::Record
|
|
14
|
-
include CanvasSync::Concerns::ApiSyncable
|
|
15
|
-
# include CanvasSync::Concerns::DeletedScoping
|
|
16
|
-
|
|
17
|
-
# include CanvasSync::Concerns::LiveEventSync
|
|
18
|
-
# live_events_config event_prefix: :module
|
|
19
|
-
# def process_live_event(event_type, payload, metadata)
|
|
20
|
-
# self.canvas_context_id = payload['context_id']
|
|
21
|
-
# self.canvas_context_type = payload['context_type']
|
|
22
|
-
# super
|
|
23
|
-
# end
|
|
24
|
-
|
|
25
|
-
canvas_sync_features :defaults
|
|
26
|
-
|
|
27
|
-
belongs_to :context, polymorphic: true, optional: true, primary_key: :canvas_id, foreign_key: :canvas_context_id, foreign_type: :canvas_context_type
|
|
28
|
-
has_many :context_module_items, primary_key: :canvas_id, foreign_key: :canvas_context_module_id
|
|
29
|
-
has_many :assignments, through: :context_module_items
|
|
30
|
-
|
|
31
|
-
serialize :completion_requirements
|
|
32
|
-
serialize :prerequisites
|
|
33
|
-
|
|
34
|
-
api_syncable({
|
|
35
|
-
canvas_id: :id,
|
|
36
|
-
canvas_context_id: :context_id,
|
|
37
|
-
canvas_context_type: :context_type,
|
|
38
|
-
position: :position,
|
|
39
|
-
name: :name,
|
|
40
|
-
workflow_state: :workflow_state,
|
|
41
|
-
unlock_at: :unlock_at,
|
|
42
|
-
completion_requirements: :completion_requirements,
|
|
43
|
-
prerequisites: :prerequisites,
|
|
44
|
-
requirement_count: :requirement_count
|
|
45
|
-
}, lambda { |api|
|
|
46
|
-
course_modules = api.course_modules(canvas_context_id, { include: ['items'] }) # avoids having 2 API calls for modules as we reuse this data
|
|
47
|
-
context_module = course_modules&.detect { |course_module| course_module['id'] == canvas_id }
|
|
48
|
-
|
|
49
|
-
if context_module.nil? # no context_module here means it is deleted in Canvas
|
|
50
|
-
self.workflow_state = :deleted
|
|
51
|
-
return self
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
# The ContextModule model in Canvas has the 'completion_requirements' and 'prerequisites' fields that are not returned directly from the API
|
|
55
|
-
# We need to compute them here based on data that we receive from course_modules in the API
|
|
56
|
-
context_module['prerequisites'] = course_modules.map do |course_module|
|
|
57
|
-
next unless context_module['prerequisite_module_ids']&.include?(course_module['id'])
|
|
58
|
-
|
|
59
|
-
{
|
|
60
|
-
id: course_module['id'],
|
|
61
|
-
name: course_module['name'],
|
|
62
|
-
type: 'context_module'
|
|
63
|
-
}.with_indifferent_access
|
|
64
|
-
end.compact
|
|
65
|
-
|
|
66
|
-
context_module['completion_requirements'] = context_module['items']&.map { |item| item['completion_requirement'] }&.compact
|
|
67
|
-
context_module
|
|
68
|
-
})
|
|
69
|
-
end
|
|
@@ -1,33 +0,0 @@
|
|
|
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 ContextModuleItem < ApplicationRecord
|
|
10
|
-
include CanvasSync::Record
|
|
11
|
-
include CanvasSync::Concerns::ApiSyncable
|
|
12
|
-
# include CanvasSync::Concerns::LiveEventSync
|
|
13
|
-
# include CanvasSync::Concerns::DeletedScoping
|
|
14
|
-
|
|
15
|
-
canvas_sync_features :defaults
|
|
16
|
-
|
|
17
|
-
belongs_to :context_module, primary_key: :canvas_id, foreign_key: :canvas_context_module_id, optional: true
|
|
18
|
-
belongs_to :content, polymorphic: true, optional: true, primary_key: :canvas_id, foreign_key: :canvas_content_id, foreign_type: :canvas_content_type
|
|
19
|
-
belongs_to :assignment, foreign_key: :canvas_assignment_id, primary_key: :canvas_id
|
|
20
|
-
|
|
21
|
-
api_syncable({
|
|
22
|
-
canvas_id: :id,
|
|
23
|
-
canvas_context_module_id: :module_id,
|
|
24
|
-
position: :position,
|
|
25
|
-
canvas_content_type: :type,
|
|
26
|
-
canvas_content_id: :content_id,
|
|
27
|
-
canvas_assignment_id: :assignment_id
|
|
28
|
-
}, lambda { |api|
|
|
29
|
-
module_item = api.module_item(context_module.context.canvas_id, context_module.canvas_id, canvas_id)
|
|
30
|
-
module_item['assignment_id'] = api.assignment(context_module.context.canvas_id, module_item['content_id'])['id'] if module_item['type'] == 'Assignment'
|
|
31
|
-
module_item
|
|
32
|
-
})
|
|
33
|
-
end
|
|
@@ -1,57 +0,0 @@
|
|
|
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 Course < ApplicationRecord
|
|
10
|
-
include CanvasSync::Record
|
|
11
|
-
include CanvasSync::Concerns::ApiSyncable
|
|
12
|
-
# include CanvasSync::Concerns::DeletedScoping
|
|
13
|
-
|
|
14
|
-
canvas_sync_features :defaults
|
|
15
|
-
|
|
16
|
-
# include CanvasSync::Concerns::LiveEventSync
|
|
17
|
-
# after_process_live_event do
|
|
18
|
-
# if account.nil?
|
|
19
|
-
# acc = Account.new(canvas_id: canvas_account_id)
|
|
20
|
-
# acc.sync_from_api
|
|
21
|
-
# end
|
|
22
|
-
# end
|
|
23
|
-
|
|
24
|
-
validates :canvas_id, uniqueness: true, presence: true
|
|
25
|
-
belongs_to :term, foreign_key: :canvas_term_id, primary_key: :canvas_id, optional: true
|
|
26
|
-
has_many :enrollments, primary_key: :canvas_id, foreign_key: :canvas_course_id
|
|
27
|
-
has_many :sections, primary_key: :canvas_id, foreign_key: :canvas_course_id
|
|
28
|
-
has_many :assignments, as: :context, primary_key: :canvas_id, foreign_key: :canvas_context_id, foreign_type: :canvas_context_type
|
|
29
|
-
has_many :submissions, primary_key: :canvas_id, foreign_key: :canvas_course_id
|
|
30
|
-
has_many :assignment_groups, primary_key: :canvas_id, foreign_key: :canvas_course_id
|
|
31
|
-
has_many :groups, primary_key: :canvas_id, foreign_key: :canvas_course_id
|
|
32
|
-
has_many :rubrics, as: :context, primary_key: :canvas_id, foreign_key: :canvas_context_id, foreign_type: :canvas_context_type
|
|
33
|
-
|
|
34
|
-
api_syncable({
|
|
35
|
-
sis_id: :sis_course_id,
|
|
36
|
-
course_code: :course_code,
|
|
37
|
-
name: :name,
|
|
38
|
-
workflow_state: :workflow_state,
|
|
39
|
-
canvas_term_id: :enrollment_term_id,
|
|
40
|
-
canvas_account_id: :account_id,
|
|
41
|
-
start_at: :start_at,
|
|
42
|
-
end_at: :end_at,
|
|
43
|
-
# If opting in the public_description, make sure to also add the 'include' array in the api call
|
|
44
|
-
# public_description: :public_description,
|
|
45
|
-
}, -> (api) { api.course(canvas_id) })
|
|
46
|
-
# }, -> (api) { api.course(canvas_id, { include: ['public_description'] }) })
|
|
47
|
-
|
|
48
|
-
scope :active, -> { where(workflow_state: 'active') }
|
|
49
|
-
|
|
50
|
-
scope :current, -> {
|
|
51
|
-
base_query = all.joins(:term)
|
|
52
|
-
base_query
|
|
53
|
-
.where("#{current_table_name}.start_at <= ? OR #{current_table_name}.start_at IS NULL", DateTime.now)
|
|
54
|
-
.where("#{current_table_name}.end_at >= ? OR #{current_table_name}.end_at IS NULL", DateTime.now)
|
|
55
|
-
.or(base_query.merge(Term.current))
|
|
56
|
-
}
|
|
57
|
-
end
|
|
@@ -1,20 +0,0 @@
|
|
|
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 CourseNickname < ApplicationRecord
|
|
12
|
-
include CanvasSync::Record
|
|
13
|
-
include CanvasSync::Concerns::ApiSyncable
|
|
14
|
-
|
|
15
|
-
canvas_sync_features :defaults
|
|
16
|
-
self.primary_key = [:canvas_user_id, :canvas_course_id] unless column_names.include?("id")
|
|
17
|
-
|
|
18
|
-
belongs_to :user, primary_key: :canvas_id, foreign_key: :canvas_user_id, optional: true
|
|
19
|
-
belongs_to :course, primary_key: :canvas_id, foreign_key: :canvas_course_id, optional: true
|
|
20
|
-
end
|
|
@@ -1,29 +0,0 @@
|
|
|
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
|
-
# CourseProgress is not a Canvas model. It is a table built from the Custom Report
|
|
10
|
-
class CourseProgress < ApplicationRecord
|
|
11
|
-
include CanvasSync::Record
|
|
12
|
-
include CanvasSync::Concerns::ApiSyncable
|
|
13
|
-
|
|
14
|
-
canvas_sync_features :defaults
|
|
15
|
-
self.primary_key = [:canvas_user_id, :canvas_course_id] unless column_names.include?("id")
|
|
16
|
-
|
|
17
|
-
belongs_to :user, primary_key: :canvas_id, foreign_key: :canvas_user_id, optional: true
|
|
18
|
-
belongs_to :course, primary_key: :canvas_id, foreign_key: :canvas_course_id, optional: true
|
|
19
|
-
|
|
20
|
-
validates_presence_of :canvas_user_id, :canvas_course_id
|
|
21
|
-
validates_uniqueness_of :canvas_user_id, scope: :canvas_course_id
|
|
22
|
-
|
|
23
|
-
api_syncable({
|
|
24
|
-
requirement_count: :requirement_count,
|
|
25
|
-
requirement_completed_count: :requirement_completed_count,
|
|
26
|
-
# provisioning report has completion_date instead of completed_at in the API
|
|
27
|
-
completion_date: :completed_at
|
|
28
|
-
}, -> (api) { api.course_progress(canvas_course_id, canvas_user_id) })
|
|
29
|
-
end
|
|
@@ -1,48 +0,0 @@
|
|
|
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 Enrollment < ApplicationRecord
|
|
10
|
-
include CanvasSync::Record
|
|
11
|
-
include CanvasSync::Concerns::ApiSyncable
|
|
12
|
-
# include CanvasSync::Concerns::DeletedScoping
|
|
13
|
-
|
|
14
|
-
canvas_sync_features :defaults
|
|
15
|
-
|
|
16
|
-
# include CanvasSync::Concerns::LiveEventSync
|
|
17
|
-
# after_process_live_event do
|
|
18
|
-
# if user.nil?
|
|
19
|
-
# u = User.new(canvas_id: canvas_user_id)
|
|
20
|
-
# u.sync_from_api
|
|
21
|
-
# end
|
|
22
|
-
# if course.nil?
|
|
23
|
-
# c = Course.new(canvas_id: canvas_course_id)
|
|
24
|
-
# c.sync_from_api
|
|
25
|
-
# end
|
|
26
|
-
# end
|
|
27
|
-
|
|
28
|
-
validates :canvas_id, uniqueness: true, presence: true
|
|
29
|
-
belongs_to :user, primary_key: :canvas_id, foreign_key: :canvas_user_id, optional: true
|
|
30
|
-
belongs_to :role, primary_key: :canvas_id, foreign_key: :canvas_role_id, optional: true
|
|
31
|
-
belongs_to :course, primary_key: :canvas_id, foreign_key: :canvas_course_id, optional: true
|
|
32
|
-
belongs_to :section, primary_key: :canvas_id, foreign_key: :canvas_section_id, optional: true
|
|
33
|
-
|
|
34
|
-
api_syncable({
|
|
35
|
-
canvas_id: :id,
|
|
36
|
-
canvas_course_id: :course_id,
|
|
37
|
-
course_sis_id: :sis_course_id,
|
|
38
|
-
canvas_user_id: :user_id,
|
|
39
|
-
user_sis_id: :sis_user_id,
|
|
40
|
-
canvas_section_id: :course_section_id,
|
|
41
|
-
role: :role,
|
|
42
|
-
canvas_role_id: :role_id,
|
|
43
|
-
base_role_type: :type,
|
|
44
|
-
workflow_state: :enrollment_state,
|
|
45
|
-
}, -> (api) { api.enrollment("self", canvas_id) })
|
|
46
|
-
|
|
47
|
-
scope :active, -> { where(workflow_state: 'active') }
|
|
48
|
-
end
|
|
@@ -1,17 +0,0 @@
|
|
|
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 GradingPeriod < ApplicationRecord
|
|
10
|
-
include CanvasSync::Record
|
|
11
|
-
# include CanvasSync::Concerns::DeletedScoping
|
|
12
|
-
|
|
13
|
-
canvas_sync_features :defaults
|
|
14
|
-
|
|
15
|
-
validates :canvas_id, uniqueness: true, presence: true
|
|
16
|
-
belongs_to :grading_period_group, primary_key: :canvas_id, foreign_key: :canvas_grading_period_group_id, optional: true
|
|
17
|
-
end
|
|
@@ -1,16 +0,0 @@
|
|
|
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 GradingPeriodGroup < ApplicationRecord
|
|
10
|
-
include CanvasSync::Record
|
|
11
|
-
# include CanvasSync::Concerns::DeletedScoping
|
|
12
|
-
|
|
13
|
-
canvas_sync_features :defaults
|
|
14
|
-
|
|
15
|
-
validates :canvas_id, uniqueness: true, presence: true
|
|
16
|
-
end
|
|
@@ -1,28 +0,0 @@
|
|
|
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 Group < ApplicationRecord
|
|
10
|
-
include CanvasSync::Record
|
|
11
|
-
include CanvasSync::Concerns::ApiSyncable
|
|
12
|
-
# include CanvasSync::Concerns::DeletedScoping
|
|
13
|
-
|
|
14
|
-
canvas_sync_features :defaults
|
|
15
|
-
|
|
16
|
-
validates :canvas_id, uniqueness: true, presence: true
|
|
17
|
-
belongs_to :course, primary_key: :canvas_id, foreign_key: :canvas_course_id, optional: true
|
|
18
|
-
belongs_to :account, primary_key: :canvas_id, foreign_key: :canvas_account_id, optional: true
|
|
19
|
-
has_many :group_memberships, primary_key: :canvas_id, foreign_key: :canvas_group_id
|
|
20
|
-
|
|
21
|
-
api_syncable({
|
|
22
|
-
canvas_id: :id,
|
|
23
|
-
name: :name,
|
|
24
|
-
canvas_course_id: :course_id,
|
|
25
|
-
sis_id: :sis_group_id,
|
|
26
|
-
workflow_state: ->(r){ 'available' },
|
|
27
|
-
}, -> (api) { api.group(canvas_id) })
|
|
28
|
-
end
|
|
@@ -1,26 +0,0 @@
|
|
|
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 GroupMembership < ApplicationRecord
|
|
10
|
-
include CanvasSync::Record
|
|
11
|
-
include CanvasSync::Concerns::ApiSyncable
|
|
12
|
-
# include CanvasSync::Concerns::DeletedScoping
|
|
13
|
-
|
|
14
|
-
canvas_sync_features :defaults
|
|
15
|
-
|
|
16
|
-
validates :canvas_id, uniqueness: true, presence: true
|
|
17
|
-
belongs_to :group, primary_key: :canvas_id, foreign_key: :canvas_group_id
|
|
18
|
-
belongs_to :user, primary_key: :canvas_id, foreign_key: :canvas_user_id
|
|
19
|
-
|
|
20
|
-
api_syncable({
|
|
21
|
-
canvas_id: :id,
|
|
22
|
-
canvas_group_id: :group_id,
|
|
23
|
-
canvas_user_id: :user_id,
|
|
24
|
-
workflow_state: :workflow_state,
|
|
25
|
-
}, -> (api) { api.group_membership(canvas_group_id, canvas_id) })
|
|
26
|
-
end
|
|
@@ -1,30 +0,0 @@
|
|
|
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 LearningOutcome < ApplicationRecord
|
|
12
|
-
include CanvasSync::Record
|
|
13
|
-
include CanvasSync::Concerns::ApiSyncable
|
|
14
|
-
|
|
15
|
-
canvas_sync_features :defaults
|
|
16
|
-
|
|
17
|
-
belongs_to :context, polymorphic: true, optional: true, primary_key: :canvas_id, foreign_key: :canvas_context_id, foreign_type: :canvas_context_type
|
|
18
|
-
|
|
19
|
-
api_syncable({
|
|
20
|
-
canvas_id: :id,
|
|
21
|
-
canvas_context_id: :context_id,
|
|
22
|
-
canvas_context_type: :context_type,
|
|
23
|
-
name: :title,
|
|
24
|
-
friendly_name: :display_name,
|
|
25
|
-
vendor_guid: :vendor_guid,
|
|
26
|
-
calculation_method: :calculation_method,
|
|
27
|
-
calculation_int: :calculation_int,
|
|
28
|
-
description: :description
|
|
29
|
-
}, ->(api) { api.get("/api/v1/outcomes/#{canvas_id}") })
|
|
30
|
-
end
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# # #
|
|
4
|
-
# AUTO GENERATED MODEL
|
|
5
|
-
# This model was auto generated by the CanvasSync Gem.
|
|
6
|
-
# You can customize it as needed, but make sure you test
|
|
7
|
-
# any changes you make to the auto generated methods.
|
|
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
|
|
@@ -1,19 +0,0 @@
|
|
|
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 Pseudonym < ApplicationRecord
|
|
10
|
-
include CanvasSync::Record
|
|
11
|
-
include CanvasSync::Concerns::DeletedScoping
|
|
12
|
-
|
|
13
|
-
canvas_sync_features :defaults
|
|
14
|
-
|
|
15
|
-
validates :canvas_id, uniqueness: true, presence: true
|
|
16
|
-
belongs_to :user, primary_key: :canvas_id, foreign_key: :canvas_user_id
|
|
17
|
-
|
|
18
|
-
scope :active, -> { where(workflow_state: "active") }
|
|
19
|
-
end
|
|
@@ -1,27 +0,0 @@
|
|
|
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 Role < ApplicationRecord
|
|
10
|
-
include CanvasSync::Record
|
|
11
|
-
include CanvasSync::Concerns::ApiSyncable
|
|
12
|
-
# include CanvasSync::Concerns::DeletedScoping
|
|
13
|
-
|
|
14
|
-
canvas_sync_features :defaults
|
|
15
|
-
|
|
16
|
-
validates :canvas_id, uniqueness: true, presence: true
|
|
17
|
-
has_many :admins, foreign_key: :canvas_role_id, primary_key: :canvas_id
|
|
18
|
-
|
|
19
|
-
api_syncable({
|
|
20
|
-
canvas_id: :id,
|
|
21
|
-
label: :label,
|
|
22
|
-
base_role_type: :base_role_type,
|
|
23
|
-
canvas_account_id: ->(r) { r.dig('account', 'id') },
|
|
24
|
-
permissions: :permissions,
|
|
25
|
-
workflow_state: :workflow_state,
|
|
26
|
-
}, -> (api) { api.get("/api/v1/accounts/#{canvas_account_id}/roles/#{canvas_id}") })
|
|
27
|
-
end
|