<commit_before>ActiveAdmin.register Endpoint do

# See permitted parameters documentation:
# https://github.com/activeadmin/activeadmin/blob/master/docs/2-resource-customization.md#setting-up-strong-parameters
#
# permit_params :list, :of, :attributes, :on, :model
#
# or
#
# permit_params do
#   permitted = [:permitted, :attributes]
#   permitted << :other if resource.something?
#   permitted
# end

  permit_params do
    permitted = [:name, :url, :description_url]
  end

  filter :name
  filter :url
  filter :created_at
  filter :updated_at

  index do
    selectable_column
    id_column
    column :name
    column :url
    column :alive do |endpoint|
      if endpoint.evaluations.exists?
        if endpoint.evaluations.exists?(:alive => true)
          endpoint.evaluations.where(:alive => true).last.created_at.to_formatted_s(:long)
        else
          "Dead"
        end
      else
        "N/A"
      end
    end
    column :dead_flag do |endpoint|
      if endpoint.evaluations.exists?
        if endpoint.evaluations.exists?(:alive => true)
          if endpoint.evaluations.where(:alive => true).last.created_at < 1.month.ago
            "True"
          end
        else
          "True"
        end
      else
        "N/A"
      end
    end
    actions
  end

  show do
    panel "Endpoint Details" do
      attributes_table_for endpoint do
        row :id
        row :name
        row :url
        row :description_url
        row :created_at
        row :updated_at
        row :issue_id<commit_msg>use retrieved_at column<commit_after>ActiveAdmin.register Endpoint do

# See permitted parameters documentation:
# https://github.com/activeadmin/activeadmin/blob/master/docs/2-resource-customization.md#setting-up-strong-parameters
#
# permit_params :list, :of, :attributes, :on, :model
#
# or
#
# permit_params do
#   permitted = [:permitted, :attributes]
#   permitted << :other if resource.something?
#   permitted
# end

  permit_params do
    permitted = [:name, :url, :description_url]
  end

  filter :name
  filter :url
  filter :created_at
  filter :updated_at

  index do
    selectable_column
    id_column
    column :name
    column :url
    column :alive do |endpoint|
      if endpoint.evaluations.exists?
        if endpoint.evaluations.exists?(:alive => true)
          endpoint.evaluations.where(:alive => true).last.retrieved_at.to_formatted_s(:long)
        else
          "Dead"
        end
      else
        "N/A"
      end
    end
    column :dead_flag do |endpoint|
      if endpoint.evaluations.exists?
        if endpoint.evaluations.exists?(:alive => true)
          if endpoint.evaluations.where(:alive => true).last.retrieved_at < 1.month.ago
            "True"
          end
        else
          "True"
        end
      else
        "N/A"
      end
    end
    actions
  end

  show do
    panel "Endpoint Details" do
      attributes_table_for endpoint do
        row :id
        row :name
        row :url
        row :description_url
        row :created_at
        row :updated_at
        row :issue_id
{'fraction_non_alphanumeric': 0.09262883235485975, 'fraction_numerical': 0.001304631441617743, 'mean_word_length': 2.2662406815761447, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 2, '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': '4007590', 'n_tokens_mistral': 938, 'n_tokens_neox': 934, 'n_words': 229}