diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/lib/admin/metrics/measure/tag_servers_measure.rb | 11 | ||||
-rw-r--r-- | app/mailers/admin_mailer.rb | 4 |
2 files changed, 9 insertions, 6 deletions
diff --git a/app/lib/admin/metrics/measure/tag_servers_measure.rb b/app/lib/admin/metrics/measure/tag_servers_measure.rb index 8c3e0551a..cc064f63f 100644 --- a/app/lib/admin/metrics/measure/tag_servers_measure.rb +++ b/app/lib/admin/metrics/measure/tag_servers_measure.rb @@ -20,17 +20,20 @@ class Admin::Metrics::Measure::TagServersMeasure < Admin::Metrics::Measure::Base def data sql = <<-SQL.squish SELECT axis.*, ( - SELECT count(*) AS value + SELECT count(distinct accounts.domain) AS value FROM statuses - WHERE statuses.id BETWEEN $1 AND $2 + INNER JOIN statuses_tags ON statuses.id = statuses_tags.status_id + INNER JOIN accounts ON statuses.account_id = accounts.id + WHERE statuses_tags.tag_id = $1 + AND statuses.id BETWEEN $2 AND $3 AND date_trunc('day', statuses.created_at)::date = axis.day ) FROM ( - SELECT generate_series(date_trunc('day', $3::timestamp)::date, date_trunc('day', $4::timestamp)::date, ('1 day')::interval) AS day + SELECT generate_series(date_trunc('day', $4::timestamp)::date, date_trunc('day', $5::timestamp)::date, ('1 day')::interval) AS day ) as axis SQL - rows = ActiveRecord::Base.connection.select_all(sql, nil, [[nil, Mastodon::Snowflake.id_at(@start_at, with_random: false)], [nil, Mastodon::Snowflake.id_at(@end_at, with_random: false)], [nil, @start_at], [nil, @end_at]]) + rows = ActiveRecord::Base.connection.select_all(sql, nil, [[nil, params[:id].to_i], [nil, Mastodon::Snowflake.id_at(@start_at, with_random: false)], [nil, Mastodon::Snowflake.id_at(@end_at, with_random: false)], [nil, @start_at], [nil, @end_at]]) rows.map { |row| { date: row['day'], value: row['value'].to_s } } end diff --git a/app/mailers/admin_mailer.rb b/app/mailers/admin_mailer.rb index 0fbd9932d..b23bd1296 100644 --- a/app/mailers/admin_mailer.rb +++ b/app/mailers/admin_mailer.rb @@ -29,7 +29,7 @@ class AdminMailer < ApplicationMailer @tags = tags @me = recipient @instance = Rails.configuration.x.local_domain - @lowest_trending_tag = Trends.tags.get(true, Trends::Tags::REVIEW_THRESHOLD).last + @lowest_trending_tag = Trends.tags.get(true, Trends.tags.options[:review_threshold]).last locale_for_account(@me) do mail to: @me.user_email, subject: I18n.t('admin_mailer.new_trending_tags.subject', instance: @instance) @@ -40,7 +40,7 @@ class AdminMailer < ApplicationMailer @links = links @me = recipient @instance = Rails.configuration.x.local_domain - @lowest_trending_link = Trends.links.get(true, Trends::Links::REVIEW_THRESHOLD).last + @lowest_trending_link = Trends.links.get(true, Trends.links.options[:review_threshold]).last locale_for_account(@me) do mail to: @me.user_email, subject: I18n.t('admin_mailer.new_trending_links.subject', instance: @instance) |