grade exchange fixes

Change-Id: Ica73e07a633b533f767624088dab150fcaa9506b
Reviewed-on: https://gerrit.instructure.com/3742
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
This commit is contained in:
JT Olds 2011-05-19 18:20:01 -06:00
parent 0282a637a8
commit 0d4102082d
4 changed files with 13 additions and 5 deletions

View File

@ -888,6 +888,7 @@ class Course < ActiveRecord::Base
settings = PluginSetting.settings_for_plugin('grade_export')
raise "final grade publishing disabled" unless settings[:enabled] == "true"
raise "no grading standard supplied" unless self.grading_standard_id
raise "endpoint undefined" if settings[:publish_endpoint].nil? || settings[:publish_endpoint].empty?
enrollments = self.student_enrollments.scoped({:include => [:user, :course_section]}).find(:all, :order => "users.sortable_name")
@ -900,8 +901,14 @@ class Course < ActiveRecord::Base
if Course.valid_grade_export_types.has_key?(settings[:format_type])
callback = Course.valid_grade_export_types[settings[:format_type]][:callback]
posts_to_make, ignored_enrollments_ids = callback.call(self, enrollments,
publishing_pseudonym)
begin
posts_to_make, ignored_enrollment_ids = callback.call(self, enrollments,
publishing_pseudonym)
rescue
Enrollment.update enrollments.map(&:id),
[{ :grade_publishing_status => "error" }] * enrollments.size
raise
end
end
Enrollment.update ignored_enrollment_ids, [{ :grade_publishing_status => "unpublishable" }] * ignored_enrollment_ids.size

View File

@ -404,7 +404,7 @@ class Enrollment < ActiveRecord::Base
end
def computed_final_grade
return "TODO"
self.course.score_to_grade(self.computed_final_score)
end
def self.students(opts={})

View File

@ -2,7 +2,7 @@
<table style="width: 500px;" class="formtable">
<tr>
<td colspan=2><%= f.check_box :enabled, {}, 'true', 'false' %>
<%= f.label :enabled, "Enabled:" %></td>
<%= f.label :enabled, "Enabled" %></td>
</tr>
<tr>
<td><%= f.label :format_type, "Output format type:" %></td>
@ -14,7 +14,7 @@
</tr>
<tr>
<td colspan=2><%= f.check_box :wait_for_success, {}, 'yes', 'no' %>
<%= f.label :wait_for_success, "Wait for success notifications:" %></td>
<%= f.label :wait_for_success, "Wait for success notifications" %></td>
</tr>
<tr>
<td><%= f.label :success_timeout, "Success notification timeout (in seconds):" %></td>

View File

@ -641,6 +641,7 @@ describe Course, 'grade_publishing' do
client.close
server.close
}
@course.grading_standard_id = 0
@course.publish_final_grades(user)
server_thread.join
post_lines.should == [