Sha256: b00bb636aefac7bd11f1492a709d4f068c4f11e17881f1c43e42e3ee1680112b

Contents?: true

Size: 781 Bytes

Versions: 62

Compression:

Stored size: 781 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

62 entries across 62 versions & 1 rubygems

Version Path
renalware-core-2.0.77 app/models/concerns/renalware/hd/session_scopes.rb
renalware-core-2.0.76 app/models/concerns/renalware/hd/session_scopes.rb
renalware-core-2.0.75 app/models/concerns/renalware/hd/session_scopes.rb
renalware-core-2.0.74 app/models/concerns/renalware/hd/session_scopes.rb
renalware-core-2.0.73 app/models/concerns/renalware/hd/session_scopes.rb
renalware-core-2.0.72 app/models/concerns/renalware/hd/session_scopes.rb
renalware-core-2.0.71 app/models/concerns/renalware/hd/session_scopes.rb
renalware-core-2.0.70 app/models/concerns/renalware/hd/session_scopes.rb
renalware-core-2.0.69 app/models/concerns/renalware/hd/session_scopes.rb
renalware-core-2.0.68 app/models/concerns/renalware/hd/session_scopes.rb
renalware-core-2.0.67 app/models/concerns/renalware/hd/session_scopes.rb
renalware-core-2.0.64 app/models/concerns/renalware/hd/session_scopes.rb
renalware-core-2.0.63 app/models/concerns/renalware/hd/session_scopes.rb
renalware-core-2.0.62 app/models/concerns/renalware/hd/session_scopes.rb
renalware-core-2.0.61 app/models/concerns/renalware/hd/session_scopes.rb
renalware-core-2.0.60 app/models/concerns/renalware/hd/session_scopes.rb
renalware-core-2.0.58 app/models/concerns/renalware/hd/session_scopes.rb
renalware-core-2.0.57 app/models/concerns/renalware/hd/session_scopes.rb
renalware-core-2.0.56 app/models/concerns/renalware/hd/session_scopes.rb
renalware-core-2.0.55 app/models/concerns/renalware/hd/session_scopes.rb