<% provide(:metric, 'Completeness') %>
<% content_for :content do %>
  <table class="table">
    <thead>
      <tr>
        <th>Field</th>
        <th>Value</th>
      </tr>
    </thead>
    <tbody>
      <% @properties.each do |key| %>
        <tr>
          <td><%= key %></td>
          <td></td>
        </tr>
      <% end %>
    </tbody>
  </table>
<% end %>
<%= render 'layouts/metric_details' %>

<% provide(:metric, 'Completeness') %>
<% content_for :content do %>
  <table class="table">
    <thead>
      <tr>
        <th>Field</th>
        <th>Subfield</th>
        <th>Best Record</th>
        <th>Worst Record</th>
      </tr>
    </thead>
    <tbody>
      <% @properties.each do |key| %>
        <% if key.is_a? Hash %>
          <tr>
            <td rowspan="<%= key.values.first.length %>"><%= key.keys.first %></td>
            <td><%= key.values.first.first %></td>
          </tr>
          <% key.values.first[0..-1].each do |subfield| %>
            <tr>
              <td><%= subfield %></td>
            </tr>
          <% end %>
        <% else %>
          <tr>
            <td><%= key %></td>
            <td></td>
          </tr>
        <% end %>
      <% end %>
    </tbody>
  </table>
<% end %>
<%= render 'layouts/metric_details' %>

Add ERB code for displaying associative arrays
Add ERB code for displaying associative arrays

I have extended the template in order to present the CKAN schema fields
and the records with the best and worst completeness metric result.

Signed-off-by: Konrad Reiche <4ff0213f56e2082fcd8c882d04c546881c579ce4@gmail.com>
