canvas_sync 0.18.9 → 0.18.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 490c7e8d4a1b61e5bd17dd938a0387f68718789bb05ad8c071d1a7dca83374ac
4
- data.tar.gz: 06e933489bb8fd39f8af4a2c8498032faf7edf064a1df5cf882659823fa0f597
3
+ metadata.gz: 911b4fffbc2c21c25f32b45c0c90419dddcef40497b63c5d5757ec0e12544e36
4
+ data.tar.gz: 90377a8facd25b77726ab82754a50c7aa3a9851c1012801496e19d6258ea7275
5
5
  SHA512:
6
- metadata.gz: 43fb1c9a539c970093c742ef2dd8cb1737a46f3b47ed1958b25fb3e3703ca3195677024d62d438d101ac913a53dbd86291fdaa3bd290c78e0b318064f6c27ddf
7
- data.tar.gz: a08e7076c32de83470a32d2238ed0ac77055d3afa65411c0663330803e58b7edf2c9fa6a3b121c2835ec2347a23c40499248d35199c83de3f99347c71d7e77c9
6
+ metadata.gz: 5186a70509b324acdd5e8a8e023fdfb9503b7e899894938944632759eeb0bf362cd467f30700f3d8ba02a0ee06476c7646b83acf34ea3eeae5d0375a518d1096
7
+ data.tar.gz: 11812e324c87f8055baaade4a36a822b090b66c95691521a32eb89855c51ceddeaee417f87aae9f5b5c5401c1fe3a6433d102b4a5d9948f5278835ce71f8530d
@@ -21,7 +21,7 @@ module CanvasSync::Concerns
21
21
  end
22
22
 
23
23
  def get_lti_cust_param(key)
24
- nkey = key.gsub(/^custom_/, '')
24
+ nkey = key.to_s.gsub(/^custom_/, '')
25
25
 
26
26
  launch_params.dig("https://purl.imsglobal.org/spec/lti/claim/custom", nkey) || launch_params[nkey] || launch_params["custom_#{nkey}"]
27
27
  end
@@ -98,6 +98,10 @@ module CanvasSync
98
98
  end
99
99
  end
100
100
 
101
+ def empty?
102
+ self.class.get_chain_parameter(self).empty?
103
+ end
104
+
101
105
  def get_sub_chain(sub_type)
102
106
  matching_jobs = find_matching_jobs(sub_type).to_a
103
107
  raise "Found multiple \"#{sub_type}\" jobs in the chain" if matching_jobs.count > 1
@@ -1,3 +1,3 @@
1
1
  module CanvasSync
2
- VERSION = "0.18.9".freeze
2
+ VERSION = "0.18.10".freeze
3
3
  end
data/lib/canvas_sync.rb CHANGED
@@ -170,9 +170,6 @@ module CanvasSync
170
170
  # General provisioning jobs (not term-scoped)
171
171
  ##############################
172
172
 
173
- # Terms are always synced regardless of the models option
174
- models -= ['terms']
175
-
176
173
  # Accounts, users, roles, and admins cannot be scoped to term
177
174
  try_add_model_job.call('accounts')
178
175
 
@@ -194,9 +191,10 @@ module CanvasSync
194
191
  # Per-term provisioning jobs
195
192
  ###############################
196
193
 
194
+ term_parent_chain = current_chain
195
+
197
196
  per_term_chain = JobBatches::ChainBuilder.new(model_job_map[:terms])
198
197
  per_term_chain.params[:term_scope] = term_scope
199
- current_chain << per_term_chain
200
198
  current_chain = per_term_chain
201
199
 
202
200
  term_scoped_models.each do |mdl|
@@ -207,6 +205,11 @@ module CanvasSync
207
205
  generate_provisioning_jobs(models, options)
208
206
  )
209
207
 
208
+ # Skip syncing terms if not required
209
+ unless current_chain.empty? || (models & ['terms']).present?
210
+ term_parent_chain << per_term_chain
211
+ end
212
+
210
213
  ###############################
211
214
  # Wrap it all up
212
215
  ###############################