<commit_before>module ActivitiesHelper
  def formatted_worktime_for_day(day)
    format_duration @user.activities.where(date: day).sum(:duration)
  end

  def activity_source_information(activity)
    [:otrs, :redmine].each do |source|
      ticket_id = activity.send("#{source}_ticket_id")
      if ticket_id
        url = link_to("##{ticket_id}", ticket_url(source, ticket_id))
        return t(".#{source}", { ticket_id: ticket_id, ticket_url: url }).html_safe
      end
    end
  end

  def customer_link(customer_id)
    stats_url = UberZeit::Config[:ubertrack_hosts]["stats"]
    customer = Customer.find(customer_id)
    link_to(customer.name, "#{stats_url}/admin/customerdetail.php?id=#{customer_id}")
  end

  private
  def ticket_url(ticketing_system, ticket_id)
    base_url = UberZeit::Config[:ubertrack_hosts]["#{ticketing_system}"]<commit_msg>Handle activities without redmine nor otrs ticket<commit_after>module ActivitiesHelper
  def formatted_worktime_for_day(day)
    format_duration @user.activities.where(date: day).sum(:duration)
  end

  def activity_source_information(activity)
    [:otrs, :redmine].each do |source|
      ticket_id = activity.send("#{source}_ticket_id")
      if ticket_id
        url = link_to("##{ticket_id}", ticket_url(source, ticket_id))
        return t(".#{source}", { ticket_id: ticket_id, ticket_url: url }).html_safe
      end
    end
    nil
  end

  def customer_link(customer_id)
    stats_url = UberZeit::Config[:ubertrack_hosts]["stats"]
    customer = Customer.find(customer_id)
    link_to(customer.name, "#{stats_url}/admin/customerdetail.php?id=#{customer_id}")
  end

  private
  def ticket_url(ticketing_system, ticket_id)
    base_url = UberZeit::Config[:ubertrack_hosts]["#{ticketing_system}"]
{'fraction_non_alphanumeric': 0.12627986348122866, 'fraction_numerical': 0.0, 'mean_word_length': 4.824503311258278, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3495318', 'n_tokens_mistral': 595, 'n_tokens_neox': 572, 'n_words': 100}