<commit_before><% exclude_responses = exclude_responses ? Array(exclude_responses) : [] %>

<div class="panel panel-default">
  <div class="panel-body">
    <% if (item.completed and ReviewResult.where(item: item).where.not(result: "skip").exists?) or
        ReviewResult.where(user: current_user, item: item).where.not(result: "skip").exists? %>
      <h5>
        <% if item.completed %>
          Review completed.
        <% else %>
          You have already reviewed this item.  It needs more reviews from other users to be completed.
        <% end %>
      </h5>

      <p>
        <% item.results.each do |result| %>
          <b><%= result.user.username %></b>
          <span data-livestamp="<%= result.created_at.to_i %>" title="<%= result.created_at.to_s %>">
            <%= time_ago_in_words(result.created_at.to_s) %>
          </span>:
          <b><%= result.result == 'skip' ? 'Skip' : queue.responses.map(&:reverse).to_h[result.result] %></b>
          <br/>
        <% end %>
      </p>

      <%= link_to 'Next', 'javascript:void(0)', class: 'btn btn-primary review-next-link' %>
    <% else %>
      <% (queue.responses - exclude_responses).each do |r| %>
        <%= link_to r[0], submit_review_path(name: queue.name, item_id: item.id, response: r[1]), class: 'btn btn-primary review-submit-link',
                    method: :post, remote: true %>
      <% end %>
      <%= link_to 'Skip', submit_review_path(name: queue.name, item_id: item.id, response: 'skip'), class: 'btn btn-primary review-submit-link',
                  method: :post, remote: true %>
    <% end %>
  </div>
</div><commit_msg>Guard against result.user being nil in reviews<commit_after><% exclude_responses = exclude_responses ? Array(exclude_responses) : [] %>

<div class="panel panel-default">
  <div class="panel-body">
    <% if (item.completed and ReviewResult.where(item: item).where.not(result: "skip").exists?) or
        ReviewResult.where(user: current_user, item: item).where.not(result: "skip").exists? %>
      <h5>
        <% if item.completed %>
          Review completed.
        <% else %>
          You have already reviewed this item.  It needs more reviews from other users to be completed.
        <% end %>
      </h5>

      <p>
        <% item.results.each do |result| %>
          <b><%= result.user.present? ? result.user.username : 'No user recorded' %></b>
          <span data-livestamp="<%= result.created_at.to_i %>" title="<%= result.created_at.to_s %>">
            <%= time_ago_in_words(result.created_at.to_s) %>
          </span>:
          <b><%= result.result == 'skip' ? 'Skip' : queue.responses.map(&:reverse).to_h[result.result] %></b>
          <br/>
        <% end %>
      </p>

      <%= link_to 'Next', 'javascript:void(0)', class: 'btn btn-primary review-next-link' %>
    <% else %>
      <% (queue.responses - exclude_responses).each do |r| %>
        <%= link_to r[0], submit_review_path(name: queue.name, item_id: item.id, response: r[1]), class: 'btn btn-primary review-submit-link',
                    method: :post, remote: true %>
      <% end %>
      <%= link_to 'Skip', submit_review_path(name: queue.name, item_id: item.id, response: 'skip'), class: 'btn btn-primary review-submit-link',
                  method: :post, remote: true %>
    <% end %>
  </div>
</div>
{'fraction_non_alphanumeric': 0.17673579801623085, 'fraction_numerical': 0.003005710850616171, 'mean_word_length': 2.6095444685466376, 'pattern_counts': {'":': 0, '<': 71, '<?xml version=': 0, '>': 71, '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': '4321899', 'n_tokens_mistral': 1129, 'n_tokens_neox': 1046, 'n_words': 241}