Module: Admin::EmbeddingsHelper

Defined in:
app/helpers/admin/embeddings_helper.rb

Overview

Presentation helpers for the embedding coverage dashboard.

Instance Method Summary collapse

Instance Method Details

#coverage_badge_class(coverage) ⇒ String

Maps a coverage percentage to the dashboard's Bootstrap status class.

Parameters:

  • coverage (Numeric, nil)

    coverage percentage

Returns:

  • (String)

    Bootstrap background utility class



10
11
12
13
14
15
16
# File 'app/helpers/admin/embeddings_helper.rb', line 10

def coverage_badge_class(coverage)
  case coverage.to_f
  when 80.. then 'bg-success'
  when 50...80 then 'bg-warning'
  else 'bg-danger'
  end
end

#technical_support_coverage_rows(technical_support) ⇒ Hash{String => Hash}

Labels the two Technical Support corpus groupings shown in the summary.

Parameters:

  • technical_support (Hash)

    report's Technical Support metrics

Returns:

  • (Hash{String => Hash})

    ordered label-to-metric mapping



22
23
24
25
26
27
# File 'app/helpers/admin/embeddings_helper.rb', line 22

def technical_support_coverage_rows(technical_support)
  {
    'Curated knowledge' => technical_support.fetch(:curated),
    'Case evidence' => technical_support.fetch(:case_evidence)
  }
end