<commit_before>class Question < ApplicationRecord
  include Question::AnswerMethods

  belongs_to :user, optional: true
  has_many :answers, dependent: :destroy
  has_many :inboxes, dependent: :destroy

  validates :content, length: { minimum: 1, maximum: 512 }

  before_destroy do
    rep = Report.where(target_id: self.id, type: 'Reports::Question')
    rep.each do |r|
      unless r.nil?
        r.deleted = true
        r.save
      end
    end

    # rubocop:disable Rails/SkipsModelValidations
    user&.decrement! :asked_count unless author_is_anonymous
    # rubocop:enable Rails/SkipsModelValidations<commit_msg>Do not decrement the question count if the question is direct<commit_after>class Question < ApplicationRecord
  include Question::AnswerMethods

  belongs_to :user, optional: true
  has_many :answers, dependent: :destroy
  has_many :inboxes, dependent: :destroy

  validates :content, length: { minimum: 1, maximum: 512 }

  before_destroy do
    rep = Report.where(target_id: self.id, type: 'Reports::Question')
    rep.each do |r|
      unless r.nil?
        r.deleted = true
        r.save
      end
    end

    # rubocop:disable Rails/SkipsModelValidations
    user&.decrement! :asked_count unless author_is_anonymous || direct
    # rubocop:enable Rails/SkipsModelValidations
{'fraction_non_alphanumeric': 0.08588957055214724, 'fraction_numerical': 0.006134969325153374, 'mean_word_length': 3.711191335740072, 'pattern_counts': {'":': 0, '<': 5, '<?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': '7423269', 'n_tokens_mistral': 416, 'n_tokens_neox': 395, 'n_words': 108}