<commit_before>module ApplicationHelper

  def admin?
    !current_user.nil? and current_user.admin?
  end

  def event_host?
    host = false
    unless @event.nil?
      current_user.event_hosts.each do |hosted_event|
        event = hosted_event.event
        if hosted_event.active?
          host = host || (event.id == @event.id)
        end
      end
    end
    host
  end


  def yes_no (value)
    value ? "Yes" : "No"
  end

  def receipts_exist?
    current_user.user_events.any? {|user_event| user_event.total_price > 0}
  end

  def unpaid_payments?
    current_user.user_events.any? {|user_event| user_event.additional_payments.any? {|payment| payment.unpaid?}}
  end

  def pending_payments
    unpaid_payments = []
    current_user.user_events.each do |user_event|
      user_event.additional_payments.each do |payment|
        if payment.unpaid?
          unpaid_payments << payment
        end
      end
    end
    unpaid_payments
  end
end
<commit_msg>Correct `event_host?` to also include admins.<commit_after>module ApplicationHelper

  def admin?
    !current_user.nil? and current_user.admin?
  end

  def event_host?
    host = false
    unless @event.nil?
      current_user.event_hosts.each do |hosted_event|
        event = hosted_event.event
        if hosted_event.active?
          host = host || (event.id == @event.id)
        end
      end
    end
    host || admin?
  end


  def yes_no (value)
    value ? "Yes" : "No"
  end

  def receipts_exist?
    current_user.user_events.any? {|user_event| user_event.total_price > 0}
  end

  def unpaid_payments?
    current_user.user_events.any? {|user_event| user_event.additional_payments.any? {|payment| payment.unpaid?}}
  end

  def pending_payments
    unpaid_payments = []
    current_user.user_events.each do |user_event|
      user_event.additional_payments.each do |payment|
        if payment.unpaid?
          unpaid_payments << payment
        end
      end
    end
    unpaid_payments
  end
end

{'fraction_non_alphanumeric': 0.08601609657947686, 'fraction_numerical': 0.001006036217303823, 'mean_word_length': 2.6629834254143647, 'pattern_counts': {'":': 0, '<': 7, '<?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': '2469891', 'n_tokens_mistral': 686, 'n_tokens_neox': 656, 'n_words': 148}