<commit_before>class Promo < Noodall::Component
  key :title, String
  key :link, String
  key :description, String
  key :target, String

  key :asset_id, ObjectId

  belongs_to :asset
  before_save :log_asset_use

  allowed_positions :main, :small, :wide

private

  def log_asset_use
    unless asset.nil?
      location = self.instance_of?(Content) ? self._parent_document.class.name : self.class.name
      asset.log_usage(_root_document.id, location)
    end
  end

end
<commit_msg>Fix asset logging for demo promo<commit_after>class Promo < Noodall::Component
  key :title, String
  key :link, String
  key :description, String
  key :target, String

  key :asset_id, ObjectId

  belongs_to :asset
  before_save :log_asset_use

  allowed_positions :main, :small, :wide

private

  def log_asset_use
    unless asset.nil?
      asset.log_usage(_root_document.id, self.class.name)
    end
  end

end

{'fraction_non_alphanumeric': 0.08176795580110498, 'fraction_numerical': 0.0, 'mean_word_length': 3.8449197860962565, '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': '4782545', 'n_tokens_mistral': 309, 'n_tokens_neox': 301, 'n_words': 81}