Sha256: 7f05e24e4d8deed61d1b68293f2d598c55fcd73813ca15bc242163195455c8cc

Contents?: true

Size: 760 Bytes

Versions: 5

Compression:

Stored size: 760 Bytes

Contents

require_dependency "renalware/reporting"

module Renalware
  module Reporting
    class RefreshAuditDataJob < ApplicationJob
      queue_as :reporting

      # :reek:UtilityFunction
      def perform(audit)
        refresh_materialized_view_associated_with_audit(audit)
        update_audit_refreshment_date(audit)
      end

      private

      def refresh_materialized_view_associated_with_audit(audit)
        Scenic.database.refresh_materialized_view(audit.materialized_view_name,
                                                  concurrently: false,
                                                  cascade: false)
      end

      def update_audit_refreshment_date(audit)
        audit.update!(refreshed_at: Time.zone.now)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
renalware-core-2.0.0.pre.beta8 app/jobs/renalware/reporting/refresh_audit_data_job.rb
renalware-core-2.0.0.pre.beta7 app/jobs/renalware/reporting/refresh_audit_data_job.rb
renalware-core-2.0.0.pre.beta6 app/jobs/renalware/reporting/refresh_audit_data_job.rb
renalware-core-2.0.0.pre.beta5 app/jobs/renalware/reporting/refresh_audit_data_job.rb
renalware-core-2.0.0.pre.beta4 app/jobs/renalware/reporting/refresh_audit_data_job.rb