canvas_sync 0.17.23.beta1 → 0.17.23.beta6
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/config/initializers/apartment.rb +9 -0
- data/lib/canvas_sync/concerns/sync_mapping.rb +5 -3
- data/lib/canvas_sync/generators/templates/migrations/create_grading_period_groups.rb +0 -4
- data/lib/canvas_sync/generators/templates/models/grading_period_group.rb +0 -2
- data/lib/canvas_sync/generators/templates/models/term.rb +1 -0
- data/lib/canvas_sync/processors/model_mappings.yml +0 -6
- data/lib/canvas_sync/processors/report_processor.rb +2 -2
- data/lib/canvas_sync/record.rb +1 -1
- data/lib/canvas_sync/version.rb +1 -1
- data/lib/canvas_sync.rb +1 -1
- data/spec/dummy/app/models/grading_period_group.rb +0 -2
- data/spec/dummy/app/models/term.rb +1 -0
- data/spec/dummy/db/migrate/{20210907233331_create_grading_period_groups.rb → 20211001184920_create_grading_period_groups.rb} +0 -4
- data/spec/dummy/db/schema.rb +1 -5
- data/spec/dummy/log/development.log +362 -0
- data/spec/dummy/log/test.log +15820 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 298b05c56dda9ca6d603c1242c25fce864b4d69d096f2559a22267546f2183cb
|
4
|
+
data.tar.gz: d130e60ee19646e3d6cb817d63875bfdbd9358772c1dca25e49286c18cd0ca0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1b091aa6718f213dffc0a80985db5d736dcc4269365a8c7cdba713fc17ed256314b66183d050b952284374fc10f18b31018fcfee6fdb4fa9d185824fec73033
|
7
|
+
data.tar.gz: b822704460aef2ea10664ff02de96de7f9baa240e3c1fbd19092a86160cad364ec8f42305882502b3aede3ad4972bd3f168716cba1c65bdd6e3b46014776f7ff
|
@@ -5,6 +5,15 @@
|
|
5
5
|
# * https://github.com/influitive/apartment/issues/508
|
6
6
|
|
7
7
|
Rails.application.config.after_initialize do
|
8
|
+
next unless defined?(Apartment)
|
9
|
+
|
10
|
+
# Newer versions of Apartment already solves this issue (and in a better way)
|
11
|
+
begin
|
12
|
+
require('apartment/version')
|
13
|
+
next if Gem::Version.new(Apartment::VERSION) >= Gem::Version.new('2.8.1')
|
14
|
+
rescue LoadError
|
15
|
+
end
|
16
|
+
|
8
17
|
begin
|
9
18
|
Rails.application.eager_load!
|
10
19
|
ActiveRecord::Base.descendants.each do |model|
|
@@ -24,9 +24,11 @@ module CanvasSync::Concerns
|
|
24
24
|
class Mapping
|
25
25
|
attr_reader :map_def
|
26
26
|
|
27
|
-
def initialize(map_def
|
28
|
-
@map_def = map_def
|
27
|
+
def initialize(map_def, model: nil)
|
29
28
|
@model = model
|
29
|
+
@map_def = map_def
|
30
|
+
@map_def[:conflict_target] ||= []
|
31
|
+
@map_def[:report_columns] ||= {}
|
30
32
|
end
|
31
33
|
|
32
34
|
def self.normalize_model_name(model)
|
@@ -82,7 +84,7 @@ module CanvasSync::Concerns
|
|
82
84
|
end
|
83
85
|
|
84
86
|
def reset_links
|
85
|
-
@map_def = {}
|
87
|
+
@map_def[:report_columns] = {}.with_indifferent_access
|
86
88
|
end
|
87
89
|
|
88
90
|
def unlink_column(key)
|
@@ -4,8 +4,6 @@ class CreateGradingPeriodGroups < ActiveRecord::Migration[5.1]
|
|
4
4
|
def change
|
5
5
|
create_table :grading_period_groups do |t|
|
6
6
|
t.bigint :canvas_id, null: false
|
7
|
-
t.bigint :canvas_course_id
|
8
|
-
t.bigint :canvas_account_id
|
9
7
|
t.string :title
|
10
8
|
t.boolean :weighted
|
11
9
|
t.boolean :display_totals_for_all_grading_periods
|
@@ -16,7 +14,5 @@ class CreateGradingPeriodGroups < ActiveRecord::Migration[5.1]
|
|
16
14
|
end
|
17
15
|
|
18
16
|
add_index :grading_period_groups, :canvas_id, unique: true
|
19
|
-
add_index :grading_period_groups, :canvas_course_id
|
20
|
-
add_index :grading_period_groups, :canvas_account_id
|
21
17
|
end
|
22
18
|
end
|
@@ -4,6 +4,4 @@ class GradingPeriodGroup < ApplicationRecord
|
|
4
4
|
include CanvasSync::Record
|
5
5
|
|
6
6
|
validates :canvas_id, uniqueness: true, presence: true
|
7
|
-
belongs_to :course, primary_key: :canvas_id, foreign_key: :canvas_course_id, optional: true
|
8
|
-
belongs_to :account, primary_key: :canvas_id, foreign_key: :canvas_account_id, optional: true
|
9
7
|
end
|
@@ -6,6 +6,7 @@ class Term < ApplicationRecord
|
|
6
6
|
|
7
7
|
validates :canvas_id, uniqueness: true, presence: true
|
8
8
|
has_many :courses, foreign_key: :canvas_term_id, primary_key: :canvas_id
|
9
|
+
belongs_to :grading_period_group, primary_key: :canvas_id, foreign_key: :grading_period_group_id, optional: true
|
9
10
|
|
10
11
|
api_syncable({
|
11
12
|
canvas_id: :id,
|
@@ -457,12 +457,6 @@ grading_period_groups:
|
|
457
457
|
grading_period_group_id:
|
458
458
|
database_column_name: canvas_id
|
459
459
|
type: integer
|
460
|
-
canvas_course_id:
|
461
|
-
database_column_name: canvas_course_id
|
462
|
-
type: integer
|
463
|
-
canvas_account_id:
|
464
|
-
database_column_name: canvas_account_id
|
465
|
-
type: integer
|
466
460
|
title:
|
467
461
|
database_column_name: title
|
468
462
|
type: string
|
@@ -5,11 +5,11 @@ module CanvasSync
|
|
5
5
|
# Base report processing class
|
6
6
|
class ReportProcessor
|
7
7
|
def mapping
|
8
|
-
SyncMapping::Mapping.default_mappings
|
8
|
+
CanvasSync::Concerns::SyncMapping::Mapping.default_mappings
|
9
9
|
end
|
10
10
|
|
11
11
|
def mapping_for(model, key = nil)
|
12
|
-
model.try(:get_sync_mapping, key) || mapping[key || SyncMapping::Mapping.normalize_model_name(model)]
|
12
|
+
model.try(:get_sync_mapping, key) || mapping[key || CanvasSync::Concerns::SyncMapping::Mapping.normalize_model_name(model)]
|
13
13
|
end
|
14
14
|
|
15
15
|
def do_bulk_import(report_file_path, model, options: {}, mapping_key: nil)
|
data/lib/canvas_sync/record.rb
CHANGED
data/lib/canvas_sync/version.rb
CHANGED
data/lib/canvas_sync.rb
CHANGED
@@ -179,7 +179,7 @@ module CanvasSync
|
|
179
179
|
# These Models use the provisioning report, but are not term-scoped,
|
180
180
|
# so we sync them outside of the term scoping to ensure work is not duplicated
|
181
181
|
if term_scope.present?
|
182
|
-
models -= (first_provisioning_models = models & ['users', 'pseudonyms', 'user_observers'])
|
182
|
+
models -= (first_provisioning_models = models & ['users', 'pseudonyms', 'user_observers', 'grading_periods', 'grading_period_groups'])
|
183
183
|
current_chain.insert(generate_provisioning_jobs(first_provisioning_models, options))
|
184
184
|
end
|
185
185
|
|
@@ -10,6 +10,4 @@ class GradingPeriodGroup < ApplicationRecord
|
|
10
10
|
include CanvasSync::Record
|
11
11
|
|
12
12
|
validates :canvas_id, uniqueness: true, presence: true
|
13
|
-
belongs_to :course, primary_key: :canvas_id, foreign_key: :canvas_course_id, optional: true
|
14
|
-
belongs_to :account, primary_key: :canvas_id, foreign_key: :canvas_account_id, optional: true
|
15
13
|
end
|
@@ -12,6 +12,7 @@ class Term < ApplicationRecord
|
|
12
12
|
|
13
13
|
validates :canvas_id, uniqueness: true, presence: true
|
14
14
|
has_many :courses, foreign_key: :canvas_term_id, primary_key: :canvas_id
|
15
|
+
belongs_to :grading_period_group, primary_key: :canvas_id, foreign_key: :grading_period_group_id, optional: true
|
15
16
|
|
16
17
|
api_syncable({
|
17
18
|
canvas_id: :id,
|
@@ -10,8 +10,6 @@ class CreateGradingPeriodGroups < ActiveRecord::Migration[5.1]
|
|
10
10
|
def change
|
11
11
|
create_table :grading_period_groups do |t|
|
12
12
|
t.bigint :canvas_id, null: false
|
13
|
-
t.bigint :canvas_course_id
|
14
|
-
t.bigint :canvas_account_id
|
15
13
|
t.string :title
|
16
14
|
t.boolean :weighted
|
17
15
|
t.boolean :display_totals_for_all_grading_periods
|
@@ -22,7 +20,5 @@ class CreateGradingPeriodGroups < ActiveRecord::Migration[5.1]
|
|
22
20
|
end
|
23
21
|
|
24
22
|
add_index :grading_period_groups, :canvas_id, unique: true
|
25
|
-
add_index :grading_period_groups, :canvas_course_id
|
26
|
-
add_index :grading_period_groups, :canvas_account_id
|
27
23
|
end
|
28
24
|
end
|
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: 2021_10_01_184920) do
|
14
14
|
|
15
15
|
# These are extensions that must be enabled in order to support this database
|
16
16
|
enable_extension "plpgsql"
|
@@ -175,16 +175,12 @@ ActiveRecord::Schema.define(version: 2021_09_07_233331) do
|
|
175
175
|
|
176
176
|
create_table "grading_period_groups", force: :cascade do |t|
|
177
177
|
t.bigint "canvas_id", null: false
|
178
|
-
t.bigint "canvas_course_id"
|
179
|
-
t.bigint "canvas_account_id"
|
180
178
|
t.string "title"
|
181
179
|
t.boolean "weighted"
|
182
180
|
t.boolean "display_totals_for_all_grading_periods"
|
183
181
|
t.string "workflow_state"
|
184
182
|
t.datetime "created_at", null: false
|
185
183
|
t.datetime "updated_at", null: false
|
186
|
-
t.index ["canvas_account_id"], name: "index_grading_period_groups_on_canvas_account_id"
|
187
|
-
t.index ["canvas_course_id"], name: "index_grading_period_groups_on_canvas_course_id"
|
188
184
|
t.index ["canvas_id"], name: "index_grading_period_groups_on_canvas_id", unique: true
|
189
185
|
end
|
190
186
|
|