<commit_before>class PageTrackingObserver < ActiveRecord::Observer
  observe :page, :user_participation, :group_participation, :post, :wiki

  def after_save(model)
    if model.is_a? UserParticipation
      up = model
      PageHistory::StartWatching.create!(:user => User.current, :page => up.page)                             if up.start_watching?
      PageHistory::StopWatching.create!(:user => User.current, :page => up.page)                              if up.stop_watching?
      PageHistory::AddStar.create!(:user => User.current, :page => up.page)                                   if up.star_added?
      PageHistory::RemoveStar.create!(:user => User.current, :page => up.page)                                if up.star_removed?
      PageHistory::GrantUserFullAccess.create!(:user => User.current, :page => up.page, :object => up.user)   if up.granted_user_full_access?
      PageHistory::GrantUserWriteAccess.create!(:user => User.current, :page => up.page, :object => up.user)  if up.granted_user_write_access?
      PageHistory::GrantUserReadAccess.create!(:user => User.current, :page => up.page, :object => up.user)   if up.granted_user_read_access?
    end

    if model.is_a? GroupParticipation
      gp = model
      PageHistory::GrantGroupFullAccess.create!(:user => User.current, :page => gp.page, :object => gp.group)  if gp.granted_group_full_access?
      PageHistory::GrantGroupWriteAccess.create!(:user => User.current, :page => gp.page, :object => gp.group) if gp.granted_group_write_access?
      PageHistory::GrantGroupReadAccess.create!(:user => User.current, :page => gp.page, :object => gp.group)  if gp.granted_group_read_access?
    end<commit_msg>small change on page_tracking observer<commit_after>class PageTrackingObserver < ActiveRecord::Observer
  observe :page, :user_participation, :group_participation, :post, :wiki

  def after_save(model)
    if model.is_a? UserParticipation
      up = model
      PageHistory::GrantUserFullAccess.create!(:user => User.current, :page => up.page, :object => up.user)   if up.granted_user_full_access?
      PageHistory::GrantUserWriteAccess.create!(:user => User.current, :page => up.page, :object => up.user)  if up.granted_user_write_access?
      PageHistory::GrantUserReadAccess.create!(:user => User.current, :page => up.page, :object => up.user)   if up.granted_user_read_access?
      PageHistory::StartWatching.create!(:user => User.current, :page => up.page)                             if up.start_watching?
      PageHistory::StopWatching.create!(:user => User.current, :page => up.page)                              if up.stop_watching?
      PageHistory::AddStar.create!(:user => User.current, :page => up.page)                                   if up.star_added?
      PageHistory::RemoveStar.create!(:user => User.current, :page => up.page)                                if up.star_removed?
    end

    if model.is_a? GroupParticipation
      gp = model
      PageHistory::GrantGroupFullAccess.create!(:user => User.current, :page => gp.page, :object => gp.group)  if gp.granted_group_full_access?
      PageHistory::GrantGroupWriteAccess.create!(:user => User.current, :page => gp.page, :object => gp.group) if gp.granted_group_write_access?
      PageHistory::GrantGroupReadAccess.create!(:user => User.current, :page => gp.page, :object => gp.group)  if gp.granted_group_read_access?
    end
{'fraction_non_alphanumeric': 0.13152462400471837, 'fraction_numerical': 0.0, 'mean_word_length': 3.2774274905422445, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 55, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2971045', 'n_tokens_mistral': 1058, 'n_tokens_neox': 1012, 'n_words': 193}