Sha256: de17f74ec01b917bd2d5c5afeafa321de0386caed2b647b923a8630d0f6798cc

Contents?: true

Size: 1.17 KB

Versions: 44

Compression:

Stored size: 1.17 KB

Contents

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

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
canvas_sync-0.19.0.beta1 lib/canvas_sync/jobs/sync_provisioning_report_job.rb
canvas_sync-0.18.12 lib/canvas_sync/jobs/sync_provisioning_report_job.rb
canvas_sync-0.18.10 lib/canvas_sync/jobs/sync_provisioning_report_job.rb
canvas_sync-0.18.9 lib/canvas_sync/jobs/sync_provisioning_report_job.rb