fix duplicate temp enrollment entries in sis export

fixes FOO-4489
refs FOO-3683
flag = temporary_enrollments

test plan:
 • add temporary enrollments in various states
 • run the enrollments provisioning report with the temporary_enrollments
   feature flag enabled and disabled
 • run the SIS Export report with the temporary_enrollments feature flag
   enabled and disabled
 • verify that the report includes the temporary enrollment data when the
   feature flag is enabled and does not include the temporary enrollment
   data when the feature flag is disabled
 • ensure that the temporary enrollment data is not duplicated in the SIS
   Export or provisioning reports

Change-Id: Ida98163cd573b4fa5ee4b03de483a2a43ff3a226
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/349049
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Charley Kline <ckline@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: August Thornton <august@instructure.com>
This commit is contained in:
August Thornton 2024-06-03 11:56:50 -07:00
parent fce4398aca
commit 861e0e0bfc
2 changed files with 5 additions and 8 deletions

View File

@ -581,7 +581,7 @@ module AccountReports
unless enrollment.temporary_enrollment_source_user_id.nil?
temporary_enrollment_provider_pseudonym = loaded_pseudonym(pseudonyms, users_by_id[enrollment.temporary_enrollment_source_user_id], include_deleted: @include_deleted)
end
row << temporary_enrollment_provider_pseudonym&.sis_user_id if @temp_enroll_feature_enabled
row << temporary_enrollment_provider_pseudonym&.sis_user_id if @temp_enroll_feature_enabled && @sis_format
row << HostUrl.context_host(pseud.account) if include_other_roots
row
end
@ -658,9 +658,8 @@ module AccountReports
headers << "base_role_type"
headers << "limit_section_privileges"
headers << "canvas_enrollment_id"
headers << "canvas_temporary_enrollment_source_user_id" if @temp_enroll_feature_enabled
end
headers << "canvas_temporary_enrollment_source_user_id" if @temp_enroll_feature_enabled
headers << "temporary_enrollment_source_user_id" if @temp_enroll_feature_enabled
headers << "root_account" if include_other_roots
headers
end

View File

@ -1833,7 +1833,7 @@ describe "Default Account Reports" do
)
end
it "returns temporary enrollments data with feature enabled" do
it "returns data with feature enabled" do
parameters = {}
parameters["enrollments"] = true
parameters["enrollment_filter"] = "TeacherEnrollment"
@ -1855,7 +1855,6 @@ describe "Default Account Reports" do
"TeacherEnrollment",
"false",
@enrollment9.id.to_s,
nil,
nil],
[@course1.id.to_s,
"SIS_COURSE_ID_1",
@ -1872,11 +1871,10 @@ describe "Default Account Reports" do
"TeacherEnrollment",
"false",
@enrollment.id.to_s,
@user4.id.to_s,
@user4.pseudonyms.first.sis_user_id]]
@user4.id.to_s]]
end
it "does not return temporary enrollments data with feature disabled" do
it "does not return data with feature disabled" do
@account.disable_feature!(:temporary_enrollments)
parameters = {}
parameters["enrollments"] = true