coalescing_panda 4.1.6 → 4.1.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 22c6676c9d9e90786efa807220f76ff9b2eec393
4
- data.tar.gz: 035edddad586577ecb9ec49660559f5d09818004
3
+ metadata.gz: 6f4912c4f377ab6dc3af857a6cac11ed95469372
4
+ data.tar.gz: 30c64780d7a555b2a5fcca97fe8ed765671e0adc
5
5
  SHA512:
6
- metadata.gz: 0c4e3fc9c21ca02ea50ef51fc5672f4177372e594572134f24c1a978699876973610648522364acde75734cf2f6bffa443c17ae1725e1568ab67376803c6efbe
7
- data.tar.gz: cf8af365aebf0a52ad293840bdbb9af05322f882a6e7c87e7a2633c3ee509fbdb5bb36e29bb954067f40e5f59ecdc20875c6bb632c63e33ea0df757acf7224f2
6
+ metadata.gz: 6c45fd938101df7b68d98cbfd764c593de297e4f32ad194f0885966843fc119bf01bd20cc54ac47666ead35e2221ed5c804904dffc4c37b5ea446450a4cba6d8
7
+ data.tar.gz: 49f7463678db3a3ec821748868bfcb2b469ba7fb72d213e122dab59bb0e25b235f6c16256000d725b6919d0f04ef2efdb34b7294fa96f3b949b0e40096db3dfd
@@ -106,39 +106,39 @@ class CoalescingPanda::Workers::CourseMiner
106
106
  end
107
107
 
108
108
  def sync_assignment_groups(collection)
109
- begin
110
- collection.each do |values|
109
+ collection.each do |values|
110
+ begin
111
111
  values['canvas_assignment_group_id'] = values['id'].to_s
112
112
  assignment_group = course.assignment_groups.where(canvas_assignment_group_id: values['canvas_assignment_group_id']).first_or_initialize
113
113
  assignment_group.assign_attributes(standard_attributes(assignment_group, values))
114
114
  assignment_group.save(validate: false)
115
115
  assignment_group_ids << assignment_group.id
116
+ rescue => e
117
+ Rails.logger.error "Error syncing assignment group: #{values} Error: #{e}"
116
118
  end
117
- course.assignment_groups.where.not(id: assignment_group_ids).destroy_all
118
- rescue => e
119
- Rails.logger.error "Error syncing assignment groups: #{e}"
120
119
  end
120
+ course.assignment_groups.where.not(id: assignment_group_ids).destroy_all
121
121
  end
122
122
 
123
123
  def sync_sections(collection)
124
- begin
125
- collection.each do |values|
124
+ collection.each do |values|
125
+ begin
126
126
  values['course_section_id'] = values['id'].to_s
127
127
  section = course.sections.where(canvas_section_id: values['course_section_id']).first_or_initialize
128
128
  section.assign_attributes(standard_attributes(section, values))
129
129
  section.sis_id = values['sis_section_id']
130
130
  section.save(validate: false)
131
131
  course_section_ids << section.id
132
+ rescue => e
133
+ Rails.logger.error "Error syncing section: #{values} Error: #{e}"
132
134
  end
133
- course.sections.where.not(id: course_section_ids).destroy_all
134
- rescue => e
135
- Rails.logger.error "Error syncing sections: #{e}"
136
135
  end
136
+ course.sections.where.not(id: course_section_ids).destroy_all
137
137
  end
138
138
 
139
139
  def sync_users(collection)
140
- begin
141
- collection.each do |values|
140
+ collection.each do |values|
141
+ begin
142
142
  values['canvas_user_id'] = values["id"].to_s
143
143
  user = account.users.where(canvas_user_id: values['canvas_user_id']).first_or_initialize
144
144
  user.coalescing_panda_lti_account_id = account.id
@@ -146,18 +146,18 @@ class CoalescingPanda::Workers::CourseMiner
146
146
  user.sis_id = values['sis_user_id'].to_s
147
147
  user_ids << user.id
148
148
  user.save(validate: false)
149
+ rescue => e
150
+ Rails.logger.error "Error syncing user: #{values} Error: #{e}"
149
151
  end
150
- removed_users = course.users.where.not(id: user_ids)
151
- removed_users.each do |user|
152
- user.enrollments.each do |enrollment|
153
- course.submissions.where(coalescing_panda_user_id: enrollment.user.id).destroy_all
154
- enrollment.destroy
155
- end
152
+ end
153
+ removed_users = course.users.where.not(id: user_ids)
154
+ removed_users.each do |user|
155
+ user.enrollments.each do |enrollment|
156
+ course.submissions.where(coalescing_panda_user_id: enrollment.user.id).destroy_all
157
+ enrollment.destroy
156
158
  end
157
- removed_users.destroy_all
158
- rescue => e
159
- Rails.logger.error "Error syncing users: #{e}"
160
159
  end
160
+ removed_users.destroy_all
161
161
  end
162
162
 
163
163
  def sync_enrollments(collection)
@@ -185,8 +185,8 @@ class CoalescingPanda::Workers::CourseMiner
185
185
  end
186
186
 
187
187
  def sync_assignments(collection)
188
- begin
189
- collection.each do |values|
188
+ collection.each do |values|
189
+ begin
190
190
  values['canvas_assignment_id'] = values['id'].to_s
191
191
  assignment = course.assignments.where(canvas_assignment_id: values['canvas_assignment_id']).first_or_initialize
192
192
  assignment_group = course.assignment_groups.find_by(canvas_assignment_group_id: values['assignment_group_id'])
@@ -194,58 +194,58 @@ class CoalescingPanda::Workers::CourseMiner
194
194
  assignment.assign_attributes(standard_attributes(assignment, values))
195
195
  assignment.save(validate: false)
196
196
  assignment_ids << assignment.id
197
+ rescue => e
198
+ Rails.logger.error "Error syncing assignment: #{values} Error: #{e}"
197
199
  end
198
- course.assignments.where.not(id: assignment_ids).each do |assignment|
199
- assignment.submissions.destroy_all
200
- assignment.destroy!
201
- end
202
- rescue => e
203
- Rails.logger.error "Error syncing assignments: #{e}"
200
+ end
201
+ course.assignments.where.not(id: assignment_ids).each do |assignment|
202
+ assignment.submissions.destroy_all
203
+ assignment.destroy!
204
204
  end
205
205
  end
206
206
 
207
207
  def sync_submissions(collection)
208
- begin
209
- collection.each do |values|
208
+ collection.each do |values|
209
+ begin
210
210
  values['canvas_submission_id'] = values['id'].to_s
211
211
  submission = course.submissions.where(canvas_submission_id: values['canvas_submission_id']).first_or_initialize
212
212
  submission.user = course.users.find_by(canvas_user_id: values['user_id'].to_s)
213
213
  submission.assignment = course.assignments.find_by(canvas_assignment_id: values['assignment_id'].to_s)
214
214
  submission.assign_attributes(standard_attributes(submission, values))
215
215
  submission.save(validate: false)
216
+ rescue => e
217
+ Rails.logger.error "Error syncing submission: #{values} Error: #{e}"
216
218
  end
217
- rescue => e
218
- Rails.logger.error "Error syncing submissions: #{e}"
219
219
  end
220
220
  end
221
221
 
222
222
  def sync_groups(collection)
223
- begin
224
- collection.each do |values|
223
+ collection.each do |values|
224
+ begin
225
225
  values['canvas_group_id'] = values['id'].to_s
226
226
  group = course.groups.where(canvas_group_id: values['canvas_group_id']).first_or_initialize
227
227
  group.assign_attributes(standard_attributes(group, values))
228
228
  group.save(validate: false)
229
229
  group_ids << group.id
230
+ rescue => e
231
+ Rails.logger.error "Error syncing group: #{values} Error: #{e}"
230
232
  end
231
- course.groups.where.not(id: group_ids).destroy_all
232
- rescue => e
233
- Rails.logger.error "Error syncing groups: #{e}"
234
233
  end
234
+ course.groups.where.not(id: group_ids).destroy_all
235
235
  end
236
236
 
237
237
  def sync_group_memberships(collection)
238
- begin
239
- collection.each do |values|
238
+ collection.each do |values|
239
+ begin
240
240
  values['canvas_group_membership_id'] = values['id'].to_s
241
241
  group_membership = course.group_memberships.where(canvas_group_membership_id: values['canvas_group_membership_id']).first_or_initialize
242
242
  group_membership.group = course.groups.find_by(canvas_group_id: values['group_id'].to_s)
243
243
  group_membership.user = course.users.find_by(canvas_user_id: values['user_id'].to_s)
244
244
  group_membership.assign_attributes(standard_attributes(group_membership, values))
245
245
  group_membership.save(validate: false)
246
+ rescue => e
247
+ Rails.logger.error "Error syncing group memebership: #{values} Error: #{e}"
246
248
  end
247
- rescue => e
248
- Rails.logger.error "Error syncing group memberships: #{e}"
249
249
  end
250
250
  end
251
251
 
@@ -1,3 +1,3 @@
1
1
  module CoalescingPanda
2
- VERSION = '4.1.6'
2
+ VERSION = '4.1.7'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coalescing_panda
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.6
4
+ version: 4.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Mills
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-06-03 00:00:00.000000000 Z
13
+ date: 2015-06-11 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
@@ -546,3 +546,4 @@ test_files:
546
546
  - spec/models/coalescing_panda/workers/course_miner_spec.rb
547
547
  - spec/rails_helper.rb
548
548
  - spec/spec_helper.rb
549
+ has_rdoc: