Sha256: 9673f86ac56da0d0ac4fb7587e89278e8f3070cc9c8a845cbaa98dbd07487b3a
Contents?: true
Size: 808 Bytes
Versions: 10
Compression:
Stored size: 808 Bytes
Contents
module Renalware module HD class MDMPatientsQuery include ModalityScopes include PatientPathologyScopes MODALITY_NAMES = "HD".freeze DEFAULT_SEARCH_PREDICATE = "hgb_date desc".freeze attr_reader :q, :relation def initialize(relation: HD::Patient.all, q:) @q = q || {} @q[:s] = DEFAULT_SEARCH_PREDICATE if @q[:s].blank? @relation = relation end def call search.result end def search @search ||= begin relation .includes(:hd_profile) .extending(ModalityScopes) .extending(PatientPathologyScopes) .with_current_pathology .with_current_modality_matching(MODALITY_NAMES) .search(q) end end end end end
Version data entries
10 entries across 10 versions & 1 rubygems