Sha256: 82d70210be7fb266a2aad9729907fdeacc47184b974c4fe53e0eddf3e723b4a1

Contents?: true

Size: 669 Bytes

Versions: 9

Compression:

Stored size: 669 Bytes

Contents

require_dependency "renalware/ukrdc"

module Renalware
  module UKRDC
    # If the optional :changed_since argument is passed we select all RPV
    # patients how have been updated since that date. Otherwise we select all RPV
    # patients who have changed since the last time they were exported.
    class PatientsQuery
      def call(changed_since: nil)
        if changed_since.present?
          rpv_patients.where("updated_at > ?", changed_since)
        else
          rpv_patients.where("updated_at > sent_to_ukrdc_at")
        end
      end

      private

      def rpv_patients
        Renalware::Patient.where(send_to_rpv: true)
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
renalware-core-2.0.8 app/models/renalware/ukrdc/patients_query.rb
renalware-core-2.0.7 app/models/renalware/ukrdc/patients_query.rb
renalware-core-2.0.5 app/models/renalware/ukrdc/patients_query.rb
renalware-core-2.0.4 app/models/renalware/ukrdc/patients_query.rb
renalware-core-2.0.3 app/models/renalware/ukrdc/patients_query.rb
renalware-core-2.0.2 app/models/renalware/ukrdc/patients_query.rb
renalware-core-2.0.1 app/models/renalware/ukrdc/patients_query.rb
renalware-core-2.0.0 app/models/renalware/ukrdc/patients_query.rb
renalware-core-2.0.0.pre.rc13 app/models/renalware/ukrdc/patients_query.rb