<commit_before><h2> Review scores: <%= Participant.find(@reviewer_id).name %> </h2>

<% keys = @review_final_versions.keys %>
<% keys.each do |key| %>

    <h4>Course: <%= Assignment.find(@assignment_id).course.name %></h4>
    <h4> Assignment: <%= Assignment.find(@assignment_id).name %></h4>
    <% roundtitle = key.to_s %>
    <h4><%= roundtitle.titlecase %></h4>

    <table class="general" border="1">
      <% questionnaire_id = Questionnaire.find(@review_final_versions[key][:questionnaire_id]) %>
      <% questions = Question.where(questionnaire_id: questionnaire_id) %>
      <% num_responses = @review_final_versions[key][:response_ids].length %>
      <% responses = @review_final_versions[key][:response_ids] %>
      <% questions.each do |question| %>

          <% if !question.is_a?(QuestionnaireHeader) && num_responses > 0 %>
              <tr>
                <th colspan="3" style="background-color:#DDDDBB" > [Question] <%= question.txt %> </th>
              </tr>
              <% if question.instance_of? Checkbox %>
                  <tr>
                    <td colspan="3" style="padding: 0px;">
                      <table width="100%">
                        <tr>
                          <% responses.each do |response_id| %>
                              <% team = Team.find(ResponseMap.find(Response.find(response_id).map_id).reviewee_id) %>
                              <td><%= team.name %></td>
                          <% end %>
                        </tr>

                        <tr>
                          <% responses.each do |response_id| %>
                              <% answer = Answer.where(response_id: response_id, question_id: question.id).first %>
                              <td align='center'>
                                <p><%= answer.answer == 0 ? image_tag("delete_icon.png") : image_tag("Check-icon.png") %></p></td>
                          <% end %>
                        </tr>
                      </table>
                    </td>
                  </tr>
              <% else %>
                  <!-- Only assign these column headers if the question isn't a checkbox question -->
                  <tr>
                    <td width="20%"> Reviewee</td>
                    <td width="10%"> Score</td>
                    <td width="70%"> Comments</td>
                  </tr>

                  <% responses.each do |response_id| %>
                      <% answer = Answer.where(response_id: response_id, question_id: question.id).first %>
                      <% if !answer.nil? %>
                          <tr>
                            <% team = Team.find(ResponseMap.find(Response.find(response_id).map_id).reviewee_id) %>
                            <% response_map = ReviewResponseMap.where(reviewed_object_id: @assignment_id,
                                                                      reviewer_id: @reviewer_id,
                                                                      reviewee_id: team.id).last %>
                            <% response_update_at = response_map.try(:response).try(:last).try(:updated_at) %>
                            <% review_graded_at = ReviewGrade.find_by(participant_id: @reviewer_id).try(:review_graded_at) %>
                            <% col_color = 'black' %>
                            <% col_color = 'blue' if review_graded_at && response_update_at && response_update_at > review_graded_at %>
                            <!--Reviewee-->
                            <td>
                              <p style="color: <%= col_color %>"><%= team.name %> <br>
                            </td>
                            <!--Score-->
                            <% if question.instance_of? Checkbox %>
                                <td align='center'>
                                  <p style="color: <%= col_color %>"><%= answer.answer == 0 ? image_tag("delete_icon.png") : image_tag("Check-icon.png") %></p>
                                </td>
                            <% else %>
                                <td align='center'><p style="color: <%= col_color %>"><%= answer.answer %></p></td>
                            <% end %>

                            <!--Comments-->
                            <td align='left'><p style="color: <%= col_color %>"><%= answer.comments.html_safe unless answer.comments.nil? %></p></td>
                          </tr>
                      <% else %>
                          <td>N/A</td>
                          <td>N/A</td>
                          <td>N/A</td>
                      <% end %>
                  <% end %>
              <% end %>
          <% else %>
              <% next %>
          <% end %>
      <% end %>
      <tr>
        <th align='left' style="background-color:#DDDDBB"> Reviewee</th>
        <th align='left' colspan="2" style="background-color:#DDDDBB"> Additional Comment</th>
      </tr>

      <% responses.each do |response_id| %>
          <% team = Team.find(ResponseMap.find(Response.find(response_id).map_id).reviewee_id) %>
          <tr>
            <td> <%= team.name %> </td>
            <td colspan="2"> <%=sanitize Response.find(response_id).additional_comment %> </td>
          </tr>
      <% end %>
    </table>

<% end #loop for keys %>
<br/><commit_msg>E1936: Updated review scores popup<commit_after><!--As instructed by <NAME> and Dr. Gehringer, if the current assignment varies by topic,-->
<!--this view should not display the content below. Instead it should display a message-->
<!--saying that this report is not available for assignments where rubrics vary by topic-->
<!--This message is set as the flash message from popup_controller.rb-->
<% assignment = Assignment.find(@assignment_id) %>
<% if !assignment.varying_rubrics_by_topic? %>

  <h2> Review scores: <%= Participant.find(@reviewer_id).name %> </h2>

  <% keys = @review_final_versions.keys %>
  <% keys.each do |key| %>

    <h4>Course: <%= Assignment.find(@assignment_id).course.name %></h4>
    <h4> Assignment: <%= Assignment.find(@assignment_id).name %></h4>
    <% roundtitle = key.to_s %>
    <h4><%= roundtitle.titlecase %></h4>

    <table class="general" border="1">
      <% questionnaire_id = Questionnaire.find(@review_final_versions[key][:questionnaire_id]) %>
      <% questions = Question.where(questionnaire_id: questionnaire_id) %>
      <% num_responses = @review_final_versions[key][:response_ids].length %>
      <% responses = @review_final_versions[key][:response_ids] %>
      <% questions.each do |question| %>

        <% if !question.is_a?(QuestionnaireHeader) && num_responses > 0 %>
          <tr>
            <th colspan="3" style="background-color:#DDDDBB" > [Question] <%= question.txt %> </th>
          </tr>
          <% if question.instance_of? Checkbox %>
            <tr>
              <td colspan="3" style="padding: 0px;">
                <table width="100%">
                  <tr>
                    <% responses.each do |response_id| %>
                      <% team = Team.find(ResponseMap.find(Response.find(response_id).map_id).reviewee_id) %>
                      <td><%= team.name %></td>
                    <% end %>
                  </tr>

                  <tr>
                    <% responses.each do |response_id| %>
                      <% answer = Answer.where(response_id: response_id, question_id: question.id).first %>
                      <td align='center'>
                        <p><%= answer.answer == 0 ? image_tag("delete_icon.png") : image_tag("Check-icon.png") %></p></td>
                    <% end %>
                  </tr>
                </table>
              </td>
            </tr>
          <% else %>
            <!-- Only assign these column headers if the question isn't a checkbox question -->
            <tr>
              <td width="20%"> Reviewee</td>
              <td width="10%"> Score</td>
              <td width="70%"> Comments</td>
            </tr>

            <% responses.each do |response_id| %>
              <% answer = Answer.where(response_id: response_id, question_id: question.id).first %>
              <% if !answer.nil? %>
                <tr>
                  <% team = Team.find(ResponseMap.find(Response.find(response_id).map_id).reviewee_id) %>
                  <% response_map = ReviewResponseMap.where(reviewed_object_id: @assignment_id,
                                                            reviewer_id: @reviewer_id,
                                                            reviewee_id: team.id).last %>
                  <% response_update_at = response_map.try(:response).try(:last).try(:updated_at) %>
                  <% review_graded_at = ReviewGrade.find_by(participant_id: @reviewer_id).try(:review_graded_at) %>
                  <% col_color = 'black' %>
                  <% col_color = 'blue' if review_graded_at && response_update_at && response_update_at > review_graded_at %>
                  <!--Reviewee-->
                  <td>
                    <p style="color: <%= col_color %>"><%= team.name %> <br>
                  </td>
                  <!--Score-->
                  <% if question.instance_of? Checkbox %>
                    <td align='center'>
                      <p style="color: <%= col_color %>"><%= answer.answer == 0 ? image_tag("delete_icon.png") : image_tag("Check-icon.png") %></p>
                    </td>
                  <% else %>
                    <td align='center'><p style="color: <%= col_color %>"><%= answer.answer %></p></td>
                  <% end %>

                  <!--Comments-->
                  <td align='left'><p style="color: <%= col_color %>"><%= answer.comments.html_safe unless answer.comments.nil? %></p></td>
                </tr>
              <% else %>
                <td>N/A</td>
                <td>N/A</td>
                <td>N/A</td>
              <% end %>
            <% end %>
          <% end %>
        <% else %>
          <% next %>
        <% end %>
      <% end %>
      <tr>
        <th align='left' style="background-color:#DDDDBB"> Reviewee</th>
        <th align='left' colspan="2" style="background-color:#DDDDBB"> Additional Comment</th>
      </tr>

      <% responses.each do |response_id| %>
        <% team = Team.find(ResponseMap.find(Response.find(response_id).map_id).reviewee_id) %>
        <tr>
          <td> <%= team.name %> </td>
          <td colspan="2"> <%=sanitize Response.find(response_id).additional_comment %> </td>
        </tr>
      <% end %>
    </table>

  <% end #loop for keys %>
  <br/>

<% end %>
{'fraction_non_alphanumeric': 0.15637393767705382, 'fraction_numerical': 0.005288007554296506, 'mean_word_length': 1.4791666666666667, 'pattern_counts': {'":': 0, '<': 285, '<?xml version=': 0, '>': 289, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 17, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1454152', 'n_tokens_mistral': 3222, 'n_tokens_neox': 2832, 'n_words': 532}