Sha256: 51e870b113e349612545be2f22464fee2296f4aa4255ffec80cb93dcdb97dc89

Contents?: true

Size: 700 Bytes

Versions: 23

Compression:

Stored size: 700 Bytes

Contents

# frozen_string_literal: true

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

23 entries across 23 versions & 1 rubygems

Version Path
renalware-core-2.0.34 app/models/renalware/ukrdc/patients_query.rb
renalware-core-2.0.33 app/models/renalware/ukrdc/patients_query.rb
renalware-core-2.0.32 app/models/renalware/ukrdc/patients_query.rb
renalware-core-2.0.31 app/models/renalware/ukrdc/patients_query.rb
renalware-core-2.0.30 app/models/renalware/ukrdc/patients_query.rb
renalware-core-2.0.28 app/models/renalware/ukrdc/patients_query.rb
renalware-core-2.0.27 app/models/renalware/ukrdc/patients_query.rb
renalware-core-2.0.26 app/models/renalware/ukrdc/patients_query.rb
renalware-core-2.0.25 app/models/renalware/ukrdc/patients_query.rb
renalware-core-2.0.24 app/models/renalware/ukrdc/patients_query.rb
renalware-core-2.0.23 app/models/renalware/ukrdc/patients_query.rb
renalware-core-2.0.22 app/models/renalware/ukrdc/patients_query.rb
renalware-core-2.0.21 app/models/renalware/ukrdc/patients_query.rb
renalware-core-2.0.20 app/models/renalware/ukrdc/patients_query.rb
renalware-core-2.0.18 app/models/renalware/ukrdc/patients_query.rb
renalware-core-2.0.17 app/models/renalware/ukrdc/patients_query.rb
renalware-core-2.0.16 app/models/renalware/ukrdc/patients_query.rb
renalware-core-2.0.15 app/models/renalware/ukrdc/patients_query.rb
renalware-core-2.0.14 app/models/renalware/ukrdc/patients_query.rb
renalware-core-2.0.13 app/models/renalware/ukrdc/patients_query.rb