show precision in tag list for posts btw 1k and 10k count

This commit is contained in:
r888888888
2014-02-11 16:32:29 -08:00
parent 06b92f9546
commit 5893296a68

View File

@@ -115,8 +115,10 @@ private
html << %{<a class="search-tag" href="#{path}?tags=#{u(tag)}">#{h(humanized_tag)}</a> }
unless options[:name_only]
if counts[tag].to_i >= 1_000
if counts[tag].to_i >= 10_000
post_count = "#{counts[tag].to_i / 1_000}k"
elsif counts[tag].to_i >= 1_000
post_count = "%.1fk" % (counts[tag].to_f / 1_000)
else
post_count = counts[tag].to_s
end