<commit_before><%= create_report_table_header("Reviewer" => "16%",
                               "# teammate reviews done" => "14%",
                               "Teammate reviewed" => "20%",
                               "Last reviewed at" => "20%") %>
    <%@l = -1 %>

    <% @reviewers.each do |reviewer| %>
      <% @teammate_review_response_maps = ResponseMap.where(["reviewed_object_id = ? and reviewer_id = ? and type = ?", @id, reviewer.reviewer_id, @type]) %>
      <% @user = User.find(Participant.find(reviewer.reviewer_id).user_id) %>
      <% @team_id = TeamsUser.team_id(@id.to_i, @user.id) %>
      <% @team_member_count = TeammateReviewResponseMap.where(reviewer_id: reviewer.reviewer_id, reviewed_object_id: @id).count %>
      <tr>
        <% @count = 0 %>
        <% @rspan = 0 %>
        <%@l = @l+1 %>
        <!-- alternate the colors of columns -->
        <% (@l % 2 == 0) ? @bgcolor = "#ffffff" : @bgcolor = "#f9f9f9" %>

        <% @teammate_review_response_maps.each do |response_map| %>
        <!--count means the teammate reviews one student completed.-->
          <% if Response.exists?(map_id: response_map.id) %>
            <% @count = @count + 1 %>
          <% end %>
        <%end %>
        <!--rspan means the all teammate reviews one student should finish, here is the num of team members minus 1.-->
        <% @team_member_count > 1 ? @rspan = @team_member_count : @rspan = 1 %>      
        <!-- for a valid reviewer -->
        <%if Participant.exists?(id: reviewer.reviewer_id) %>
          <% @reviewer_name = @user.fullname(session[:ip]) %>
          <!--Reviewer-->
          <td bgcolor=<%= @bgcolor %> rowspan= <%= @rspan %>>
            <%= link_to @reviewer_name, :controller => 'popup', :action => 'reviewer_details_popup', :id => reviewer.reviewer_id, :assignment_id => @id%>
          </td>
          <!--# teammate reviews done-->
          <td bgcolor=<%= @bgcolor %>  align = "left" rowspan= <%= @rspan %>>
            <% if @team_member_count == 1 %>
              <%= '--' %>
            <% else %>
              <%= @count %>/<%= @rspan %>
            <% end %>
          </td>

          <% @teammate_review_response_maps.each do |rm| %>
            <!--for each teammate_review_response_maps, we have to check whether the corresponsding teammate_review_response exists or not-->
            <% map_id = rm.id %>
            <% @teammate_review_response = Response.where(map_id: map_id).first %>
            <% if !@teammate_review_response.blank? %>
              <% @reviewee = rm.reviewee.user %>
                <!--Teammate reviewed-->
                <td id = "green" bgcolor=<%= @bgcolor %> align = 'left' colspan=1>
                  <%= link_to @reviewee.name(session[:ip]), impersonate_impersonate_path(:user => {:name => @reviewee.name}), :method => :post, :title => "Click here to impersonate this user" %>
                  (<%= @reviewee.fullname(session[:ip]) %>)
                </td>
                <!--Last reviewed at-->
                <td bgcolor=<%= @bgcolor %> align = 'left'>
                  <%= @teammate_review_response.updated_at.to_time.strftime("%m/%d/%Y - %I:%M%p") %>
                </td></tr><tr>
            <% else %>
              <!-- Teammate reviewed-->
              <td id = "green" bgcolor=<%= @bgcolor %> style="color:#DD3300" align = 'left' colspan=1>
                <% if @team_member_count == 1 %>
                  <%= 'N/A' %>
                <% else %>
                  <% @reviewee = rm.reviewee.user %>
                  <%= link_to @reviewee.name(session[:ip]), impersonate_impersonate_path(:user => {:name => @reviewee.name}), :method => :post, :title => "Click here to impersonate this user" %>
                  (<%= @reviewee.fullname(session[:ip]) %>)
                <% end %>
              </td>
              <!--Last reviewed at-->
              <td bgcolor=<%= @bgcolor %> style="color:#DD3300" align = 'left'>No</td></tr><tr>
            <% end %>
          <% end %>
          </tr>
        <% end %>
    <% end %>
  </table>
</div><commit_msg>added sorting features for teammate_review_report<commit_after><script>
  $(function () {
    /*E2084: Function for sorting the table */
    $("#teammateReviewTable").tablesorter({

        dateFormat : "mmddyyyy", //E2084: set the default date format
      sortList: [[0,0]] // E2084: sort First Column by default when page loads
    });
  });
</script>

 <!--E2084: table teammateReviewTable modified-->
 <div class = 'reviewreport'>
 <table id= "teammateReviewTable" cellspacing='0' cellpadding='2' border=0 class="table table-striped">
 <thead>
 <!--E2084: "sorter-true" included to sort the table using each attribute-->
  <tr bgcolor='#CCCCCC'>
  <th class="sorter-true" >Reviewer</th>
  <th class="sorter-true" ># teammate reviews done</th>
  <th class="sorter-true" >Teammate reviewed</th>
  <th class="sorter-true" >Last reviewed at</th>
  </tr>
 </thead>

    <%@l = -1 %>

    <% @reviewers.each do |reviewer| %>
      <% @teammate_review_response_maps = ResponseMap.where(["reviewed_object_id = ? and reviewer_id = ? and type = ?", @id, reviewer.reviewer_id, @type]) %>
      <% @user = User.find(Participant.find(reviewer.reviewer_id).user_id) %>
      <% @team_id = TeamsUser.team_id(@id.to_i, @user.id) %>
      <% @team_member_count = TeammateReviewResponseMap.where(reviewer_id: reviewer.reviewer_id, reviewed_object_id: @id).count %>
      <tr>
        <% @count = 0 %>
        <% @rspan = 0 %>
        <%@l = @l+1 %>
        <!-- alternate the colors of columns -->
        <% (@l % 2 == 0) ? @bgcolor = "#ffffff" : @bgcolor = "#f9f9f9" %>

        <% @teammate_review_response_maps.each do |response_map| %>
        <!--count means the teammate reviews one student completed.-->
          <% if Response.exists?(map_id: response_map.id) %>
            <% @count = @count + 1 %>
          <% end %>
        <%end %>
        <!--rspan means the all teammate reviews one student should finish, here is the num of team members minus 1.-->
        <% @team_member_count > 1 ? @rspan = @team_member_count : @rspan = 1 %>      
        <!-- for a valid reviewer -->
        <%if Participant.exists?(id: reviewer.reviewer_id) %>
          <% @reviewer_name = @user.fullname(session[:ip]) %>
          <!--Reviewer-->
          <td bgcolor=<%= @bgcolor %> rowspan= <%= @rspan %>>
            <%= link_to @reviewer_name, :controller => 'popup', :action => 'reviewer_details_popup', :id => reviewer.reviewer_id, :assignment_id => @id%>
          </td>
          <!--# teammate reviews done-->
          <td bgcolor=<%= @bgcolor %>  align = "left" rowspan= <%= @rspan %>>
            <% if @team_member_count == 1 %>
              <%= '--' %>
            <% else %>
              <%= @count %>/<%= @rspan %>
            <% end %>
          </td>

          <% @teammate_review_response_maps.each do |rm| %>
            <!--for each teammate_review_response_maps, we have to check whether the corresponsding teammate_review_response exists or not-->
            <% map_id = rm.id %>
            <% @teammate_review_response = Response.where(map_id: map_id).first %>
            <% if !@teammate_review_response.blank? %>
              <% @reviewee = rm.reviewee.user %>
                <!--Teammate reviewed-->
                <td id = "green" bgcolor=<%= @bgcolor %> align = 'left' colspan=1>
                  <%= link_to @reviewee.name(session[:ip]), impersonate_impersonate_path(:user => {:name => @reviewee.name}), :method => :post, :title => "Click here to impersonate this user" %>
                  (<%= @reviewee.fullname(session[:ip]) %>)
                </td>
                <!--Last reviewed at-->
                <td bgcolor=<%= @bgcolor %> align = 'left'>
                  <%= @teammate_review_response.updated_at.to_time.strftime("%m/%d/%Y - %I:%M%p") %>
                </td></tr><tr class="tablesorter-childRow">
            <% else %>
              <!-- Teammate reviewed-->
              <td id = "green" bgcolor=<%= @bgcolor %> style="color:#DD3300" align = 'left' colspan=1>
                <% if @team_member_count == 1 %>
                  <%= 'N/A' %>
                <% else %>
                  <% @reviewee = rm.reviewee.user %>
                  <%= link_to @reviewee.name(session[:ip]), impersonate_impersonate_path(:user => {:name => @reviewee.name}), :method => :post, :title => "Click here to impersonate this user" %>
                  (<%= @reviewee.fullname(session[:ip]) %>)
                <% end %>
              </td>
              <!--Last reviewed at-->
              <td bgcolor=<%= @bgcolor %> style="color:#DD3300" align = 'left'>No</td></tr><tr class="tablesorter-childRow">
            <% end %>
          <% end %>
          </tr>
        <% end %>
    <% end %>
  </table>
</div>
{'fraction_non_alphanumeric': 0.17963256974370606, 'fraction_numerical': 0.009412565207530052, 'mean_word_length': 2.0664116828929067, 'pattern_counts': {'":': 0, '<': 190, '<?xml version=': 0, '>': 220, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1556393', 'n_tokens_mistral': 3042, 'n_tokens_neox': 2680, 'n_words': 587}