Simplification

This commit is contained in:
Christoph Haas 2021-02-21 11:12:26 +01:00
parent b6e4bd8a99
commit f68482f850
2 changed files with 3 additions and 9 deletions

View file

@ -18,14 +18,8 @@ class Screenshot < ApplicationRecord
# Calculate how many days ago this screenshot has been uploaded
def age_days
if self.created_at
seconds = Time.now - self.created_at
else
seconds = 0
end
days = (seconds/86400).to_i
days ? "#{days} days ago" : 'today'
def age
time_ago_in_words(self.created_at)
end
# Return caption for full-screen screenshots.

View file

@ -33,7 +33,7 @@
p Status: #{screenshot.adminstatus}
p Uploader IP=#{screenshot.uploaderip}
p Uploader Token=#{session[:token]}
p Uploaded #{screenshot.age_days} (#{screenshot.created_at})
p Uploaded #{screenshot.age} ago (#{screenshot.created_at})
/ TODO: Move reporting screenshots to an extra page with a form and captcha
/ - else