Sha256: 2c2a94bb9610bc684f9edb5137827d01406b1e4dc3148dbd5c2789020fef2127
Contents?: true
Size: 995 Bytes
Versions: 52
Compression:
Stored size: 995 Bytes
Contents
# frozen_string_literal: true require_dependency "renalware/patients" module Renalware module Patients class AbridgementsController < BaseController def index authorize Abridgement, :index? render locals: { form: AbridgementSearchForm.new, results: abridgements_matching_search_criteria, results_matching_dob: abridgements_matching_dobs } end private def abridgements_matching_search_criteria return [] if search_params.blank? Abridgement.where(hospital_number: search_params) end def abridgements_matching_dobs return [] if abridgements_matching_search_criteria.empty? dobs = abridgements_matching_search_criteria.map(&:born_on).uniq.compact return [] if dobs.empty? Abridgement.where(born_on: dobs) - abridgements_matching_search_criteria end def search_params params.dig(:search, :criteria) end end end end
Version data entries
52 entries across 52 versions & 1 rubygems