<commit_before>class BatchTransaction < ActiveRecord::Base
  # t.integer :organization_id
  # t.string :parent_type
  # t.integer :parent_id
  # t.integer :batch_id
  # t.integer, :warehouse_id
  # t.integer :quantity

  belongs_to :organization
  belongs_to :batch
  belongs_to :warehouse
  belongs_to :parent, polymorphic: true

  attr_accessible :warehouse, :warehouse_id, :batch, :batch_id, :parent_id, :parent, :quantity, :organization_id

  validates :warehouse, presence: true
  validates :batch, presence: true
  validates :quantity, presence: true

  after_save :enqueue_event

  # Callback: after_save
  def enqueue_event
    Resque.enqueue(Job::BatchTransactionEvent, id)
  end
end<commit_msg>fixes race condition in batch_transaction/shelf recalc job<commit_after>class BatchTransaction < ActiveRecord::Base
  # t.integer :organization_id
  # t.string :parent_type
  # t.integer :parent_id
  # t.integer :batch_id
  # t.integer, :warehouse_id
  # t.integer :quantity

  belongs_to :organization
  belongs_to :batch
  belongs_to :warehouse
  belongs_to :parent, polymorphic: true

  attr_accessible :warehouse, :warehouse_id, :batch, :batch_id, :parent_id, :parent, :quantity, :organization_id

  validates :warehouse, presence: true
  validates :batch, presence: true
  validates :quantity, presence: true

  after_commit :enqueue_event

  # Callback: after_commit
  def enqueue_event
    Resque.enqueue(Job::BatchTransactionEvent, id)
  end
end
{'fraction_non_alphanumeric': 0.08853809196980096, 'fraction_numerical': 0.0, 'mean_word_length': 5.126050420168068, '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': '339164', 'n_tokens_mistral': 498, 'n_tokens_neox': 473, 'n_words': 117}