Sha256: f4c742b00d91cd1ce7f1a4771aa5d28a9cbf06be686c6bfe418b6121f1cb0998

Contents?: true

Size: 553 Bytes

Versions: 76

Compression:

Stored size: 553 Bytes

Contents

# frozen_string_literal: true

require "attr_extras"

module Renalware
  module Patients
    class LastSuccessfulPracticeSyncDateQuery
      pattr_initialize :identifier

      def call
        max_created_at&.to_date&.to_s
      end

      private

      def max_created_at
        System::APILog
          .where(
            identifier: identifier,
            dry_run: false,
            status: Renalware::System::APILog::STATUS_DONE
          )
          .group(:identifier)
          .maximum(:created_at)[identifier]
      end
    end
  end
end

Version data entries

76 entries across 76 versions & 1 rubygems

Version Path
renalware-core-2.0.159 app/models/renalware/patients/last_successful_practice_sync_date_query.rb
renalware-core-2.0.158 app/models/renalware/patients/last_successful_practice_sync_date_query.rb
renalware-core-2.0.157 app/models/renalware/patients/last_successful_practice_sync_date_query.rb
renalware-core-2.0.156 app/models/renalware/patients/last_successful_practice_sync_date_query.rb
renalware-core-2.0.155 app/models/renalware/patients/last_successful_practice_sync_date_query.rb
renalware-core-2.0.153 app/models/renalware/patients/last_successful_practice_sync_date_query.rb
renalware-core-2.0.152 app/models/renalware/patients/last_successful_practice_sync_date_query.rb
renalware-core-2.0.151 app/models/renalware/patients/last_successful_practice_sync_date_query.rb
renalware-core-2.0.149 app/models/renalware/patients/last_successful_practice_sync_date_query.rb
renalware-core-2.0.148 app/models/renalware/patients/last_successful_practice_sync_date_query.rb
renalware-core-2.0.147 app/models/renalware/patients/last_successful_practice_sync_date_query.rb
renalware-core-2.0.146 app/models/renalware/patients/last_successful_practice_sync_date_query.rb
renalware-core-2.0.145 app/models/renalware/patients/last_successful_practice_sync_date_query.rb
renalware-core-2.0.144 app/models/renalware/patients/last_successful_practice_sync_date_query.rb
renalware-core-2.0.143 app/models/renalware/patients/last_successful_practice_sync_date_query.rb
renalware-core-2.0.142 app/models/renalware/patients/last_successful_practice_sync_date_query.rb
renalware-core-2.0.141 app/models/renalware/patients/last_successful_practice_sync_date_query.rb
renalware-core-2.0.140 app/models/renalware/patients/last_successful_practice_sync_date_query.rb
renalware-core-2.0.139 app/models/renalware/patients/last_successful_practice_sync_date_query.rb
renalware-core-2.0.138 app/models/renalware/patients/last_successful_practice_sync_date_query.rb