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 = "(hd_preference_sets.hospital_unit_id > 0 AND\nhd_profiles.hospital_unit_id != hd_preference_sets.hospital_unit_id) OR\n(coalesce(hd_preference_sets.schedule_definition_id, 0) != 0 AND\nhd_profiles.schedule_definition_id != hd_preference_sets.schedule_definition_id) OR\n(coalesce(hd_preference_sets.other_schedule, '') != '' AND\nhd_profiles.other_schedule != hd_preference_sets.other_schedule)\n".squish
where(sql)
end
|