21
1
Fork 0
mirror of https://github.com/Evolix/chexpire.git synced 2024-04-25 21:40:49 +02:00

return the number of whole days

This commit is contained in:
Jérémy Lecour 2019-08-20 00:46:52 +02:00
parent 8534a5d351
commit 54e57f20ae

View file

@ -82,7 +82,8 @@ class Check < ApplicationRecord
def days_from_last_success
return unless last_success_at.present?
(Date.today - last_success_at.to_date).to_i
# return the number of whole days
((Time.now - last_success_at) / (24 * 3600)).to_i
end
def increment_consecutive_failures!