<commit_before>#------------------------------------------------------------------------------
#
# AssetDispositionUpdateJob 
# (overrides the job in transam_core in order to remove the asset from ALIs before the disposition)
#
# Records that an asset has been disposed.
#
#------------------------------------------------------------------------------
class AssetDispositionUpdateJob < AbstractAssetUpdateJob
  
  
  def execute_job(asset)  
    # remove the asset from ALIs if going to dispose it
    asset = Asset.get_typed_asset(asset)
    if asset.respond_to?(:activity_line_items) && !asset.disposition_updates.empty?   
      asset.activity_line_items.each do |ali|
        ali.assets.destroy(asset) # trigger ALI after_update_callback
      end
    end

    asset.record_disposition
  end

  def prepare
    Rails.logger.debug "Executing AssetDispositionUpdateJob at #{Time.now.to_s} for Asset #{object_key}"    
  end
  <commit_msg>[#116538279] Updating theasset disposition job to grab the organizaito_id if there is one when an asset is transferred.<commit_after>#------------------------------------------------------------------------------
#
# AssetDispositionUpdateJob 
# (overrides the job in transam_core in order to remove the asset from ALIs before the disposition)
#
# Records that an asset has been disposed.
#
#------------------------------------------------------------------------------
class AssetDispositionUpdateJob < AbstractAssetUpdateJob
  
  
  def execute_job(asset)  
    # remove the asset from ALIs if going to dispose it
    asset = Asset.get_typed_asset(asset)
    if asset.respond_to?(:activity_line_items) && !asset.disposition_updates.empty?   
      asset.activity_line_items.each do |ali|
        ali.assets.destroy(asset) # trigger ALI after_update_callback
      end
    end

    asset_event_type = AssetEventType.where(:class_name => 'DispositionUpdateEvent').first
    asset_event = AssetEvent.where(:asset_id => asset.id, :asset_event_type_id => asset_event_type.id).last
    asset.transfer asset_event.organization_id

    asset.record_disposition
  end

  def prepare
    Rails.logger.debug "Executing AssetDispositionUpdateJob at #{Time.now.to_s} for Asset #{object_key}"    
  end
  
{'fraction_non_alphanumeric': 0.20223713646532437, 'fraction_numerical': 0.004026845637583893, 'mean_word_length': 2.2080344332855093, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, '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': '1069823', 'n_tokens_mistral': 614, 'n_tokens_neox': 584, 'n_words': 161}