fix sis_batch id in course activity
fixes: CNVS-13302 Fixes the sis imports to log the sis batch correctly and to display the sis batch on the details modal in the auditing ui. Test Plan: - Do a SIS import for a course. - Open the Course Activity Audit logging and the sis batch id for the course should be shown in the dialog. - If the source for an event is not SIS the sis batch field will not be shown. Change-Id: Ib93a992dac83b2ec480d888e5d4686b808bcda8f Reviewed-on: https://gerrit.instructure.com/35475 Tested-by: Jenkins <jenkins@instructure.com> QA-Review: August Thornton <august@instructure.com> Reviewed-by: Jacob Fugal <jacob@instructure.com> Product-Review: Nick Cloward <ncloward@instructure.com>
This commit is contained in:
parent
e6086949ee
commit
feb9644b0f
|
@ -28,8 +28,7 @@ class Auditors::Course
|
|||
def self.generate(course, user, event_type, event_data = {}, opts = {})
|
||||
event_source = opts[:source] || :manual
|
||||
sis_batch_id = opts[:sis_batch_id]
|
||||
|
||||
new(
|
||||
event = new(
|
||||
'course' => course,
|
||||
'user' => user,
|
||||
'event_type' => event_type,
|
||||
|
@ -37,6 +36,8 @@ class Auditors::Course
|
|||
'event_source' => event_source.to_s,
|
||||
'sis_batch_id' => sis_batch_id
|
||||
)
|
||||
event.sis_batch = opts[:sis_batch] if opts[:sis_batch]
|
||||
event
|
||||
end
|
||||
|
||||
def initialize(*args)
|
||||
|
|
|
@ -9,6 +9,14 @@
|
|||
<dd>{{user.name}}</dd>
|
||||
<dt>{{#t "event_source_label"}}Source{{/t}}:</dt>
|
||||
<dd>{{event_source_present}}</dd>
|
||||
{{#ifEqual event_source 'sis'}}
|
||||
<dt>{{#t "event_sis_batch"}}SIS Batch{{/t}}:</dt>
|
||||
{{#if links.sis_batch}}
|
||||
<dd>{{links.sis_batch}}</dd>
|
||||
{{else}}
|
||||
<dd>{{#t "blank_placeholder"}}-{{/t}}</dd>
|
||||
{{/if}}
|
||||
{{/ifEqual}}
|
||||
<dt>{{#t "event_type_label"}}Type{{/t}}:</dt>
|
||||
<dd>{{event_type_present}}</dd>
|
||||
{{#ifEqual event_type 'copied_to'}}
|
||||
|
|
|
@ -174,7 +174,7 @@ module SIS
|
|||
Auditors::Course.record_updated(templated_course, @batch_user, changes, source: :sis, sis_batch_id: @batch_id)
|
||||
else
|
||||
msg = "A (templated) course did not pass validation "
|
||||
msg += "(" + "course: #{course_id} / #{short_name}, error: " +
|
||||
msg += "(" + "course: #{course_id} / #{short_name}, error: " +
|
||||
msg += templated_course.errors.full_messages.join(",") + ")"
|
||||
raise ImportError, msg
|
||||
end
|
||||
|
@ -186,7 +186,7 @@ module SIS
|
|||
auditor_state_changes(course, state_changes, course_changes)
|
||||
else
|
||||
msg = "A course did not pass validation "
|
||||
msg += "(" + "course: #{course_id} / #{short_name}, error: " +
|
||||
msg += "(" + "course: #{course_id} / #{short_name}, error: " +
|
||||
msg += course.errors.full_messages.join(",") + ")"
|
||||
raise ImportError, msg
|
||||
end
|
||||
|
@ -201,8 +201,8 @@ module SIS
|
|||
|
||||
def auditor_state_changes(course, state_changes, changes = {})
|
||||
options = {
|
||||
source: :sis,
|
||||
sis_batch_id: @batch_id
|
||||
source: :sis,
|
||||
sis_batch: @batch
|
||||
}
|
||||
|
||||
state_changes.each do |state_change|
|
||||
|
|
|
@ -62,9 +62,10 @@ describe Auditors::Course do
|
|||
end
|
||||
|
||||
it "should log event with sis_batch_id and event source of sis" do
|
||||
@event = Auditors::Course.record_created(@course, @teacher, @course.changes, source: :sis, sis_batch_id: 42)
|
||||
sis_batch = @account.root_account.sis_batches.create
|
||||
@event = Auditors::Course.record_created(@course, @teacher, @course.changes, source: :sis, sis_batch: sis_batch)
|
||||
@event.event_source.should == :sis
|
||||
@event.sis_batch_id.should == 42
|
||||
@event.sis_batch_id.should == sis_batch.id
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -460,6 +460,10 @@ describe "admin_tools" do
|
|||
@event = Auditors::Course.record_updated(@course, @teacher, @course.changes)
|
||||
|
||||
show_event_details("Updated", old_name)
|
||||
items = ffj('.ui-dialog dl > dd')
|
||||
items[4].text.should == "Manual"
|
||||
items[5].text.should == "Updated"
|
||||
|
||||
cols = ffj('.ui-dialog table:first tbody tr:first td')
|
||||
cols.size.should == 3
|
||||
cols[0].text.should == "Name"
|
||||
|
@ -467,6 +471,19 @@ describe "admin_tools" do
|
|||
cols[2].text.should == @course.name
|
||||
end
|
||||
|
||||
it "should show sis batch id if source is sis" do
|
||||
old_name = @course.name
|
||||
@course.name = "Course Updated"
|
||||
|
||||
sis_batch = @account.root_account.sis_batches.create
|
||||
@event = Auditors::Course.record_updated(@course, @teacher, @course.changes, source: :sis, sis_batch: sis_batch)
|
||||
|
||||
show_event_details("Updated", old_name)
|
||||
items = ffj('.ui-dialog dl > dd')
|
||||
items[4].text.should == "SIS"
|
||||
items[5].text.should == sis_batch.id.to_s
|
||||
end
|
||||
|
||||
it "should show concluded event details" do
|
||||
@event = Auditors::Course.record_concluded(@course, @teacher)
|
||||
show_event_details("Concluded")
|
||||
|
|
Loading…
Reference in New Issue