<commit_before><div class="page-header">
  <h2><%= t "views.page.index", model_name: h(::TestCase) %></h2>
</div>

<%= fume_nav @platform.try(:id) do |n| %>
  <ul class="nav nav-tabs mb-4">
    <li class="nav-item ml-2">
      <%= n.link_to nil, "All Platforms", url_for(params.permit!.merge(platform_id: nil)), class: "nav-link text-muted" %>
    </li>
    <% Platform.all.each do |platform| %>
      <li class="nav-item">
        <%= n.link_to platform.id, platform.name, url_for(params.permit!.merge(platform_id: platform)), class: "nav-link text-muted" %>
      </li>
    <% end %>
    <li class="nav-item">
      <%= link_to "+", [ :new, :platform, ok_url: request.fullpath ], class: "nav-link text-muted" %>
    </li>
    <% if @platform %>
      <li class="nav-item ml-auto">
        <%= edit_link [ :edit, @platform, ok_url: request.fullpath ], class: "nav-link border-0" %>
      </li>
    <% end %>
  </ul>
<% end %>

<div class="tab-content">
  <div class="d-flex flex-wrap">
    <% @test_cases.each do |test_case| %>
      <div class="col-12 col-sm-6 col-lg-4 col-xl-3 pb-4">
        <div class="card card-case">
          <div class="card-body">
            <div class="pull-right">
              <%= edit_link action: :edit, id: test_case, ok_url: request.fullpath %>
            </div>
            <h4 class="card-title" ><%= "##{test_case.id}" %> <%= test_case.title %></h4>

            <p class="line-1 card-text text-muted"><%= test_case.content.lines.first %></p>
            <div>
              <% component = test_case.component %>
              <span class="badge badge-secondary"><%= ([component] + component.ancestors).reverse_each.map(&:name).join(" / ") %></span>
              <% test_case.platforms.each do |platform| %>
                <span class="badge badge-secondary"><%= platform.name %></span>
              <% end %>
            </div>
          </div>
        </div>
      </div>
    <% end %>
  </div>

  <nav class="table-pagination">
    <%= paginate @test_cases %>
  </nav>
</div>

<hr>

<div class="page-actions">
  <%= new_button ::TestCase, action: :new %>
</div>
<commit_msg>修复获取 test_case content 可能为空的问题<commit_after><div class="page-header">
  <h2><%= t "views.page.index", model_name: h(::TestCase) %></h2>
</div>

<%= fume_nav @platform.try(:id) do |n| %>
  <ul class="nav nav-tabs mb-4">
    <li class="nav-item ml-2">
      <%= n.link_to nil, "All Platforms", url_for(params.permit!.merge(platform_id: nil)), class: "nav-link text-muted" %>
    </li>
    <% Platform.all.each do |platform| %>
      <li class="nav-item">
        <%= n.link_to platform.id, platform.name, url_for(params.permit!.merge(platform_id: platform)), class: "nav-link text-muted" %>
      </li>
    <% end %>
    <li class="nav-item">
      <%= link_to "+", [ :new, :platform, ok_url: request.fullpath ], class: "nav-link text-muted" %>
    </li>
    <% if @platform %>
      <li class="nav-item ml-auto">
        <%= edit_link [ :edit, @platform, ok_url: request.fullpath ], class: "nav-link border-0" %>
      </li>
    <% end %>
  </ul>
<% end %>

<div class="tab-content">
  <div class="d-flex flex-wrap">
    <% @test_cases.each do |test_case| %>
      <div class="col-12 col-sm-6 col-lg-4 col-xl-3 pb-4">
        <div class="card card-case">
          <div class="card-body">
            <div class="pull-right">
              <%= edit_link action: :edit, id: test_case, ok_url: request.fullpath %>
            </div>
            <h4 class="card-title" ><%= "##{test_case.id}" %> <%= test_case.title %></h4>

            <p class="line-1 card-text text-muted"><%= (test_case.content || "").lines.first %></p>
            <div>
              <% component = test_case.component %>
              <span class="badge badge-secondary"><%= ([component] + component.ancestors).reverse_each.map(&:name).join(" / ") %></span>
              <% test_case.platforms.each do |platform| %>
                <span class="badge badge-secondary"><%= platform.name %></span>
              <% end %>
            </div>
          </div>
        </div>
      </div>
    <% end %>
  </div>

  <nav class="table-pagination">
    <%= paginate @test_cases %>
  </nav>
</div>

<hr>

<div class="page-actions">
  <%= new_button ::TestCase, action: :new %>
</div>

{'fraction_non_alphanumeric': 0.20998359503163816, 'fraction_numerical': 0.0065619873447386925, 'mean_word_length': 2.4642857142857144, 'pattern_counts': {'":': 0, '<': 133, '<?xml version=': 0, '>': 133, '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': '1668629', 'n_tokens_mistral': 1600, 'n_tokens_neox': 1499, 'n_words': 306}