summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2014-02-27 18:26:23 -0700
committermo khan <mo@mokhan.ca>2014-02-27 18:26:23 -0700
commit584662a3bb911d8611299fc2d7fb560ecab682b0 (patch)
tree2b8eea77d8caa765c79ecb2e6524b93c33b265a4
parent7c133de868e76c47cbf12f09dc6f51f618b46f0a (diff)
fix bug related to expiration time boundaries. apparently time is a moving target.
-rw-r--r--app/models/license_status/active.rb8
-rw-r--r--app/models/license_status/expired.rb5
2 files changed, 6 insertions, 7 deletions
diff --git a/app/models/license_status/active.rb b/app/models/license_status/active.rb
index f959efb..512fff9 100644
--- a/app/models/license_status/active.rb
+++ b/app/models/license_status/active.rb
@@ -1,7 +1,7 @@
class LicenseStatus::Active
def filter(licenses)
- today = Date.today
- licenses.where('issued_at < ? AND expired_at > ?', today, today)
+ now = DateTime.now
+ licenses.where('issued_at < ? AND expired_at > ?', now, now)
end
def matches?(name)
@@ -9,8 +9,8 @@ class LicenseStatus::Active
end
def best_represents?(license)
- today = Date.today
- license.issued_at < today && license.expired_at > today
+ now = DateTime.now
+ license.issued_at < now && license.expired_at > now
end
def to_s
diff --git a/app/models/license_status/expired.rb b/app/models/license_status/expired.rb
index 8e24af9..9bbdf4b 100644
--- a/app/models/license_status/expired.rb
+++ b/app/models/license_status/expired.rb
@@ -1,7 +1,6 @@
class LicenseStatus::Expired
def filter(licenses)
- today = DateTime.now
- licenses.where('expired_at < ?', today)
+ licenses.where('expired_at < ?', DateTime.now)
end
def matches?(name)
@@ -9,7 +8,7 @@ class LicenseStatus::Expired
end
def best_represents?(license)
- license.expired_at < Date.today
+ license.expired_at < DateTime.now
end
def to_s