summaryrefslogtreecommitdiff
path: root/app/models/license_status/active.rb
blob: 512fff967391d56f7d81648c7d689173e69a4500 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
class LicenseStatus::Active
  def filter(licenses)
    now = DateTime.now
    licenses.where('issued_at < ? AND expired_at > ?', now, now)
  end

  def matches?(name)
    to_s == name
  end

  def best_represents?(license)
    now = DateTime.now
    license.issued_at < now && license.expired_at > now
  end

  def to_s
    'active'
  end
end