<commit_before>module ArchivesHelper
  def archive_action_link(archive)
    if archive.s3_url.present?
      download_button(archive)
    elsif archive.transactions_left_to_explain && archive.transactions_left_to_explain > 0
      transactions_left_to_explain_label(archive)
    else
      generate_button(archive)
    end
  end

  def download_button(archive)
    link_to(
      content_tag(:span, class: %w{glyphicon glyphicon-download-alt}) + "Download Archive",
      archive.s3_url,
      class: %w{btn btn-sm btn-success}
    )
  end

  def transactions_left_to_explain_label(archive)
    content_tag(:span, "#{archive.transactions_left_to_explain} transactions left to explain", class: %w{label label-warning})
  end

  def generate_button(archive)
    link_to(
      content_tag(:span, class: %w{glyphicon glyphicon-cog}) + "Generate Archive",<commit_msg>Add html_safe on content_tags in helpers<commit_after>module ArchivesHelper
  def archive_action_link(archive)
    if archive.s3_url.present?
      download_button(archive)
    elsif archive.transactions_left_to_explain && archive.transactions_left_to_explain > 0
      transactions_left_to_explain_label(archive)
    else
      generate_button(archive)
    end
  end

  def download_button(archive)
    link_to(
      content_tag(:span, class: %w{glyphicon glyphicon-download-alt}).html_safe + "Download Archive",
      archive.s3_url,
      class: %w{btn btn-sm btn-success}
    )
  end

  def transactions_left_to_explain_label(archive)
    content_tag(:span, "#{archive.transactions_left_to_explain} transactions left to explain", class: %w{label label-warning}).html_safe
  end

  def generate_button(archive)
    link_to(
      content_tag(:span, class: %w{glyphicon glyphicon-cog}).html_safe + "Generate Archive",
{'fraction_non_alphanumeric': 0.09029725182277061, 'fraction_numerical': 0.0033651149747616375, 'mean_word_length': 4.45565749235474, 'pattern_counts': {'":': 0, '<': 3, '<?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': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7124592', 'n_tokens_mistral': 584, 'n_tokens_neox': 565, 'n_words': 108}