<commit_before>class VersionsController < ApplicationController
  def revert_action
    @version = PaperTrail::Version.find(params[:id])
    @version.reify.save!
    
    a = Action.find(@version.item_id)
    r = Receipt.find(a.receipt_id)
    case a.action_type.name 
    when "First Contact"
      r.made_contact = true
    when "Presentation"
      r.made_presentation = true
    when "New Sale", "Old Sale"
      r.made_sale = true
    end    
      r.save!
    
    version_cleanup(r.user_id, "Action")
    
    # Find action by id and retrieve action_type.name
    # Find Receipt id from action.receipt id and set contact, presentation, or sale based on action_type.name
    redirect_to :back, :notice => "Undo Successful"<commit_msg>cleanup now occurs on whoever did the action<commit_after>class VersionsController < ApplicationController
  def revert_action
    @version = PaperTrail::Version.find(params[:id])
    @version.reify.save!
    
    a = Action.find(@version.item_id)
    r = Receipt.find(a.receipt_id)
    case a.action_type.name 
    when "First Contact"
      r.made_contact = true
    when "Presentation"
      r.made_presentation = true
    when "New Sale", "Old Sale"
      r.made_sale = true
    end    
      r.save!
    
    version_cleanup(@version.whodunnit, "Action")
    
    # Find action by id and retrieve action_type.name
    # Find Receipt id from action.receipt id and set contact, presentation, or sale based on action_type.name
    redirect_to :back, :notice => "Undo Successful"
{'fraction_non_alphanumeric': 0.09013157894736842, 'fraction_numerical': 0.0, 'mean_word_length': 3.0238095238095237, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '4724151', 'n_tokens_mistral': 485, 'n_tokens_neox': 468, 'n_words': 128}