Class: Audits1984::FilteredSessions
- Inherits:
-
Object
- Object
- Audits1984::FilteredSessions
- Includes:
- ActiveModel::Attributes, ActiveModel::Model
- Defined in:
- app/models/audits1984/filtered_sessions.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.resume(attributes) ⇒ Object
10 11 12 |
# File 'app/models/audits1984/filtered_sessions.rb', line 10 def self.resume(attributes) new attributes&.with_indifferent_access&.slice(*attribute_names) end |
Instance Method Details
#all ⇒ Object
18 19 20 21 22 23 24 |
# File 'app/models/audits1984/filtered_sessions.rb', line 18 def all sessions = Console1984::Session.order(created_at: :desc, id: :desc) sessions = sessions.sensitive if sensitive_only sessions = sessions.where("console1984_sessions.created_at >= ?", from_date.beginning_of_day) if from_date.present? sessions = sessions.where("console1984_sessions.created_at <= ?", to_date.end_of_day) if to_date.present? sessions end |
#pending_session_after(session) ⇒ Object
26 27 28 |
# File 'app/models/audits1984/filtered_sessions.rb', line 26 def pending_session_after(session) all.pending.where("console1984_sessions.created_at < ? OR console1984_sessions.id < ?", session.created_at, session.id).first end |
#to_h ⇒ Object
14 15 16 |
# File 'app/models/audits1984/filtered_sessions.rb', line 14 def to_h attributes.compact.transform_values(&:to_s) end |