using update_all for enrollments when publishing grades
Change-Id: I231318891c9896e7e2fc083eaddaa5010a1b2bcf Reviewed-on: https://gerrit.instructure.com/3940 Tested-by: Hudson <hudson@instructure.com> Reviewed-by: Jon Jensen <jon@instructure.com>
This commit is contained in:
parent
1d6cadf7a6
commit
d2c0dbef95
|
@ -905,21 +905,20 @@ class Course < ActiveRecord::Base
|
|||
posts_to_make, ignored_enrollment_ids = callback.call(self, enrollments,
|
||||
publishing_pseudonym)
|
||||
rescue
|
||||
Enrollment.update enrollments.map(&:id),
|
||||
[{ :grade_publishing_status => "error" }] * enrollments.size
|
||||
Enrollment.update_all({ :grade_publishing_status => "error" }, { :id => enrollments.map(&:id) })
|
||||
raise
|
||||
end
|
||||
end
|
||||
|
||||
Enrollment.update ignored_enrollment_ids, [{ :grade_publishing_status => "unpublishable" }] * ignored_enrollment_ids.size
|
||||
Enrollment.update_all({ :grade_publishing_status => "unpublishable" }, { :id => ignored_enrollment_ids })
|
||||
|
||||
posts_to_make.each do |enrollment_ids, res, mime_type|
|
||||
begin
|
||||
SSLCommon.post_data(settings[:publish_endpoint], res, mime_type)
|
||||
Enrollment.update enrollment_ids, [{ :grade_publishing_status => (settings[:wait_for_success] == "yes" ? "publishing" : "published") }] * enrollment_ids.size
|
||||
Enrollment.update_all({ :grade_publishing_status => (settings[:wait_for_success] == "yes" ? "publishing" : "published") }, { :id => enrollment_ids })
|
||||
rescue => e
|
||||
errors << e
|
||||
Enrollment.update enrollment_ids, [{ :grade_publishing_status => "error" }] * enrollment_ids.size
|
||||
Enrollment.update_all({ :grade_publishing_status => "error" }, { :id => enrollment_ids })
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue