<commit_before><% cache "nels_data_#{@display_data_file.id}" do %>
    <% spreadsheet = Rails.cache.fetch(@display_data_file.content_blob.cache_key) { @display_data_file.spreadsheet } %>
    <% sheet = spreadsheet.sheets.detect { |s| s.name.downcase == 'data' } %>
    <% if sheet && sheet.rows[2] # Needs at least 2 rows %>
        <%= folding_panel('NeLS location info', true) do %>
            <div class="table-responsive">
              <table class="table table-condensed">
                <thead>
                <tr>
                  <% sheet.columns.each_with_index do |col, i| %>
                      <% if sheet.rows[1][i+1] %>
                          <th><%= sheet.rows[1][i+1].value %></th>
                      <% end %>
                  <% end %>
                </tr>
                </thead>
                <tbody>
                <% sheet.rows[2..-1].each_with_index do |row, i| %>
                    <tr>
                      <% row.cells[1..-1].each do |cell| %>
                          <td><%= cell.try(:value) %></td>
                      <% end %>
                    </tr>
                <% end %>
                </tbody>
              </table>
            </div>
        <% end %>
    <% end %>
<% end %>
<commit_msg>Don't try and display spreadsheet if there isn't one<commit_after><% cache "nels_data_#{@display_data_file.id}" do %>
    <% spreadsheet = Rails.cache.fetch(@display_data_file.content_blob.cache_key) { @display_data_file.spreadsheet } %>
    <% if spreadsheet %>
        <% sheet = spreadsheet.sheets.detect { |s| s.name.downcase == 'data' } %>
        <% if sheet && sheet.rows[2] # Needs at least 2 rows %>
            <%= folding_panel('NeLS location info', true) do %>
                <div class="table-responsive">
                  <table class="table table-condensed">
                    <thead>
                    <tr>
                      <% sheet.columns.each_with_index do |col, i| %>
                          <% if sheet.rows[1][i+1] %>
                              <th><%= sheet.rows[1][i+1].value %></th>
                          <% end %>
                      <% end %>
                    </tr>
                    </thead>
                    <tbody>
                    <% sheet.rows[2..-1].each_with_index do |row, i| %>
                        <tr>
                          <% row.cells[1..-1].each do |cell| %>
                              <td><%= cell.try(:value) %></td>
                          <% end %>
                        </tr>
                    <% end %>
                    </tbody>
                  </table>
                </div>
            <% end %>
        <% end %>
    <% end %>
<% end %>

{'fraction_non_alphanumeric': 0.15937731653076354, 'fraction_numerical': 0.007412898443291327, 'mean_word_length': 1.1185243328100472, 'pattern_counts': {'":': 0, '<': 73, '<?xml version=': 0, '>': 73, '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': '4720669', 'n_tokens_mistral': 852, 'n_tokens_neox': 729, 'n_words': 143}