Sha256: 3a37f531c92d15220d64d9541838ad366bc702a0fd6be47d97011b5232d158e7
Contents?: true
Size: 595 Bytes
Versions: 65
Compression:
Stored size: 595 Bytes
Contents
# frozen_string_literal: true require "attr_extras" module Renalware module PD class RegimesInDateRangeQuery pattr_initialize [:patient!, :from!, :to!] def call scope = Renalware::PD::Regime.order(start_date: :asc, end_date: :desc) scope .where(conditions.merge(end_date: from..to)) .or( scope.where(conditions.merge(end_date: nil)) ) end private def conditions { patient_id: patient.id, start_date: from..DateTime::Infinity.new } end end end end
Version data entries
65 entries across 65 versions & 1 rubygems