Class: Booth::Models::Remotes::Scopes::RecentlyResponded

Inherits:
Object
  • Object
show all
Includes:
Calls
Defined in:
lib/booth/models/remotes/scopes/recently_responded.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.scope(base) ⇒ Object



12
13
14
15
16
17
# File 'lib/booth/models/remotes/scopes/recently_responded.rb', line 12

def self.scope(base)
  base.where.not(created_at: nil)
      .where.not(responded_at: nil)
      .where('created_at > ?', lifespan.ago)
      .where('responded_at > ?', lifespan.ago)
end

Instance Method Details

#callObject



19
20
21
22
23
24
# File 'lib/booth/models/remotes/scopes/recently_responded.rb', line 19

def call
  remote.created_at.present? &&
    remote.responded_at.present? &&
    remote.created_at > lifespan.ago &&
    remote.responded_at > lifespan.ago
end