<commit_before>module PagesHelper
  def event_log_sentence(event_log)
  
    case event_log.event_type.id
    when 18
      sharing_sentence(event_log)
    when 19
      add_item_sentence(event_log)
    when 20
      negative_feedback_sentence(event_log)
    when 21
      gifting_sentence(event_log)
    when 22
      trust_established_sentence(event_log)
    when 23
      trust_withdrawn_sentence(event_log)
    when 24
      item_damaged_sentence(event_log)
    when 25
      item_repaired_sentence(event_log)
    when 26
      fb_friend_join_sentence(event_log)
    else
      #
    end

  end
  
  def add_item_sentence(event_log)
    item    = link_to event_log.action_object_type_readable, item_path(event_log.action_object_id), :class => "positive"
    gifter  = link_to event_log.primary_short_name, person_path(event_log.primary), :class => "positive"

    if event_log.involved_as_requester?(current_user.person)
      sentence = "You are now sharing your" + " " + item
    else
      sentence = gifter + " " + "is now sharing their" + " " + item
    end
    sentence.html_safe
  end
  
  def sharing_sentence(event_log)
   item                = link_to event_log.action_object_type_readable, item_path(event_log.action_object_id), :class => "positive"
	 requester           = link_to event_log.primary_short_name, person_path(event_log.primary), :class => "positive"
	 requester_possesive = link_to event_log.primary_short_name.possessive, person_path(event_log.primary), :class => "positive"
   gifter              = link_to event_log.secondary_short_name, person_path(event_log.secondary), :class => "positive"
	 gifter_possesive    = link_to event_log.secondary_short_name.possessive, person_path(event_log.secondary), :class => "positive"

   if event_log.involved_as_requester?(current_user.person)
     sentence = "You borrowed " + gifter_possesive.html_safe + " " + item
   elsif event_log.involved_as_gifter?(current_user.person)
     sentence = requester + " borrowed your " + item
   elsif current_user.person.trusts?(event_log.primary) && !current_user.person.trusts?(event_log.secondary)
     sentence = requester + " borrowed " + gifter_possesive + " " + item
	 elsif !current_user.person.trusts?(event_log.primary) && current_user.person.trusts?(event_log.secondary)
     sentence = gifter + " shared their " + item + " with " + requester
	 elsif current_user.person.trusts?(event_log.primary) && current_user.person.trusts?(event_log.secondary)
      sentence = gifter + " " + "shared their" + " " + item + " with " + requester 
   else
     sentence = ""
   end
   
   sentence.html_safe
  end
  
  def gifting_sentence(event_log)
   item                = link_to event_log.action_object_type_readable, item_path(event_log.action_object_id), :class => "positive"
	 requester           = link_to event_log.primary_short_name, person_path(event_log.primary), :class => "positive"
	 requester_possesive = link_to event_log.primary_short_name.possessive, person_path(event_log.primary), :class => "positive"
   gifter              = link_to event_log.secondary_short_name, person_path(event_log.secondary), :class => "positive"
	 gifter_possesive    = link_to event_log.secondary_short_name.possessive, person_path(event_log.secondary), :class => "positive"

   if event_log.involved_as_requester?(current_user.person)
     sentence = "You borrowed " + gifter_possesive.html_safe + " " + item
   elsif event_log.involved_as_gifter?(current_user.person)
     sentence = requester + " borrowed your " + item
   elsif current_user.person.trusts?(event_log.primary) && !current_user.person.trusts?(event_log.secondary)
     sentence = requester + " received " + gifter_possesive + " " + item
	 elsif !current_user.person.trusts?(event_log.primary) && current_user.person.trusts?(event_log.secondary)
     sentence = gifter + " gifted their " + item + " to " + requester
	 elsif current_user.person.trusts?(event_log.primary) && current_user.person.trusts?(event_log.secondary)
      sentence = gifter + " gifted their " + item + " with " + requester 
   else
     sentence = ""
   end
   
   sentence.html_safe
  end
  
  def trust_established_sentence(event_log)
	  first_person       = link_to event_log.primary_short_name, person_path(event_log.primary), :class => "positive"
    first_person_full  = link_to event_log.primary_full_name, person_path(event_log.primary), :class => "positive"
    second_person      = link_to event_log.secondary_short_name, person_path(event_log.secondary), :class => "positive"
    second_person_full = link_to event_log.secondary_full_name, person_path(event_log.secondary), :class => "positive"

    if event_log.involved_as_requester?(current_user.person)
      sentence = "You have established a trusted relationship with " + second_person
    elsif event_log.involved_as_gifter?(current_user.person)
      sentence = "You have established a trusted relationship with " + first_person
    elsif current_user.person.trusts?(event_log.primary)
      sentence = first_person + " has established a trusted relationship with " + second_person_full
    elsif current_user.person.trusts?(event_log.secondary)
      sentence = second_person + " has established a trusted relationship with " + first_person_full
    elsif current_user.person.trusts?(event_log.primary) && current_user.person.trusts?(event_log.secondary)
      sentence = first_person + " and " + second_person + " have established a trusted relationship"
    else 
      sentence = ""
    end

    sentence.html_safe
  end

  def trust_withdrawn_sentence(event_log)
	  first_person       = link_to event_log.primary_short_name, person_path(event_log.primary), :class => "positive"
    first_person_full  = link_to event_log.primary_full_name, person_path(event_log.primary), :class => "positive"
    second_person      = link_to event_log.secondary_short_name, person_path(event_log.secondary), :class => "positive"
    second_person_full = link_to event_log.secondary_full_name, person_path(event_log.secondary), :class => "positive"

    if event_log.involved_as_requester?(current_user.person)
      sentence = "You have withdrawn your trust for " + second_person
    elsif event_log.involved_as_gifter?(current_user.person)
      sentence = first_person + " has withdrawn their trust for you"
    elsif current_user.person.trusts?(event_log.primary)
      sentence = first_person + " has withdrawn their trust for " + second_person_full
    elsif current_user.person.trusts?(event_log.secondary)
      sentence = second_person + " has withdrawn their trust for " + first_person_full
    elsif current_user.person.trusts?(event_log.primary) && current_user.person.trusts?(event_log.secondary)
      sentence = first_person + " has withdrawn their trust for " + second_person
    else
      sentence = ""
    end
    
    sentence.html_safe
  end
  
  def item_damaged_sentence(event_log)
    item    = link_to event_log.action_object_type_readable, item_path(event_log.action_object_id), :class => "positive"
    if event_log.action_object.is_owner?(current_user.person)
      sentence = "Your item" + " " + item + " " + "is broken"
    else
      person_possesive  = link_to event_log.primary_short_name.possessive, person_path(event_log.primary), :class => "positive"
      sentence = person_possesive + " " + "item" + " " + item + " " + "is broken"
    end
    sentence.html_safe
  end
  
  def item_repaired_sentence(event_log)
    item    = link_to event_log.action_object_type_readable, item_path(event_log.action_object_id), :class => "positive"
    if event_log.action_object.is_owner?(current_user.person)
      sentence = "Your item" + " " + item + " " + "has been broken"
    else
      person_possesive  = link_to event_log.primary_short_name.possessive, person_path(event_log.primary), :class => "positive"
      sentence = person_possesive + " " + "item" + " " + item + " " + "has been repaired"
    end
    sentence.html_safe
  end
  
  def fb_friend_join_sentence(event_log)
    first_person_full  = link_to event_log.primary_full_name, person_path(event_log.primary), :class => "positive"
    sentence = first_person_full + " has connected to sharedearth.net " 
    sentence.html_safe 
  end
  
  def recent_activity_avatar(activity_log)
    current_person = current_user.person
    if current_person != activity_log.secondary
      person = activity_log.secondary
    else
      person = activity_log.primary
    end
    
    case activity_log.event_type_id
    when 1
      current_person
    when 2
      person
    when 3
      current_person
    when 4
      current_person
    when 5
      current_person
    when 6
      person
    when 7
      person
    when 8
      person
    when 9
      surrent_person
    when 10
      person
    when 11
      current_person
    when 12
      current_person
    when 13
      person
    when 14
      current_person
    when 15
      person
    when 16
      person
    when 17
      current_person
       
      
    when 27
      current_person
    when 28
      current_person
    when 29
      person
    when 30
      person
    when 31
      person<commit_msg>Fixed dashboard error - typo<commit_after>module PagesHelper
  def event_log_sentence(event_log)
  
    case event_log.event_type.id
    when 18
      sharing_sentence(event_log)
    when 19
      add_item_sentence(event_log)
    when 20
      negative_feedback_sentence(event_log)
    when 21
      gifting_sentence(event_log)
    when 22
      trust_established_sentence(event_log)
    when 23
      trust_withdrawn_sentence(event_log)
    when 24
      item_damaged_sentence(event_log)
    when 25
      item_repaired_sentence(event_log)
    when 26
      fb_friend_join_sentence(event_log)
    else
      #
    end

  end
  
  def add_item_sentence(event_log)
    item    = link_to event_log.action_object_type_readable, item_path(event_log.action_object_id), :class => "positive"
    gifter  = link_to event_log.primary_short_name, person_path(event_log.primary), :class => "positive"

    if event_log.involved_as_requester?(current_user.person)
      sentence = "You are now sharing your" + " " + item
    else
      sentence = gifter + " " + "is now sharing their" + " " + item
    end
    sentence.html_safe
  end
  
  def sharing_sentence(event_log)
   item                = link_to event_log.action_object_type_readable, item_path(event_log.action_object_id), :class => "positive"
	 requester           = link_to event_log.primary_short_name, person_path(event_log.primary), :class => "positive"
	 requester_possesive = link_to event_log.primary_short_name.possessive, person_path(event_log.primary), :class => "positive"
   gifter              = link_to event_log.secondary_short_name, person_path(event_log.secondary), :class => "positive"
	 gifter_possesive    = link_to event_log.secondary_short_name.possessive, person_path(event_log.secondary), :class => "positive"

   if event_log.involved_as_requester?(current_user.person)
     sentence = "You borrowed " + gifter_possesive.html_safe + " " + item
   elsif event_log.involved_as_gifter?(current_user.person)
     sentence = requester + " borrowed your " + item
   elsif current_user.person.trusts?(event_log.primary) && !current_user.person.trusts?(event_log.secondary)
     sentence = requester + " borrowed " + gifter_possesive + " " + item
	 elsif !current_user.person.trusts?(event_log.primary) && current_user.person.trusts?(event_log.secondary)
     sentence = gifter + " shared their " + item + " with " + requester
	 elsif current_user.person.trusts?(event_log.primary) && current_user.person.trusts?(event_log.secondary)
      sentence = gifter + " " + "shared their" + " " + item + " with " + requester 
   else
     sentence = ""
   end
   
   sentence.html_safe
  end
  
  def gifting_sentence(event_log)
   item                = link_to event_log.action_object_type_readable, item_path(event_log.action_object_id), :class => "positive"
	 requester           = link_to event_log.primary_short_name, person_path(event_log.primary), :class => "positive"
	 requester_possesive = link_to event_log.primary_short_name.possessive, person_path(event_log.primary), :class => "positive"
   gifter              = link_to event_log.secondary_short_name, person_path(event_log.secondary), :class => "positive"
	 gifter_possesive    = link_to event_log.secondary_short_name.possessive, person_path(event_log.secondary), :class => "positive"

   if event_log.involved_as_requester?(current_user.person)
     sentence = "You borrowed " + gifter_possesive.html_safe + " " + item
   elsif event_log.involved_as_gifter?(current_user.person)
     sentence = requester + " borrowed your " + item
   elsif current_user.person.trusts?(event_log.primary) && !current_user.person.trusts?(event_log.secondary)
     sentence = requester + " received " + gifter_possesive + " " + item
	 elsif !current_user.person.trusts?(event_log.primary) && current_user.person.trusts?(event_log.secondary)
     sentence = gifter + " gifted their " + item + " to " + requester
	 elsif current_user.person.trusts?(event_log.primary) && current_user.person.trusts?(event_log.secondary)
      sentence = gifter + " gifted their " + item + " with " + requester 
   else
     sentence = ""
   end
   
   sentence.html_safe
  end
  
  def trust_established_sentence(event_log)
	  first_person       = link_to event_log.primary_short_name, person_path(event_log.primary), :class => "positive"
    first_person_full  = link_to event_log.primary_full_name, person_path(event_log.primary), :class => "positive"
    second_person      = link_to event_log.secondary_short_name, person_path(event_log.secondary), :class => "positive"
    second_person_full = link_to event_log.secondary_full_name, person_path(event_log.secondary), :class => "positive"

    if event_log.involved_as_requester?(current_user.person)
      sentence = "You have established a trusted relationship with " + second_person
    elsif event_log.involved_as_gifter?(current_user.person)
      sentence = "You have established a trusted relationship with " + first_person
    elsif current_user.person.trusts?(event_log.primary)
      sentence = first_person + " has established a trusted relationship with " + second_person_full
    elsif current_user.person.trusts?(event_log.secondary)
      sentence = second_person + " has established a trusted relationship with " + first_person_full
    elsif current_user.person.trusts?(event_log.primary) && current_user.person.trusts?(event_log.secondary)
      sentence = first_person + " and " + second_person + " have established a trusted relationship"
    else 
      sentence = ""
    end

    sentence.html_safe
  end

  def trust_withdrawn_sentence(event_log)
	  first_person       = link_to event_log.primary_short_name, person_path(event_log.primary), :class => "positive"
    first_person_full  = link_to event_log.primary_full_name, person_path(event_log.primary), :class => "positive"
    second_person      = link_to event_log.secondary_short_name, person_path(event_log.secondary), :class => "positive"
    second_person_full = link_to event_log.secondary_full_name, person_path(event_log.secondary), :class => "positive"

    if event_log.involved_as_requester?(current_user.person)
      sentence = "You have withdrawn your trust for " + second_person
    elsif event_log.involved_as_gifter?(current_user.person)
      sentence = first_person + " has withdrawn their trust for you"
    elsif current_user.person.trusts?(event_log.primary)
      sentence = first_person + " has withdrawn their trust for " + second_person_full
    elsif current_user.person.trusts?(event_log.secondary)
      sentence = second_person + " has withdrawn their trust for " + first_person_full
    elsif current_user.person.trusts?(event_log.primary) && current_user.person.trusts?(event_log.secondary)
      sentence = first_person + " has withdrawn their trust for " + second_person
    else
      sentence = ""
    end
    
    sentence.html_safe
  end
  
  def item_damaged_sentence(event_log)
    item    = link_to event_log.action_object_type_readable, item_path(event_log.action_object_id), :class => "positive"
    if event_log.action_object.is_owner?(current_user.person)
      sentence = "Your item" + " " + item + " " + "is broken"
    else
      person_possesive  = link_to event_log.primary_short_name.possessive, person_path(event_log.primary), :class => "positive"
      sentence = person_possesive + " " + "item" + " " + item + " " + "is broken"
    end
    sentence.html_safe
  end
  
  def item_repaired_sentence(event_log)
    item    = link_to event_log.action_object_type_readable, item_path(event_log.action_object_id), :class => "positive"
    if event_log.action_object.is_owner?(current_user.person)
      sentence = "Your item" + " " + item + " " + "has been broken"
    else
      person_possesive  = link_to event_log.primary_short_name.possessive, person_path(event_log.primary), :class => "positive"
      sentence = person_possesive + " " + "item" + " " + item + " " + "has been repaired"
    end
    sentence.html_safe
  end
  
  def fb_friend_join_sentence(event_log)
    first_person_full  = link_to event_log.primary_full_name, person_path(event_log.primary), :class => "positive"
    sentence = first_person_full + " has connected to sharedearth.net " 
    sentence.html_safe 
  end
  
  def recent_activity_avatar(activity_log)
    current_person = current_user.person
    if current_person != activity_log.secondary
      person = activity_log.secondary
    else
      person = activity_log.primary
    end
    
    case activity_log.event_type_id
    when 1
      current_person
    when 2
      person
    when 3
      current_person
    when 4
      current_person
    when 5
      current_person
    when 6
      person
    when 7
      person
    when 8
      person
    when 9
      current_person
    when 10
      person
    when 11
      current_person
    when 12
      current_person
    when 13
      person
    when 14
      current_person
    when 15
      person
    when 16
      person
    when 17
      current_person
       
      
    when 27
      current_person
    when 28
      current_person
    when 29
      person
    when 30
      person
    when 31
      person
{'fraction_non_alphanumeric': 0.08705856667212489, 'fraction_numerical': 0.00578571038698761, 'mean_word_length': 3.605832076420312, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 53, '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': '4091914', 'n_tokens_mistral': 6048, 'n_tokens_neox': 5722, 'n_words': 1122}