Module: Renalware::HD::SessionScopes
- Defined in:
- app/models/concerns/renalware/hd/session_scopes.rb
Instance Method Summary collapse
-
#falling_within(range) ⇒ Object
TODO: Refactor to two methods/scopes or’ed together e.g.
- #finished ⇒ Object
- #with_finished_sessions ⇒ Object
- #with_sessions_falling_within(period) ⇒ Object
Instance Method Details
#falling_within(range) ⇒ Object
TODO: Refactor to two methods/scopes or’ed together e.g. finished_closed.or.finished_dna
11 12 13 14 15 16 17 18 19 20 |
# File 'app/models/concerns/renalware/hd/session_scopes.rb', line 11 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 |
#finished ⇒ Object
26 27 28 |
# File 'app/models/concerns/renalware/hd/session_scopes.rb', line 26 def finished where(hd_sessions: { type: [Session::Closed.sti_name, Session::DNA.sti_name] }) end |
#with_finished_sessions ⇒ Object
22 23 24 |
# File 'app/models/concerns/renalware/hd/session_scopes.rb', line 22 def with_finished_sessions finished end |
#with_sessions_falling_within(period) ⇒ Object
6 7 8 |
# File 'app/models/concerns/renalware/hd/session_scopes.rb', line 6 def with_sessions_falling_within(period) falling_within(period) end |