module CanvasSync module Jobs # ActiveJob class that starts a Canvas provisioning report class SyncProvisioningReportJob < ReportStarter def perform(options) params = { include_deleted: true, } options[:models].each do |model| # group_membership is the only model param that is singular :( model = 'group_membership' if model == 'group_memberships' params[model] = true end merged_params = merge_report_params(options, params, {}).with_indifferent_access # Make sure the report also checks last_activity_at when checking updated_at if options[:models].include?("enrollments") if (%w[last_activity_at total_activity_time] & CanvasSync::Concerns::SyncMapping.mapping_for(Enrollment)[:columns].keys).present? && merged_params.dig(:parameters, :include_last_activity) == nil merged_params[:parameters][:include_last_activity] = true end end super( "proservices_provisioning_csv", merged_params, CanvasSync::Processors::ProvisioningReportProcessor.to_s, options, ) end end end end