<commit_before># frozen_string_literal: true

class Pawoo::Sitemap::StatusIndexesController < Pawoo::Sitemap::ApplicationController
  ALLOW_REBLOGS_COUNT = 5

  def index
    @count = page_count(StreamEntry)
  end

  def show
    @status_pages = page_details
  end

  private

  def page_details
    read_from_slave do
      StreamEntry.joins(:status).joins(status: :account)
                 .select('statuses.id')
                 .select('statuses.updated_at')
                 .select('accounts.username')
                 .select('statuses.reblogs_count')
                 .where('stream_entries.activity_type = \'Status\'')
                 .where('stream_entries.id > ?', min_id)
                 .where('stream_entries.id <= ?', max_id)
                 .where('statuses.reblogs_count >= ?', ALLOW_REBLOGS_COUNT)
                 .where('statuses.local = TRUE')
                 .load
    end
  end
end<commit_msg>Fix scope of status for sitemap<commit_after># frozen_string_literal: true

class Pawoo::Sitemap::StatusIndexesController < Pawoo::Sitemap::ApplicationController
  ALLOW_REBLOGS_COUNT = 5

  def index
    @count = page_count(StreamEntry)
  end

  def show
    @status_pages = page_details
  end

  private

  def page_details
    read_from_slave do
      StreamEntry.joins(:status).joins(status: :account)
                 .select('statuses.id')
                 .select('statuses.updated_at')
                 .select('accounts.username')
                 .select('statuses.reblogs_count')
                 .where('stream_entries.id > ?', min_id)
                 .where('stream_entries.id <= ?', max_id)
                 .where('statuses.reblogs_count >= ?', ALLOW_REBLOGS_COUNT)
                 .merge(status_scope)
                 .load
    end
  end

  def status_scope
    Status.local.where(visibility: [:public, :unlisted]).without_reblogs.published.reorder(nil)
  end
end
{'fraction_non_alphanumeric': 0.10714285714285714, 'fraction_numerical': 0.0010504201680672268, 'mean_word_length': 2.290155440414508, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3224745', 'n_tokens_mistral': 587, 'n_tokens_neox': 568, 'n_words': 93}