<commit_before>module Relationable
  extend ActiveSupport::Concern

  included do
    has_many :related_contents, as: :parent_relationable, dependent: :destroy
  end

  def relate_content(relationable)
    RelatedContent.find_or_create_by(parent_relationable: self, child_relationable: relationable)
  end

  def relationed_contents
    related_contents.not_hidden.map { |related_content| related_content.child_relationable }
  end

  def report_related_content(relationable)
    related_content = related_contents.find_by(child_relationable: relationable)
    if related_content.present?
      related_content.increment!(:times_reported)
      related_content.opposite_related_content.increment!(:times_reported)
    end
  end
end<commit_msg>renames times_reported to flags_count on relationable.rb<commit_after>module Relationable
  extend ActiveSupport::Concern

  included do
    has_many :related_contents, as: :parent_relationable, dependent: :destroy
  end

  def relate_content(relationable)
    RelatedContent.find_or_create_by(parent_relationable: self, child_relationable: relationable)
  end

  def relationed_contents
    related_contents.not_hidden.map { |related_content| related_content.child_relationable }
  end

  def report_related_content(relationable)
    related_content = related_contents.find_by(child_relationable: relationable)
    if related_content.present?
      related_content.increment!(:flags_count)
      related_content.opposite_related_content.increment!(:flags_count)
    end
  end
end
{'fraction_non_alphanumeric': 0.0623768877216021, 'fraction_numerical': 0.0, 'mean_word_length': 5.895927601809955, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1539276', 'n_tokens_mistral': 451, 'n_tokens_neox': 437, 'n_words': 80}