Sha256: 04a10b66483e496137837a190724fcdb469751309306b9864111294463ca0553

Contents?: true

Size: 805 Bytes

Versions: 87

Compression:

Stored size: 805 Bytes

Contents

# frozen_string_literal: true

module Renalware
  module HD
    module SessionScopes
      def with_sessions_falling_within(period)
        falling_within(period)
      end

      # TODO: Refactor to two methods/scopes or'ed together e.g. finished_closed.or.finished_dna
      def falling_within(range)
        where(hd_sessions: {
                type: Session::Closed.sti_name,
                signed_off_at: range
              }).or(
                where(hd_sessions: {
                        type: Session::DNA.sti_name,
                        performed_on: range
                      }))
      end

      def with_finished_sessions
        finished
      end

      def finished
        where(hd_sessions: { type: [Session::Closed.sti_name, Session::DNA.sti_name] })
      end
    end
  end
end

Version data entries

87 entries across 87 versions & 1 rubygems

Version Path
renalware-core-2.1.1 app/models/concerns/renalware/hd/session_scopes.rb
renalware-core-2.1.0 app/models/concerns/renalware/hd/session_scopes.rb
renalware-core-2.0.167 app/models/concerns/renalware/hd/session_scopes.rb
renalware-core-2.0.166 app/models/concerns/renalware/hd/session_scopes.rb
renalware-core-2.0.165 app/models/concerns/renalware/hd/session_scopes.rb
renalware-core-2.0.164 app/models/concerns/renalware/hd/session_scopes.rb
renalware-core-2.0.163 app/models/concerns/renalware/hd/session_scopes.rb
renalware-core-2.0.162 app/models/concerns/renalware/hd/session_scopes.rb
renalware-core-2.0.161 app/models/concerns/renalware/hd/session_scopes.rb
renalware-core-2.0.160 app/models/concerns/renalware/hd/session_scopes.rb
renalware-core-2.0.159 app/models/concerns/renalware/hd/session_scopes.rb
renalware-core-2.0.158 app/models/concerns/renalware/hd/session_scopes.rb
renalware-core-2.0.157 app/models/concerns/renalware/hd/session_scopes.rb
renalware-core-2.0.156 app/models/concerns/renalware/hd/session_scopes.rb
renalware-core-2.0.155 app/models/concerns/renalware/hd/session_scopes.rb
renalware-core-2.0.153 app/models/concerns/renalware/hd/session_scopes.rb
renalware-core-2.0.152 app/models/concerns/renalware/hd/session_scopes.rb
renalware-core-2.0.151 app/models/concerns/renalware/hd/session_scopes.rb
renalware-core-2.0.149 app/models/concerns/renalware/hd/session_scopes.rb
renalware-core-2.0.148 app/models/concerns/renalware/hd/session_scopes.rb