<commit_before>class MixpanelObserver < ActiveRecord::Observer
  observe :contribution

  def from_waiting_confirmation_to_confirmed(contribution)
    tracker.track(contribution.user.id.to_s, "Contribution confirmed")
  end
  alias :from_pending_to_confirmed :from_waiting_confirmation_to_confirmed

  def from_pending_to_waiting_confirmation(contribution)
    user = contribution.user

    tracker.track(user.id.to_s, "Finished contribution", {
      user_id: user.id.to_s,
      created: user.created_at,
      last_login: user.last_sign_in_at,
      contributions: user.total_contributed_projects,
      has_contributions: (user.total_contributed_projects > 0),
      project: contribution.project.name,
      payment_method: contribution.payment_method,
      payment_choice: contribution.payment_choice
    });
  end

  private
  def tracker
    @tracker ||= Mixpanel::Tracker.new(CatarseSettings[:mixpanel_token])
  end
end

<commit_msg>fix typo error<commit_after>class MixpanelObserver < ActiveRecord::Observer
  observe :contribution

  def from_waiting_confirmation_to_confirmed(contribution)
    tracker.track(contribution.user.id.to_s, "Contribution confirmed")
  end
  alias :from_pending_to_confirmed :from_waiting_confirmation_to_confirmed

  def from_pending_to_waiting_confirmation(contribution)
    user = contribution.user

    tracker.track(user.id.to_s, "Finished contribution", {
      user_id: user.id.to_s,
      created: user.created_at,
      last_login: user.last_sign_in_at,
      contributions: user.total_contributed_projects,
      has_contributions: (user.total_contributed_projects > 0),
      project: contribution.project.name,
      payment_method: contribution.payment_method,
      payment_choice: contribution.payment_choice
    })
  end

  private
  def tracker
    @tracker ||= Mixpanel::Tracker.new(CatarseSettings[:mixpanel_token])
  end
end


{'fraction_non_alphanumeric': 0.08006362672322376, 'fraction_numerical': 0.0010604453870625664, 'mean_word_length': 4.770642201834862, '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': '3726461', 'n_tokens_mistral': 606, 'n_tokens_neox': 574, 'n_words': 94}