<commit_before>ActiveAdmin.register MonthlyUsage do
  actions :index, :show
  menu false
  index do
    column :entity
    #column :entity_type
    column :yearmonth
    column :use
    column 'Wholesale Cost', :cost, sortable: :cost do |mu|
      link_to number_to_currency(mu.cost), superadmin_monthly_usage_path(mu)
    end
    column 'Retail Cost', :retail_cost, sortable: :retail_cost do |mu|
      link_to number_to_currency(mu.retail_cost), superadmin_monthly_usage_path(mu)
    end 
    column 'Time', :value, sortable: :value do |mu|
      Api::BaseHelper::time_definition(mu.value||0)
    end
  end

  filter :yearmonth
  filter :entity_type

  show do
    panel "Monthly Usage Details" do
      attributes_table_for monthly_usage do
        row :id
        row :entity
        row :entity_type
        row :yearmonth
        row :use
        row("Wholesale Cost") { number_to_currency(monthly_usage.cost) }
        row("Retail Cost") { number_to_currency(monthly_usage.retail_cost) }
        row("Time") { Api::BaseHelper::time_definition(monthly_usage.value||0) }
      end
    end

    panel "Transcripts" do
      table_for monthly_usage.transcripts do |tbl|
        tbl.column("ID") {|tr| link_to tr.identifier, superadmin_transcript_path(tr) }
        tbl.column("Wholesale Cost") {|tr| number_to_currency(tr.cost_dollars) }
        tbl.column("Retail Cost") {|tr| number_to_currency(tr.retail_cost_dollars) }
        tbl.column("User") {|tr| user = tr.audio_file_lazarus.user; user ? link_to(user.name, superadmin_user_path(user)) : nil }
        tbl.column("Transcriber") {|tr| link_to tr.transcriber.name, superadmin_transcriber_path(tr.transcriber) }
        tbl.column("Created") {|tr| tr.created_at }
      end
    end
  end
<commit_msg>tweek labeling, add duration to transcript display<commit_after>ActiveAdmin.register MonthlyUsage do
  actions :index, :show
  menu false
  index do
    column :entity
    #column :entity_type
    column :yearmonth
    column :use
    column 'Wholesale Cost', :cost, sortable: :cost do |mu|
      link_to number_to_currency(mu.cost), superadmin_monthly_usage_path(mu)
    end
    column 'Retail Cost', :retail_cost, sortable: :retail_cost do |mu|
      link_to number_to_currency(mu.retail_cost), superadmin_monthly_usage_path(mu)
    end 
    column 'Time', :value, sortable: :value do |mu|
      Api::BaseHelper::time_definition(mu.value||0)
    end
  end

  filter :yearmonth
  filter :entity_type

  show do
    panel "Monthly Usage Details" do
      attributes_table_for monthly_usage do
        row :id
        row :entity
        row :entity_type
        row :yearmonth
        row :use
        row("Wholesale") { number_to_currency(monthly_usage.cost) }
        row("Retail") { number_to_currency(monthly_usage.retail_cost) }
        row("Duration") { monthly_usage.value_as_hms }
      end
    end

    panel "Transcripts" do
      table_for monthly_usage.transcripts do |tbl|
        tbl.column("ID") {|tr| link_to tr.identifier, superadmin_transcript_path(tr) }
        tbl.column("Duration") {|tr| tr.billable_hms }
        tbl.column("Wholesale") {|tr| div :class => "cost" do number_to_currency(tr.cost_dollars); end }
        tbl.column("Retail") {|tr| div :class => "cost" do number_to_currency(tr.billable? ? tr.retail_cost_dollars : 0); end }
        tbl.column("User") {|tr| user = tr.audio_file_lazarus.user; user ? link_to(user.name, superadmin_user_path(user)) : nil }
        tbl.column("Transcriber") {|tr| link_to tr.transcriber.name, superadmin_transcriber_path(tr.transcriber) }
        tbl.column("Created") {|tr| tr.created_at }
      end
    end
  end

{'fraction_non_alphanumeric': 0.1095852787695688, 'fraction_numerical': 0.0010985992859104642, 'mean_word_length': 3.4306569343065694, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '327295', 'n_tokens_mistral': 1249, 'n_tokens_neox': 1211, 'n_words': 267}