<commit_before># Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
  def add_action(text, url)
    @actions ||= []
    @actions.push([text,url])
  end

  def display_online(item)
    item.online? ? "<span class='online'>Online</span>" : "<span class='offline'>Offline</span>"
  end
  
  def build_action_list
    @actions ||= []
    if @actions.size > 0
      content_for :sidebar do
        '<ul>' +
        @actions.map do | action |
          "<li>" + link_to( action[0], action[1]) + "</li>"
        end.join("\n") + '</ul>'
      end
    end
  end
  
  def selected_tab?(cont)
    @controller.controller_name == cont ? 'active' : 'inactive'
  end
  
  def display_backup_duration(job)
    return 'Unknown' unless job
    return 'Not yet started' if job.status == 'queued'
    start_time = job.started || job.created_at
    end_time = job.updated_at
    
    if job.status == 'running'
      start_time = job.updated_at
      end_time = Time.new
    end
      
    distance_of_time_in_words(start_time, end_time )
  end
end<commit_msg>display the correct backup duration<commit_after># Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
  def add_action(text, url)
    @actions ||= []
    @actions.push([text,url])
  end

  def display_online(item)
    item.online? ? "<span class='online'>Online</span>" : "<span class='offline'>Offline</span>"
  end
  
  def build_action_list
    @actions ||= []
    if @actions.size > 0
      content_for :sidebar do
        '<ul>' +
        @actions.map do | action |
          "<li>" + link_to( action[0], action[1]) + "</li>"
        end.join("\n") + '</ul>'
      end
    end
  end
  
  def selected_tab?(cont)
    @controller.controller_name == cont ? 'active' : 'inactive'
  end
  
  def display_backup_duration(job)
    return 'Unknown' unless job
    return 'Not yet started' if job.status == 'queued'
    start_time = job.started || job.created_at
    end_time = job.updated_at
    
    if job.status == 'running'
      start_time = job.started
      end_time = Time.new
    end
      
    distance_of_time_in_words(start_time, end_time )
  end
end
{'fraction_non_alphanumeric': 0.1255079006772009, 'fraction_numerical': 0.002708803611738149, 'mean_word_length': 2.8010291595197256, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 21, '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': '7370053', 'n_tokens_mistral': 722, 'n_tokens_neox': 716, 'n_words': 185}