Skip to content

Commit

Permalink
Singularization fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
carloslima authored and antirez committed Oct 11, 2012
1 parent e6d5f3b commit d14dacb
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions app.rb
Expand Up @@ -508,7 +508,7 @@ def render_comment_subthread(comment,sep="")
H.ul { H.ul {
H.li { H.li {
H.b {"created "}+ H.b {"created "}+
"#{(Time.now.to_i-user['ctime'].to_i)/(3600*24)} days ago" str_elapsed(user['ctime'].to_i)
}+ }+
H.li {H.b {"karma "}+ "#{user['karma']} points"}+ H.li {H.b {"karma "}+ "#{user['karma']} points"}+
H.li {H.b {"posted news "}+posted_news.to_s}+ H.li {H.b {"posted news "}+posted_news.to_s}+
Expand Down Expand Up @@ -1927,10 +1927,14 @@ def generate_site_stats
def str_elapsed(t) def str_elapsed(t)
seconds = Time.now.to_i - t seconds = Time.now.to_i - t
return "now" if seconds <= 1 return "now" if seconds <= 1
return "#{seconds} seconds ago" if seconds < 60
return "#{seconds/60} minutes ago" if seconds < 60*60 length,label = time_lengths.select{|length,label| seconds >= length }.first
return "#{seconds/60/60} hours ago" if seconds < 60*60*24 units = seconds/length
return "#{seconds/60/60/24} days ago" "#{units} #{label}#{'s' if units > 1} ago"
end

def time_lengths
[[86400, "day"], [3600, "hour"], [60, "minute"], [1, "second"]]
end end


# Generic API limiting function # Generic API limiting function
Expand Down

0 comments on commit d14dacb

Please sign in to comment.