32
33
34
35
36
37
38
39
40
41
42
|
# File 'app/models/renalware/hd/patients_with_unmet_preferences_query.rb', line 32
def having_an_unmet_preference
sql = <<-SQL.squish
(hd_preference_sets.hospital_unit_id > 0 AND
hd_profiles.hospital_unit_id != hd_preference_sets.hospital_unit_id) OR
(coalesce(hd_preference_sets.schedule_definition_id, 0) != 0 AND
hd_profiles.schedule_definition_id != hd_preference_sets.schedule_definition_id) OR
(coalesce(hd_preference_sets.other_schedule, '') != '' AND
hd_profiles.other_schedule != hd_preference_sets.other_schedule)
SQL
where(sql)
end
|