<commit_before>class StatisticsAnnouncement < ActiveRecord::Base
  extend FriendlyId
  friendly_id :title

  belongs_to :creator, class_name: 'User'
  belongs_to :cancelled_by, class_name: 'User'
  belongs_to :organisation
  belongs_to :topic
  belongs_to :publication

  has_one  :current_release_date, class_name: 'StatisticsAnnouncementDate', order: 'created_at DESC', inverse_of: :statistics_announcement
  has_many :statistics_announcement_dates

  validate  :publication_is_matching_type, if: :publication
  validates :title, :summary, :organisation, :topic, :creator, :current_release_date, presence: true
  validates :cancellation_reason, presence: {  message: "must be provided when cancelling an announcement" }, if: :cancelled?
  validates :publication_type_id,
              inclusion: {
                in: PublicationType.statistical.map(&:id),
                message: 'must be a statistical type'
              }<commit_msg>Add announcements -> dates association dependency<commit_after>class StatisticsAnnouncement < ActiveRecord::Base
  extend FriendlyId
  friendly_id :title

  belongs_to :creator, class_name: 'User'
  belongs_to :cancelled_by, class_name: 'User'
  belongs_to :organisation
  belongs_to :topic
  belongs_to :publication

  has_one  :current_release_date, class_name: 'StatisticsAnnouncementDate', order: 'created_at DESC', inverse_of: :statistics_announcement
  has_many :statistics_announcement_dates, dependent: :destroy

  validate  :publication_is_matching_type, if: :publication
  validates :title, :summary, :organisation, :topic, :creator, :current_release_date, presence: true
  validates :cancellation_reason, presence: {  message: "must be provided when cancelling an announcement" }, if: :cancelled?
  validates :publication_type_id,
              inclusion: {
                in: PublicationType.statistical.map(&:id),
                message: 'must be a statistical type'
              }
{'fraction_non_alphanumeric': 0.08311822405782138, 'fraction_numerical': 0.0, 'mean_word_length': 4.650145772594752, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 4, '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': '7374936', 'n_tokens_mistral': 586, 'n_tokens_neox': 579, 'n_words': 144}