Skip to content
Snippets Groups Projects
Unverified Commit 47584180 authored by Eugen Rochko's avatar Eugen Rochko Committed by GitHub
Browse files

Fix wrong percentages in admin UI for hashtag usage breakdown (#11714)

parent d3442894
Branches
Tags
No related merge requests found
......@@ -37,7 +37,8 @@ module Admin
def set_usage_by_domain
@usage_by_domain = @tag.statuses
.where(visibility: :public)
.with_public_visibility
.excluding_silenced_accounts
.where(Status.arel_table[:id].gteq(Mastodon::Snowflake.id_at(Time.now.utc.beginning_of_day)))
.joins(:account)
.group('accounts.domain')
......
......@@ -38,8 +38,10 @@
.table-wrapper
%table.table
%tbody
- total = @usage_by_domain.sum(&:statuses_count).to_f
- @usage_by_domain.each do |(domain, count)|
%tr
%th= domain || site_hostname
%td= number_to_percentage((count / @tag.history[0][:uses].to_f) * 100)
%td= number_to_percentage((count / total) * 100, precision: 1)
%td= number_with_delimiter count
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment