Class: Renalware::UKRDC::PatientsQuery

Inherits:
Object
  • Object
show all
Defined in:
app/models/renalware/ukrdc/patients_query.rb

Overview

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.

Instance Method Summary collapse

Instance Method Details

#call(changed_since: nil) ⇒ Object



11
12
13
14
15
16
17
# File 'app/models/renalware/ukrdc/patients_query.rb', line 11

def call(changed_since: nil)
  if changed_since.present?
    rpv_patients.where("updated_at > ?", changed_since)
  else
    rpv_patients.where("(sent_to_ukrdc_at is null) or (updated_at > sent_to_ukrdc_at)")
  end
end