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 # Calculate how many days ago this screenshot has been uploaded
def age_days def age
if self.created_at time_ago_in_words(self.created_at)
seconds = Time.now - self.created_at
else
seconds = 0
end
days = (seconds/86400).to_i
days ? "#{days} days ago" : 'today'
end end
# Return caption for full-screen screenshots. # Return caption for full-screen screenshots.

View file

@ -33,7 +33,7 @@
p Status: #{screenshot.adminstatus} p Status: #{screenshot.adminstatus}
p Uploader IP=#{screenshot.uploaderip} p Uploader IP=#{screenshot.uploaderip}
p Uploader Token=#{session[:token]} 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 / TODO: Move reporting screenshots to an extra page with a form and captcha
/ - else / - else