<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Agarg25</id>
	<title>Expertiza_Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Agarg25"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Agarg25"/>
	<updated>2026-08-17T09:52:54Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141771</id>
		<title>CSC/ECE 517 Fall 2021 - E2165. Fix teammate-review view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141771"/>
		<updated>2021-11-28T19:50:21Z</updated>

		<summary type="html">&lt;p&gt;Agarg25: /* Changes to the models */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Introduction ==&lt;br /&gt;
&lt;br /&gt;
Dr. Edward Gehringer (instructor), Parimal Mehta (mentor)&lt;br /&gt;
&lt;br /&gt;
1. Anjali Garg (unity ID : agarg25)&lt;br /&gt;
&lt;br /&gt;
2. Arvasu Chikara (unity ID: achikar2)&lt;br /&gt;
&lt;br /&gt;
3. Lalit Bangad (unity ID: llbangad)&lt;br /&gt;
&lt;br /&gt;
4. Vinay Deshmukh (unity ID: vdeshmu)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Problems to be addressed ==&lt;br /&gt;
&lt;br /&gt;
After a project is submitted and reviewed, both the team members (students) and instructors should be able to view the teammate reviews. Students should be able to view the reviews by going to a particular assignment's -&amp;gt; your scores, at the bottom of the page. An instructor can view the teammate reviews by going to assignments -&amp;gt; assignment -&amp;gt; particular team's submission -&amp;gt; view submission -&amp;gt; assign grades -&amp;gt; view scores. &lt;br /&gt;
&lt;br /&gt;
In the case of the instructor, a single heat grid is shown whereas in the case of a team member, we cant view the scores. In the heat grid, it is not clear if the scores visible are for the reviews that the student has *written* for their teammates or the scores that the student has *received* from their teammates. Additionally, for instructors can choose from a list of the students on the team, but they have no way to tell whether the heat grid shows the reviews done *by* that student or done *for* that student.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Methodology Overview ==&lt;br /&gt;
&lt;br /&gt;
We have divided our work in the following tasks to address the above problems:&lt;br /&gt;
&lt;br /&gt;
1. Distinguish reviews done for a student by rendering separates heatgrids for each student&lt;br /&gt;
&lt;br /&gt;
2. For instructors, the table will have sections based on the students&lt;br /&gt;
&lt;br /&gt;
3. Include a checkbox on the edit assignment page that enables/disables visibility of heat grid to students&lt;br /&gt;
&lt;br /&gt;
4. Fix the average column for a table (which breaks for some reviews)&lt;br /&gt;
&lt;br /&gt;
5. Show a composite score derived from all reviews.  Make this code generalized, so other kinds of heat grid views could use it.&lt;br /&gt;
&lt;br /&gt;
6. Changes should work even in an anonymized view&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Motivations ==&lt;br /&gt;
&lt;br /&gt;
1. Enable users to clearly tell which reviews are done by them, and which reviews are done for them.&lt;br /&gt;
&lt;br /&gt;
2. Code should be generic so it can be used for different types of heat grids as well.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Control Flow to access the concerned screens ==&lt;br /&gt;
'''1. For instructor (Log in as an instructor):-'''&lt;br /&gt;
&lt;br /&gt;
Screen after logging in by the instructor&lt;br /&gt;
[[File:ss1.png |border|1000px|center]]&lt;br /&gt;
Got to assignments on the Manage menu &lt;br /&gt;
[[File:ss2.png |border|1000px|center]]&lt;br /&gt;
Go to assignments&lt;br /&gt;
[[File:ss3.png |border|1000px|center]]&lt;br /&gt;
Go to submissions for any assignment&lt;br /&gt;
[[File:ss4a.png |border|1000px|center]]&lt;br /&gt;
Go to Assign Grade&lt;br /&gt;
[[File:ss5a.png |border|1000px|center]]&lt;br /&gt;
You will land on the page where the changes are made and can be reviewed&lt;br /&gt;
[[File:ss7a.png |border|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
'''2. Student:- (Instructor impersonating a student)'''&lt;br /&gt;
&lt;br /&gt;
After landing on the assignments page, select any student from an assignment as shown below&lt;br /&gt;
[[File:ss6a.png |border|1000px|center]]&lt;br /&gt;
Go to/Select any assignment&lt;br /&gt;
[[File:ss9a.png |border|1000px|center]]&lt;br /&gt;
Go to your scores&lt;br /&gt;
[[File:ss10a.png |border|1000px|center]]&lt;br /&gt;
You will land on the page where the changes are made and can be reviewed&lt;br /&gt;
[[File:ss11a.png |border|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
== Old Status of the application ==&lt;br /&gt;
&lt;br /&gt;
'''1. Instructor's view of teammate review''': This is the current screen given to the instructor. Here we see that the instructor can not determine who has given which review to which student in a team.&lt;br /&gt;
&lt;br /&gt;
[[File:Instructor-view-1.png|border| 700px |center|alt=The proposed expanded student display.|The proposed expanded student display.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2. Student's view of teammate review''': Currently, a student is not able to see what grades were given by their teammates. We need to implement that functionality so that the student is able to view those grades.&lt;br /&gt;
&lt;br /&gt;
[[File:Student-view-2.png|border| 700px |center|alt=The current instructor view.|The current review display for instructors.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Error in existing UI for student''': In the existing UI for a student, the highlighted block should not be rendered. This part of the screen is meant for the instructors/TAs. &lt;br /&gt;
&lt;br /&gt;
[[File:Wrong render for student.png|border|700px|center|alt=Existing UI for student|Existing UI for student.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Proposed changes ==&lt;br /&gt;
&lt;br /&gt;
''' 1) Proposed UI for instructor ''': The instructor is able to see the score for all teammates. In the existing code, only one teammate's scores are being shown. But, we are planning to change the way the (VmQuestionResponse array is populated)[https://github.com/expertiza/expertiza/blob/master/app/controllers/grades_controller.rb#L114], so that the scores for all teammates are appended to it so it correctly shows what should have already been shown in this screen for the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Proposed_screen.png|border|700px|center|alt=Proposed UI for instructor|Proposed UI for instructor.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: When a student visits this screen, they will only be shown the reviews received by them, assuming the instructor has allowed visibility of teammate reviews to students.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' 2) Show detailed review for a particular question''': The instructor can see detailed review given to a student by their teammates by clicking on a particular question number in the table.&lt;br /&gt;
&lt;br /&gt;
[[File:ss12a.png|border|700px|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' 3) Show teammate review to student UI ''': The existing code doesn't render a student's teammate review scores at all. We are planning to render the scores to a student (as shown below) when they visit this screen. However, the visibility of this screen is contingent on whether the instructor has allowed visibility of the teammate review screen to students. If the instructor has disabled this feature, then the heatgrid will not be displayed at all.&lt;br /&gt;
&lt;br /&gt;
[[File:UI_for_student.png|border|700px|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== User Stories ==&lt;br /&gt;
&lt;br /&gt;
1. As an instructor, I can view what reviews one teammate has given to other teammates.&lt;br /&gt;
&lt;br /&gt;
2. As a student, I can view what reviews my teammates have given to me.&lt;br /&gt;
&lt;br /&gt;
3. As an instructor, I can choose if I want to see all student's teammates reviews together or one by one.&lt;br /&gt;
&lt;br /&gt;
4. As a student, if I am also a TA for another subject, I should not be able to see an instructor's view to the view_team page.&lt;br /&gt;
&lt;br /&gt;
5. As an instructor, I should be able to see the name of the reviewers for the reviews to a particular student.&lt;br /&gt;
&lt;br /&gt;
== UML diagram for the system ==  &lt;br /&gt;
&lt;br /&gt;
[[File:vie_team_use_case.png|border|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Changes to the models ==&lt;br /&gt;
&lt;br /&gt;
1. Added new instance variable and method to the class VmQuestionResponseScoreCell. The reviewer_id method is a helper method that retrieves the ID for the reviewer who created this response. &lt;br /&gt;
[[File:cd1.png |border|400px|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Added two new methods to VmQuestionResponse class.The reviewee_id method is a helper method within the VmQuestionReponse model to retrieve the `reviewee_id` for a heatgrid. The reviewee_name method is a helper method within the VmQuestionReponse model to retrieve the name of the student who is being reviewed for a heatgrid. This method uses the functionality to anonymize the name when we are in anonymized view. &lt;br /&gt;
&lt;br /&gt;
[[File:cd2.png |border|400px|center]]&lt;br /&gt;
&lt;br /&gt;
== Explanation of fixes ==&lt;br /&gt;
&lt;br /&gt;
The below diagram illustrates the proposed code change for showing all team members with the teammate review data to an instructor. The existing code only iterated on the `Participant` whose ID is present in the URL of the page. To fix this, we will iterate over all teammates of the given participant so that all teammate reviews for all team members are shown to the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Logic e2165.png|border|center|alt=Flow diagram of proposed changes for showing team review data to instructor]]&lt;br /&gt;
&lt;br /&gt;
===Changes made to the code are shown below. Every change is shown and explained separately===&lt;br /&gt;
&lt;br /&gt;
====A. Added the following to app/assets/stylesheets/grades.scss:====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    .teammate_table.hidden {&lt;br /&gt;
      display: none;&lt;br /&gt;
      }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====B. In app/controllers/grades_controller.rb: ====&lt;br /&gt;
&lt;br /&gt;
'''B.1:'''&lt;br /&gt;
&lt;br /&gt;
Old code: The existing code does not differentiate when adding a view model for the TeammateReview questionnaire&lt;br /&gt;
  questionnaires.each do |questionnaire|&lt;br /&gt;
     ...&lt;br /&gt;
     @vmlist &amp;lt;&amp;lt; populate_view_model(questionnaire)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
New code: Since the current page URL contains an ID for the participant, from which we get an assignment, which gives us a list of questionnaires, we need to iterate all participants for a `TeammateReveiwQuestionnaire` questionnaire, so that we get the heatgrid view models for all members of a team.&lt;br /&gt;
  questionnaires.each do |questionnaire|&lt;br /&gt;
     ...&lt;br /&gt;
     if questionnaire.type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
        # as teammate review will be different for each participant&lt;br /&gt;
        # we need to create a separate table for each teammate&lt;br /&gt;
        @participant.team.participants.each do |team_participant|&lt;br /&gt;
          @vmlist &amp;lt;&amp;lt; populate_view_model(team_participant, questionnaire, @team)&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        # only one participant needs iterating, as apart from teammatereview&lt;br /&gt;
        # all other reviews are at &amp;quot;team&amp;quot; level&lt;br /&gt;
        @vmlist &amp;lt;&amp;lt; populate_view_model(@participant, questionnaire, @team)&lt;br /&gt;
      end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
'''B.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code: This code uses @participant as an instance variable, but this structure will not work as we need to call this ViewModel with multiple participants when iterating for a teammate review questionnaire.&lt;br /&gt;
    def populate_view_model(questionnaire)&lt;br /&gt;
      vm = VmQuestionResponse.new(questionnaire, @assignment, @round)&lt;br /&gt;
      vmquestions = questionnaire.questions&lt;br /&gt;
      vm.add_questions(vmquestions)&lt;br /&gt;
      vm.add_team_members(@team)&lt;br /&gt;
      vm.add_reviews(@participant, @team, @assignment.vary_by_round)&lt;br /&gt;
      vm.number_of_comments_greater_than_10_words&lt;br /&gt;
      vm &lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
New code: We need to call this function with a separate participant in each invocation due to our change for TeammateReviewQuestionnaire, hence it makes sense to make `participant` as an argument to this function. Similarly, as `team` is a closely related model to `participant`, we are passing it as an argument, to keep this function as &amp;quot;pure&amp;quot; as possible.&lt;br /&gt;
    def populate_view_model(participant, questionnaire, team)&lt;br /&gt;
      ...&lt;br /&gt;
      vm.add_team_members(team)&lt;br /&gt;
      vm.add_reviews(participant, team, @assignment.vary_by_round)&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
====C. In app/models/vm_question_response.rb:====&lt;br /&gt;
&lt;br /&gt;
'''C.1: '''Added the reviewee_id method: Created a helper method within the VmQuestionReponse model to retrieve the `reviewee_id` for a heatgrid&lt;br /&gt;
&lt;br /&gt;
    def reviewee_id&lt;br /&gt;
      @participant_who_is_reviewee.user_id&lt;br /&gt;
    end &lt;br /&gt;
&lt;br /&gt;
'''C.2: '''Added the reviewee_name method: Created a helper method within the VmQuestionReponse model to retrieve the name of the student who is being reviewed for a heatgrid. This method uses the functionality to anonymize the name when we are in anonymized view.&lt;br /&gt;
&lt;br /&gt;
    def reviewee_name(ip_address = nil)&lt;br /&gt;
      part = @participant_who_is_reviewee&lt;br /&gt;
      User.find_by(id: reviewee_id).fullname(ip_address)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''C.3: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Does not keep track of the student being reviewed&lt;br /&gt;
    elsif @questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
      reviews = participant.teammate_reviews&lt;br /&gt;
      reviews.each do |review|&lt;br /&gt;
        review_mapping = TeammateReviewResponseMap.find_by(id: review.map_id)&lt;br /&gt;
        participant = Participant.find(review_mapping.reviewer_id)&lt;br /&gt;
&lt;br /&gt;
New code: Add an instance variable to keep track of the student who is being reviewed in this VmQuestionReponse&lt;br /&gt;
    elsif @questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
      reviews = participant.teammate_reviews&lt;br /&gt;
      @participant_who_is_reviewee = participant&lt;br /&gt;
      reviews.each do |review|&lt;br /&gt;
        review_mapping = TeammateReviewResponseMap.find_by(id: review.map_id)&lt;br /&gt;
        participant = Participant.find(review_mapping.reviewer_id)&lt;br /&gt;
&lt;br /&gt;
'''C.4: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing VmQuestionReponseScoreCell keeps no information about the reviewer, as it only stores the answer score&lt;br /&gt;
    row.score_row.push(VmQuestionResponseScoreCell.new(answer.answer, color_code, answer.comments, vm_tag_prompts))&lt;br /&gt;
&lt;br /&gt;
New code: Keep track of the response ID, so that we can retrieve the user ID for the reviewer in the model to use in the view file.&lt;br /&gt;
    &lt;br /&gt;
    row.score_row.push(VmQuestionResponseScoreCell.new(answer.answer, color_code, answer.comments, vm_tag_prompts, answer.response_id))&lt;br /&gt;
&lt;br /&gt;
====D. In app/models/vm_question_response_score_cell.rb:====&lt;br /&gt;
&lt;br /&gt;
'''D.1: '''In the method initialize of class VmQuestionResponseScoreCell&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't keep track of the response id&lt;br /&gt;
    def initialize(score_value, color_code, comments, vmprompts = nil)&lt;br /&gt;
      @score_value = score_value&lt;br /&gt;
      @color_code = color_code&lt;br /&gt;
      @comment = comments&lt;br /&gt;
      @vm_prompts = vmprompts&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
New code: We added an instance variable to keep track of response_id&lt;br /&gt;
&lt;br /&gt;
    def initialize(score_value, color_code, comments, vmprompts = nil, response_id)&lt;br /&gt;
      ...&lt;br /&gt;
      @response_id = response_id&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''D.2: '''Added a method reviewer_id to the class VmQuestionResponseScoreCell: This helper method retrieves the ID for the reviewer who created this response.&lt;br /&gt;
&lt;br /&gt;
    def reviewer_id&lt;br /&gt;
      resp = Response.find(@response_id)&lt;br /&gt;
      map = ResponseMap.find(resp.map_id)&lt;br /&gt;
      map.reviewer_id&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
====E. In app/views/grades/_add_icon_to_name.html.erb:====&lt;br /&gt;
&lt;br /&gt;
'''E.1 '''Added the following code to the file: Write the code to generate the review text only once to reduce WET code&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;%# Determine the content of the reviewed by text %&amp;gt;&lt;br /&gt;
    &amp;lt;% review_text = &amp;quot;&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% if @current_role_name.eql?'Student' or questionnaire_type != &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
      &amp;lt;%# Use Review {{index}} format for student view, and when questionnaire_type is not teammatereview %&amp;gt;&lt;br /&gt;
      &amp;lt;% review_text = &amp;quot;Review #{i + 1}&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;% resp = Response.find(review.id) %&amp;gt;&lt;br /&gt;
      &amp;lt;% map = ResponseMap.find(resp.map_id) %&amp;gt;&lt;br /&gt;
      &amp;lt;% reviewer_id = map.reviewer_id %&amp;gt;&lt;br /&gt;
      &amp;lt;% fullname = Participant.find_by(id: reviewer_id).fullname(session[:ip]) %&amp;gt;&lt;br /&gt;
      &amp;lt;% review_text = &amp;quot;Review by #{fullname}&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% end%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''E.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code is very unreadable as it's not indented, and written in a single line with 359 characters, which breaks the ruby style guide rules&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;% if review.done_by_staff_participant? %&amp;gt;&lt;br /&gt;
      &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt; &amp;lt;img data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Icon indicates this review was done by course staff&amp;quot; class=&amp;quot;img_icon&amp;quot; src=&amp;quot;/assets/staff.png&amp;quot;&amp;gt; &amp;lt;a target=&amp;quot;_blank&amp;quot; href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Click to see details&amp;quot;&amp;gt;&amp;lt;%= &amp;quot;Review &amp;quot; + i.to_s  %&amp;gt;&amp;lt;/a&amp;gt; &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt; &amp;lt;a target=&amp;quot;_blank&amp;quot; href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Click to see details&amp;quot;&amp;gt;&amp;lt;%= &amp;quot;Review &amp;quot; + i.to_s %&amp;gt;&amp;lt;/a&amp;gt;  &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Correctly indented and removes WET repetition of code blocks and makes the resulting code DRYer&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;% if review.done_by_staff_participant? %&amp;gt;&lt;br /&gt;
      &amp;lt;img&lt;br /&gt;
      data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
      data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
      title=&amp;quot;Icon indicates this review was done by course staff&amp;quot; class=&amp;quot;img_icon&amp;quot;&lt;br /&gt;
      src=&amp;quot;/assets/staff.png&amp;quot;&lt;br /&gt;
      &amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;a&lt;br /&gt;
      target=&amp;quot;_blank&amp;quot;&lt;br /&gt;
      href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;&lt;br /&gt;
      data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
      data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
      title=&amp;quot;Click to see details&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;%= review_text %&amp;gt;&lt;br /&gt;
    &amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====F.In app/views/grades/view_team.html.erb:====&lt;br /&gt;
&lt;br /&gt;
'''F.1: '''Added function teammateSelectOnChange: This function toggles the visibility for the teammate heatgrids when the instructor changes the dropdown&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  function teammateSelectOnChange(selectNode) {&lt;br /&gt;
      const revieweeIdToShow= selectNode.value;&lt;br /&gt;
      const tableSelector = &amp;quot;.teammate_table&amp;quot;;&lt;br /&gt;
      if(revieweeIdToShow == &amp;quot;all&amp;quot;) {&lt;br /&gt;
        document.querySelectorAll(tableSelector).forEach((tableNode) =&amp;gt; {&lt;br /&gt;
          tableNode.classList.remove(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
        });&lt;br /&gt;
        return;&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
    document.querySelectorAll(tableSelector).forEach((tableNode) =&amp;gt; {&lt;br /&gt;
      const tableRevieweeId = tableNode.getAttribute('data-reviewee_id');&lt;br /&gt;
      if(tableRevieweeId == revieweeIdToShow) {&lt;br /&gt;
        tableNode.classList.remove(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
      } else {&lt;br /&gt;
        tableNode.classList.add(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
      }&lt;br /&gt;
      });&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't render TeammateReviewQuestionnaire&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;% @vmlist.each do |vm| %&amp;gt;&lt;br /&gt;
        &amp;lt;% if (vm.questionnaire_display_type == &amp;quot;Metareview&amp;quot; or vm.questionnaire_display_type == &amp;quot;Author Feedback&amp;quot; or vm.questionnaire_display_type == &amp;quot;Teammate Review&amp;quot;) and @current_role_name.eql?'Student' %&amp;gt;&lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
        &amp;lt;% if vm.list_of_reviewers.length &amp;gt; 0 %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Use a boolean to render a dropdown (that contains the students' IDs and names) just before the first TeammateReviewQuestionnaire, and unset that boolean so we only render 1 table. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;%# This boolean is used to render a dropdown just before the first teammate review heat grid %&amp;gt;&lt;br /&gt;
&amp;lt;% first_teammate_review_appeared = false %&amp;gt;&lt;br /&gt;
&amp;lt;% @vmlist.each do |vm| %&amp;gt;&lt;br /&gt;
     &amp;lt;% if (not @current_role_name.eql?'Student' and&lt;br /&gt;
        not first_teammate_review_appeared and&lt;br /&gt;
        vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; &lt;br /&gt;
      ) %&amp;gt;&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        &amp;lt;select onchange=&amp;quot;teammateSelectOnChange(this)&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;all&amp;quot;&amp;gt;All&amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;% @vmlist.select { |tm_vm| tm_vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; }.each do |tm_vm| %&amp;gt;&lt;br /&gt;
            &amp;lt;option value=&amp;quot;&amp;lt;%= tm_vm.reviewee_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;%= tm_vm.reviewee_name(session[:ip]) %&amp;gt;&lt;br /&gt;
            &amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
        &amp;lt;/select&amp;gt;&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;% first_teammate_review_appeared = true %&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Add conditions which check for the truthiness of ```@assignment.show_teammate_reviews``` and if the current user is a student to decide whether to render the table or not.  Since the existing code checks truthiness for the cases for which NOT to render a table, we have followed the existing style of the code.&lt;br /&gt;
&lt;br /&gt;
1) If type of view model is teammate review questionnaire, and current role is student, and if @assignment.show_teammate_reviews is false, then we don't render anything&lt;br /&gt;
2) If type of view model is teammate review questionnaire, and current role is student, but @assignment.show_teammate_reviews is true, then we don't render anything if the current reviewer_id is different to the currently logged in user.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;% if (vm.questionnaire_display_type == &amp;quot;Metareview&amp;quot; or vm.questionnaire_display_type == &amp;quot;Author Feedback&amp;quot;) and @current_role_name.eql?'Student' %&amp;gt;&lt;br /&gt;
    &amp;lt;% elsif (&lt;br /&gt;
      vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; and&lt;br /&gt;
      @current_role_name.eql?'Student' and&lt;br /&gt;
      !@assignment.show_teammate_reviews&lt;br /&gt;
      ) %&amp;gt;&lt;br /&gt;
    &amp;lt;% elsif (&lt;br /&gt;
      vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; and &lt;br /&gt;
      @current_role_name.eql?'Student' and&lt;br /&gt;
      @assignment.show_teammate_reviews and current_user.id != vm.reviewee_id&lt;br /&gt;
      )%&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Finally, add a CSS class and a `data-reviewee_id` to keep track of the heatgrids when toggling visibility.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
        &amp;lt;% if vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
          &amp;lt;div class=&amp;quot;teammate_table&amp;quot; data-reviewee_id=&amp;quot;&amp;lt;%= vm.reviewee_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
        &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.3  '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't print the teammate who is being reviewed.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
          &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
            &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: If TeammteReviewQuestionnaire is used, then use the `:reviewee_name` method for VmQuestionResponse model to print the name of the student who is being reviewed.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
          &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
            &amp;lt;% elsif vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (For: &amp;lt;%= vm.reviewee_name(session[:ip]) %&amp;gt;)&lt;br /&gt;
            &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.4 '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't inform the partial about the type of review being done&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_reviews.each do |review| %&amp;gt;&lt;br /&gt;
              &amp;lt;!-- instructors (or higher level users) see reviewer name, students see anonymized string --&amp;gt;&lt;br /&gt;
              &amp;lt;% if (['Student'].include? @current_role_name) &amp;amp;&amp;amp; @assignment.is_anonymous%&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i} %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                  &amp;lt;% user_name = User.find(Participant.find(ResponseMap.find(Response.find(review.id).map_id).reviewer_id).user_id).fullname(session[:ip]).to_s %&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i} %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% i += 1 %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
New code: Passes the type of review being done to the partial, so it can decide on how to render the review title. Note: This code seems to use repetition, but since the conditional used here are accessing `Anonymous` assignments and checking for user roles, we have not modified this code, as it is not directly related to our scope.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_reviews.each do |review| %&amp;gt;&lt;br /&gt;
              &amp;lt;!-- instructors (or higher level users) see reviewer name, students see anonymized string --&amp;gt;&lt;br /&gt;
              &amp;lt;% if (['Student'].include? @current_role_name) &amp;amp;&amp;amp; @assignment.is_anonymous%&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i, questionnaire_type: vm.questionnaire_type } %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                &amp;lt;% user_name = User.find(Participant.find(ResponseMap.find(Response.find(review.id).map_id).reviewer_id).user_id).fullname(session[:ip]).to_s %&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i, questionnaire_type: vm.questionnaire_type } %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% i += 1 %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Old code: Contains a `metrics-1` column&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-true&amp;quot; align=&amp;quot;right&amp;quot; &amp;gt;&lt;br /&gt;
            Avg&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;span  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;A count of comments, for the respective question, which have word count &amp;gt; 10. The purpose of this metric is to represent how many comments for the question are of a substantial length to provide quality feedback.&amp;quot;&amp;gt;metric-1&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/thead&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
New code: As per discussion with mentor, this column has been removed in our PR.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-true&amp;quot; align=&amp;quot;right&amp;quot; &amp;gt;&lt;br /&gt;
            Avg&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/thead&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.5 '''&lt;br /&gt;
&lt;br /&gt;
Old code: It creates the ID inline in multiple places, so if we decide to change the ID generation logic, we need to modify it in multiple places. (which happened when we started rendering multiple tables for each teammate).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_rows.each do |row| %&amp;gt;&lt;br /&gt;
            &amp;lt;!-- notice the data-target. because we're toggling via looped code, we need to dynamically generate the identifier. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr data-toggle=&amp;quot;collapse&amp;quot; class=&amp;quot;accordion-toggle&amp;quot; data-target=&amp;quot;#hid&amp;lt;%= row.question_id.to_s + vm.round.to_s %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Generate the unique HTML ID once, in a readable manner once. And conditionally make it more unique, if it is a TeammateReviewQuestionnaire, since jQuery code requires these IDs to be unique amongst different tables. If we don't make it more unique, then clicking on one teammate review table will toggle the table visibility for the first table. To prevent this &amp;quot;clashing&amp;quot;, we need to make these IDs more unique for a TeammateReviewQuestionnaire.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_rows.each do |row| %&amp;gt;&lt;br /&gt;
            &amp;lt;% target_id = &amp;quot;hid__#{row.question_id}__#{vm.round}&amp;quot; %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
              &amp;lt;%# Since we render different heatgrids with the same questions for each&lt;br /&gt;
              teammember, we need to distinguish the ID, based on the user for whom,&lt;br /&gt;
              the reviews have been created. %&amp;gt;&lt;br /&gt;
              &amp;lt;% target_id += &amp;quot;__#{vm.reviewee_id}&amp;quot; %&amp;gt;&lt;br /&gt;
            &amp;lt;% end%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;!-- notice the data-target. because we're toggling via looped code, we need to dynamically generate the identifier. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr data-toggle=&amp;quot;collapse&amp;quot; class=&amp;quot;accordion-toggle&amp;quot; data-target=&amp;quot;&amp;lt;%= &amp;quot;#&amp;quot; + target_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Old code: Written on a single line crossing 80 characters on a single line&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
              &amp;lt;% row.score_row.each do |score| %&amp;gt;&lt;br /&gt;
                  &amp;lt;% score_comment = score.comment.nil? ? '' : score.comment %&amp;gt; &amp;lt;!-- changing nil to null string to avoid Null Pointer Exception --&amp;gt;&lt;br /&gt;
                  &amp;lt;td class=&amp;quot;&amp;lt;%= score.color_code %&amp;gt;&amp;quot; align=&amp;quot;center&amp;quot; data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= strip_tags(score.comment).html_safe%&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;&amp;lt;%=  underlined?(score) %&amp;gt;&amp;quot;&amp;gt;&amp;lt;%= score.score_value.to_s %&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
                  &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
New code: Make code more readable by indenting it and splitting it over multiple lines&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
              &amp;lt;!-- actual cells with scores and colored background. --&amp;gt;&lt;br /&gt;
              &amp;lt;% row.score_row.each do |score| %&amp;gt;&lt;br /&gt;
                  &amp;lt;% score_comment = score.comment.nil? ? '' : score.comment %&amp;gt;&lt;br /&gt;
                  &amp;lt;!-- changing nil to null string to avoid Null Pointer Exception --&amp;gt;&lt;br /&gt;
                  &amp;lt;td class=&amp;quot;&amp;lt;%= score.color_code %&amp;gt;&amp;quot; align=&amp;quot;center&amp;quot; data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= strip_tags(score.comment).html_safe%&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;&amp;lt;%=  underlined?(score) %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                      &amp;lt;%= score.score_value.to_s %&amp;gt;&lt;br /&gt;
                    &amp;lt;/span&amp;gt;&lt;br /&gt;
                  &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.6 '''Removed the following code as it corresponds to the deleted column&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 &amp;lt;td  class = 'cf' align=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;%= row.countofcomments.to_s %&amp;gt;&lt;br /&gt;
              &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.7 '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code just unconditionally prints the text &amp;quot;Review&amp;quot; followed by an index.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                    &amp;lt;% for index in 0 .. row.score_row.length - 1 %&amp;gt;&lt;br /&gt;
                        &amp;lt;tr&amp;gt;&lt;br /&gt;
                          &amp;lt;td&amp;gt;Review &amp;lt;%=index + 1%&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Conditionally change the review text that is displayed based on the type of review and the access level of the user&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                    &amp;lt;% for index in 0 .. row.score_row.length - 1 %&amp;gt;&lt;br /&gt;
                        &amp;lt;tr&amp;gt;&lt;br /&gt;
                          &amp;lt;% if @current_role_name.eql?'Student' or vm.questionnaire_type != &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                            &amp;lt;%# Use Review {{index}} format for student view, and&lt;br /&gt;
                            when questionnaire_type is not teammatereview %&amp;gt;&lt;br /&gt;
                            &amp;lt;td&amp;gt;Review &amp;lt;%=index + 1%&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
                          &amp;lt;% else %&amp;gt;&lt;br /&gt;
                            &amp;lt;td&amp;gt;&lt;br /&gt;
                              &amp;lt;% reviewer_id = row.score_row[index].reviewer_id %&amp;gt;&lt;br /&gt;
                              &amp;lt;% fullname = Participant.find_by(id: reviewer_id).fullname(session[:ip]) %&amp;gt;&lt;br /&gt;
                              Review by &amp;lt;%= fullname %&amp;gt;&lt;br /&gt;
                            &amp;lt;/td&amp;gt;&lt;br /&gt;
                          &amp;lt;% end%&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====G. In spec/controllers/grades_controller_spec.rb:====&lt;br /&gt;
&lt;br /&gt;
'''G.1 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
before(:each) do&lt;br /&gt;
  allow(AssignmentParticipant).to receive(:find).with('1').and_return(participant)&lt;br /&gt;
  allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
  stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
@@ -91,29 +90,106 @@&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
before(:each) do&lt;br /&gt;
  allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
  stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
@@ -91,29 +90,106 @@&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''G.2 '''Remove xdescribe '#view_team' and change describe '#view_team' as follows.&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#view_team' do&lt;br /&gt;
render_views&lt;br /&gt;
context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
  it 'renders grades#view_team page' do&lt;br /&gt;
    allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
    allow(AssignmentQuestionnaire).to receive(:find_by).with(assignment_id: 1, questionnaire_id: 1).and_return(assignment_questionnaire)&lt;br /&gt;
    allow(AssignmentQuestionnaire).to receive(:where).with(any_args).and_return([assignment_questionnaire])&lt;br /&gt;
    allow(assignment).to receive(:late_policy_id).and_return(false)&lt;br /&gt;
    allow(assignment).to receive(:calculate_penalty).and_return(false)&lt;br /&gt;
    allow(assignment).to receive(:compute_total_score).with(any_args).and_return(100)&lt;br /&gt;
    allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
    allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
    params = {id: 1}&lt;br /&gt;
    allow(TaMapping).to receive(:exists?).with(ta_id: 1, course_id: 1).and_return(true)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#view_team' do&lt;br /&gt;
render_views&lt;br /&gt;
&lt;br /&gt;
# All stubs and factories are instantiated within this scope so as to not &lt;br /&gt;
# clash with other broken test.&lt;br /&gt;
# The names of the factories created for testing view_team&lt;br /&gt;
# have `_vt` suffix ```where necessary``` to differentiate them from &lt;br /&gt;
# the above declared factories&lt;br /&gt;
&lt;br /&gt;
let(:student1_vt) { create(:student, name: &amp;quot;barry&amp;quot;, id: 12) }&lt;br /&gt;
let(:student2_vt) { create(:student, name: &amp;quot;iris&amp;quot;, id: 13) }&lt;br /&gt;
&lt;br /&gt;
let(:tm_questionnaire) {&lt;br /&gt;
  build(&lt;br /&gt;
    :teammate_review_questionnaire,&lt;br /&gt;
    id: 12,&lt;br /&gt;
    questions: [question],&lt;br /&gt;
    max_question_score: 5&lt;br /&gt;
  )&lt;br /&gt;
}&lt;br /&gt;
let(:assignment_vt) {&lt;br /&gt;
  create(:assignment, id: 6, max_team_size: 2,&lt;br /&gt;
  questionnaires: [tm_questionnaire])&lt;br /&gt;
}&lt;br /&gt;
let(:assignment_questionnaire_vt) {&lt;br /&gt;
  create(:tm_assignment_questionnaire, id: 12, used_in_round: nil,&lt;br /&gt;
  assignment: assignment_vt, questionnaire: tm_questionnaire) }&lt;br /&gt;
let(:team_vt) { create(:assignment_team, id: 12,&lt;br /&gt;
assignment: assignment_vt) }&lt;br /&gt;
let(:participant_vt) { create(:participant, id: 12,&lt;br /&gt;
  assignment: assignment_vt, user_id: student1_vt.id) }&lt;br /&gt;
let(:participant2_vt) { create(:participant, id: 13,&lt;br /&gt;
  assignment: assignment_vt, user_id: student2_vt.id) }&lt;br /&gt;
&lt;br /&gt;
before(:each) do&lt;br /&gt;
  # Need to stub this method so the factory instance with&lt;br /&gt;
  # the stubbed :team method is returned by :find&lt;br /&gt;
  # instead of a separate instance with the same data&lt;br /&gt;
  allow(AssignmentParticipant)&lt;br /&gt;
    .to receive(:find)&lt;br /&gt;
    .with(participant_vt.id.to_s)&lt;br /&gt;
    .and_return(participant_vt)&lt;br /&gt;
  allow(participant_vt).to receive(:team).and_return(team_vt)&lt;br /&gt;
  allow(team_vt).to receive(:participants).and_return([participant_vt, participant2_vt])&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:find_by)&lt;br /&gt;
    .with(assignment_id: assignment_vt.id, questionnaire_id: tm_questionnaire.id)&lt;br /&gt;
    .and_return(assignment_questionnaire_vt)&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:find_by)&lt;br /&gt;
    .with(assignment_id: assignment.id, questionnaire_id: review_questionnaire.id)&lt;br /&gt;
    .and_return(assignment_questionnaire_vt)&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:where)&lt;br /&gt;
    .with(any_args)&lt;br /&gt;
    .and_return([assignment_questionnaire_vt])&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:late_policy_id)&lt;br /&gt;
    .and_return(false)&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:calculate_penalty)&lt;br /&gt;
    .and_return(false)&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:compute_total_score)&lt;br /&gt;
    .with(any_args)&lt;br /&gt;
    .and_return(100)&lt;br /&gt;
  allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
  allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
 it 'renders grades#view_team page' do&lt;br /&gt;
  params = {id: participant_vt.id}&lt;br /&gt;
  get :view_team, params&lt;br /&gt;
  expect(response).to render_template(:view_team)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is opened by student' do&lt;br /&gt;
  it 'dropdown is not rendered' do&lt;br /&gt;
    session = { user: student1_vt }&lt;br /&gt;
    params = {id: participant_vt.id}&lt;br /&gt;
    stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
    get :view_team, params&lt;br /&gt;
    expect(response.body).to_not have_selector('select')&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is opened by instructor' do&lt;br /&gt;
  it 'dropdown is rendered' do&lt;br /&gt;
    session = { user: instructor }&lt;br /&gt;
    params = {id: participant_vt.id}&lt;br /&gt;
    get :view_team, params&lt;br /&gt;
    expect(response.body).to have_selector('select')&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
  it 'renders grades#view_team page' do&lt;br /&gt;
    params = { id: participant_vt.id }&lt;br /&gt;
    allow(TaMapping).to receive(:exists?).with(ta_id: participant_vt.user_id, course_id: 1).and_return(true)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====H. In spec/factories/factories.rb:====&lt;br /&gt;
&lt;br /&gt;
'''H.1 '''Add the following factory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
factory :teammate_review_questionnaire, class: TeammateReviewQuestionnaire do&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''H.2 '''Add another factory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
factory :tm_assignment_questionnaire, class: AssignmentQuestionnaire do&lt;br /&gt;
  user_id 1&lt;br /&gt;
  questionnaire { association(:teammate_review_questionnaire) }&lt;br /&gt;
  questionnaire_weight 100&lt;br /&gt;
  used_in_round nil&lt;br /&gt;
  topic_id nil&lt;br /&gt;
  dropdown 1&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
The tests written as a part of this project can be run by running the following command on terminal:&lt;br /&gt;
&lt;br /&gt;
1. rspec ./spec/controllers/grades_controller_spec.rb  -e &amp;quot;#view_team&amp;quot;&lt;br /&gt;
&lt;br /&gt;
2. rspec .vm_question_response_score_cell_spec.rb  -e &amp;quot;#reviewer_id&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''OLD STATUS'''&lt;br /&gt;
&lt;br /&gt;
1. Earlier, the tests contained an xdescribe test to check if the view_team page is rendered correctly. However, this test was being skipped as this was an xdescribe segment. There was another test for when the view_team page is accessed by a student who is also a TA for another course. This can be checked [https://github.com/expertiza/expertiza/blob/beta/spec/controllers/grades_controller_spec.rb here].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 xdescribe '#view_team' do&lt;br /&gt;
    it 'renders grades#view_team page' do&lt;br /&gt;
      allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
      params = {id: 1}&lt;br /&gt;
      get :view_team, params&lt;br /&gt;
      expect(response).to render_template(:view_team)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#view_team' do&lt;br /&gt;
    render_views&lt;br /&gt;
    context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
      it 'renders grades#view_team page' do&lt;br /&gt;
        allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
        allow(AssignmentQuestionnaire).to receive(:find_by).with(assignment_id: 1, questionnaire_id: 1).and_return(assignment_questionnaire)&lt;br /&gt;
        allow(AssignmentQuestionnaire).to receive(:where).with(any_args).and_return([assignment_questionnaire])&lt;br /&gt;
        allow(assignment).to receive(:late_policy_id).and_return(false)&lt;br /&gt;
        allow(assignment).to receive(:calculate_penalty).and_return(false)&lt;br /&gt;
        allow(assignment).to receive(:compute_total_score).with(any_args).and_return(100)&lt;br /&gt;
        allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
        allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
        params = {id: 1}&lt;br /&gt;
        allow(TaMapping).to receive(:exists?).with(ta_id: 1, course_id: 1).and_return(true)&lt;br /&gt;
        stub_current_user(ta, ta.role.name, ta.role)&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).not_to have_content &amp;quot;TA&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''NEW STATUS'''&lt;br /&gt;
&lt;br /&gt;
1. The view_team page is rendered correctly for a given student or an instructor. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    it 'renders grades#view_team page' do&lt;br /&gt;
      params = {id: participant_vt.id}&lt;br /&gt;
      get :view_team, params&lt;br /&gt;
      expect(response).to render_template(:view_team)&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. When students access then the view_team page, the dropdown to select a student's teammate reviews is not rendered on the page. The dropdown is rendered if the page is accessed by an instructor. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   context 'dropdown for selecting a teammate review' do&lt;br /&gt;
    render_views&lt;br /&gt;
      it 'is not rendered is not rendered when page is opened by student' do&lt;br /&gt;
        session = { user: student1_vt }&lt;br /&gt;
        params = {id: participant_vt.id}&lt;br /&gt;
        stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to_not have_selector('select')&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      it 'is rendered when page is opened by instructor' do&lt;br /&gt;
        session = { user: instructor }&lt;br /&gt;
        params = {id: participant_vt.id}&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to have_selector('select')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. When a student who is also a TA for another course access the view_team page, that student should be able to a student's view to the page. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
      it 'renders grades#view_team page' do&lt;br /&gt;
        params = { id: participant_vt.id }&lt;br /&gt;
        allow(TaMapping).to receive(:exists?).with(ta_id: participant_vt.user_id, course_id: 1).and_return(true)&lt;br /&gt;
        stub_current_user(ta, ta.role.name, ta.role)&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).not_to have_content &amp;quot;TA&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. If show_teammate_reviews boolean is set to False, then the student should not be able to see the teammate reviews given to him/her. An instructor can still see the teammate reviews. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when assignment(show reviews) value is unchecked' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        allow(assignment_vt).to receive(:show_teammate_reviews).and_return(false) &lt;br /&gt;
      end&lt;br /&gt;
      it 'Student cannot view his score' do&lt;br /&gt;
        session = { user: student1_vt }&lt;br /&gt;
        params = {id: participant_vt.id}&lt;br /&gt;
        stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to_not have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
        expect(response.body).to_not have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant2_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      it 'Instructor can view the student score' do        &lt;br /&gt;
        params = {id: participant_vt.id}        &lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
        expect(response.body).to have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant2_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. If show_teammate_reviews boolean is set to True, then both the student should and instructor should be able to see the teammate reviews. The student should see only the reviews received by him/her. The instructor should be able to see all student's teammate reviews. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    context 'when assignment(show reviews) value is checked' do&lt;br /&gt;
      it 'Student can view his score' do&lt;br /&gt;
        session = { user: student1_vt }&lt;br /&gt;
        params = {id: participant_vt.id}&lt;br /&gt;
        stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
        expect(response.body).to_not have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant2_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      it 'Instructor can view the student score' do        &lt;br /&gt;
        params = {id: participant_vt.id}        &lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
        expect(response.body).to have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant2_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. The reviewer id is tracked correctly to show the correct reviewer name in the teammate reviews table. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/models/vm_question_response_score_cell_spec.rb this] file &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  	describe '#reviewer_id' do&lt;br /&gt;
  		it 'returns reviewer id' do&lt;br /&gt;
			allow(ResponseMap).to receive(:find).with(1).and_return(review_response_map)&lt;br /&gt;
			allow(response).to receive(:populate_new_response).with(:review_response_map, &amp;quot;0&amp;quot;).and_return(response)&lt;br /&gt;
        	expect(response.id).to eq(1)	&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Summary of file changes ==&lt;br /&gt;
&lt;br /&gt;
The following files are modified:&lt;br /&gt;
&lt;br /&gt;
1. app/controllers/grades_controller.rb - Controller file which changed how the view model is populated&lt;br /&gt;
&lt;br /&gt;
2. app/views/grades/view_team.html.erb - View file, which  conditionally rendered the teammate name, for a teammate review heatgrid&lt;br /&gt;
&lt;br /&gt;
3. spec/controllers/grades_controller_spec.rb - For tests verifying the proposed changes&lt;br /&gt;
&lt;br /&gt;
4. app/models/vm_question_response.rb - To modify the view-model so it can tell us the name of the person being reviewed for the current heatgrid&lt;br /&gt;
&lt;br /&gt;
5. app/models/vm_question_response_score_cell.rb - &lt;br /&gt;
&lt;br /&gt;
6. app/assets/stylesheets/grades.scss - &lt;br /&gt;
&lt;br /&gt;
7. app/views/grades/_add_icon_to_name.html.erb - &lt;br /&gt;
&lt;br /&gt;
8. spec/factories/factories.rb -&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Design Patterns ==&lt;br /&gt;
&lt;br /&gt;
Existing code does not use any design patterns, apart from if-else. It uses if-else conditional statements to check what type of questionnaire is present in the viewmodel `VmQuestionResponse`, and based on that, it renders the appropriate content.&lt;br /&gt;
&lt;br /&gt;
We decided to continue with this approach since to change the present coding style, there were required many changes (refactoring) to many files which were out of the scope of the present project. To complete the project in the assigned time, we followed the if-else approach.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;https://expertiza.ncsu.edu/&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Agarg25</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141769</id>
		<title>CSC/ECE 517 Fall 2021 - E2165. Fix teammate-review view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141769"/>
		<updated>2021-11-28T19:44:16Z</updated>

		<summary type="html">&lt;p&gt;Agarg25: /* Changes to the models */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Introduction ==&lt;br /&gt;
&lt;br /&gt;
Dr. Edward Gehringer (instructor), Parimal Mehta (mentor)&lt;br /&gt;
&lt;br /&gt;
1. Anjali Garg (unity ID : agarg25)&lt;br /&gt;
&lt;br /&gt;
2. Arvasu Chikara (unity ID: achikar2)&lt;br /&gt;
&lt;br /&gt;
3. Lalit Bangad (unity ID: llbangad)&lt;br /&gt;
&lt;br /&gt;
4. Vinay Deshmukh (unity ID: vdeshmu)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Problems to be addressed ==&lt;br /&gt;
&lt;br /&gt;
After a project is submitted and reviewed, both the team members (students) and instructors should be able to view the teammate reviews. Students should be able to view the reviews by going to a particular assignment's -&amp;gt; your scores, at the bottom of the page. An instructor can view the teammate reviews by going to assignments -&amp;gt; assignment -&amp;gt; particular team's submission -&amp;gt; view submission -&amp;gt; assign grades -&amp;gt; view scores. &lt;br /&gt;
&lt;br /&gt;
In the case of the instructor, a single heat grid is shown whereas in the case of a team member, we cant view the scores. In the heat grid, it is not clear if the scores visible are for the reviews that the student has *written* for their teammates or the scores that the student has *received* from their teammates. Additionally, for instructors can choose from a list of the students on the team, but they have no way to tell whether the heat grid shows the reviews done *by* that student or done *for* that student.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Methodology Overview ==&lt;br /&gt;
&lt;br /&gt;
We have divided our work in the following tasks to address the above problems:&lt;br /&gt;
&lt;br /&gt;
1. Distinguish reviews done for a student by rendering separates heatgrids for each student&lt;br /&gt;
&lt;br /&gt;
2. For instructors, the table will have sections based on the students&lt;br /&gt;
&lt;br /&gt;
3. Include a checkbox on the edit assignment page that enables/disables visibility of heat grid to students&lt;br /&gt;
&lt;br /&gt;
4. Fix the average column for a table (which breaks for some reviews)&lt;br /&gt;
&lt;br /&gt;
5. Show a composite score derived from all reviews.  Make this code generalized, so other kinds of heat grid views could use it.&lt;br /&gt;
&lt;br /&gt;
6. Changes should work even in an anonymized view&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Motivations ==&lt;br /&gt;
&lt;br /&gt;
1. Enable users to clearly tell which reviews are done by them, and which reviews are done for them.&lt;br /&gt;
&lt;br /&gt;
2. Code should be generic so it can be used for different types of heat grids as well.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Control Flow to access the concerned screens ==&lt;br /&gt;
'''1. For instructor (Log in as an instructor):-'''&lt;br /&gt;
&lt;br /&gt;
Screen after logging in by the instructor&lt;br /&gt;
[[File:ss1.png |border|1000px|center]]&lt;br /&gt;
Got to assignments on the Manage menu &lt;br /&gt;
[[File:ss2.png |border|1000px|center]]&lt;br /&gt;
Go to assignments&lt;br /&gt;
[[File:ss3.png |border|1000px|center]]&lt;br /&gt;
Go to submissions for any assignment&lt;br /&gt;
[[File:ss4a.png |border|1000px|center]]&lt;br /&gt;
Go to Assign Grade&lt;br /&gt;
[[File:ss5a.png |border|1000px|center]]&lt;br /&gt;
You will land on the page where the changes are made and can be reviewed&lt;br /&gt;
[[File:ss7a.png |border|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
'''2. Student:- (Instructor impersonating a student)'''&lt;br /&gt;
&lt;br /&gt;
After landing on the assignments page, select any student from an assignment as shown below&lt;br /&gt;
[[File:ss6a.png |border|1000px|center]]&lt;br /&gt;
Go to/Select any assignment&lt;br /&gt;
[[File:ss9a.png |border|1000px|center]]&lt;br /&gt;
Go to your scores&lt;br /&gt;
[[File:ss10a.png |border|1000px|center]]&lt;br /&gt;
You will land on the page where the changes are made and can be reviewed&lt;br /&gt;
[[File:ss11a.png |border|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
== Old Status of the application ==&lt;br /&gt;
&lt;br /&gt;
'''1. Instructor's view of teammate review''': This is the current screen given to the instructor. Here we see that the instructor can not determine who has given which review to which student in a team.&lt;br /&gt;
&lt;br /&gt;
[[File:Instructor-view-1.png|border| 700px |center|alt=The proposed expanded student display.|The proposed expanded student display.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2. Student's view of teammate review''': Currently, a student is not able to see what grades were given by their teammates. We need to implement that functionality so that the student is able to view those grades.&lt;br /&gt;
&lt;br /&gt;
[[File:Student-view-2.png|border| 700px |center|alt=The current instructor view.|The current review display for instructors.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Error in existing UI for student''': In the existing UI for a student, the highlighted block should not be rendered. This part of the screen is meant for the instructors/TAs. &lt;br /&gt;
&lt;br /&gt;
[[File:Wrong render for student.png|border|700px|center|alt=Existing UI for student|Existing UI for student.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Proposed changes ==&lt;br /&gt;
&lt;br /&gt;
''' 1) Proposed UI for instructor ''': The instructor is able to see the score for all teammates. In the existing code, only one teammate's scores are being shown. But, we are planning to change the way the (VmQuestionResponse array is populated)[https://github.com/expertiza/expertiza/blob/master/app/controllers/grades_controller.rb#L114], so that the scores for all teammates are appended to it so it correctly shows what should have already been shown in this screen for the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Proposed_screen.png|border|700px|center|alt=Proposed UI for instructor|Proposed UI for instructor.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: When a student visits this screen, they will only be shown the reviews received by them, assuming the instructor has allowed visibility of teammate reviews to students.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' 2) Show detailed review for a particular question''': The instructor can see detailed review given to a student by their teammates by clicking on a particular question number in the table.&lt;br /&gt;
&lt;br /&gt;
[[File:ss12a.png|border|700px|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' 3) Show teammate review to student UI ''': The existing code doesn't render a student's teammate review scores at all. We are planning to render the scores to a student (as shown below) when they visit this screen. However, the visibility of this screen is contingent on whether the instructor has allowed visibility of the teammate review screen to students. If the instructor has disabled this feature, then the heatgrid will not be displayed at all.&lt;br /&gt;
&lt;br /&gt;
[[File:UI_for_student.png|border|700px|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== User Stories ==&lt;br /&gt;
&lt;br /&gt;
1. As an instructor, I can view what reviews one teammate has given to other teammates.&lt;br /&gt;
&lt;br /&gt;
2. As a student, I can view what reviews my teammates have given to me.&lt;br /&gt;
&lt;br /&gt;
3. As an instructor, I can choose if I want to see all student's teammates reviews together or one by one.&lt;br /&gt;
&lt;br /&gt;
4. As a student, if I am also a TA for another subject, I should not be able to see an instructor's view to the view_team page.&lt;br /&gt;
&lt;br /&gt;
5. As an instructor, I should be able to see the name of the reviewers for the reviews to a particular student.&lt;br /&gt;
&lt;br /&gt;
== UML diagram for the system ==  &lt;br /&gt;
&lt;br /&gt;
[[File:vie_team_use_case.png|border|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Changes to the models ==&lt;br /&gt;
&lt;br /&gt;
1. Added new instance variable and method to the class VmQuestionResponseScoreCell.&lt;br /&gt;
[[File:cd1.png |border|400px|center]]&lt;br /&gt;
&lt;br /&gt;
2. Added two new methods to VmQuestionResponse class.&lt;br /&gt;
[[File:cd2.png |border|400px|center]]&lt;br /&gt;
&lt;br /&gt;
== Explanation of fixes ==&lt;br /&gt;
&lt;br /&gt;
The below diagram illustrates the proposed code change for showing all team members with the teammate review data to an instructor. The existing code only iterated on the `Participant` whose ID is present in the URL of the page. To fix this, we will iterate over all teammates of the given participant so that all teammate reviews for all team members are shown to the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Logic e2165.png|border|center|alt=Flow diagram of proposed changes for showing team review data to instructor]]&lt;br /&gt;
&lt;br /&gt;
===Changes made to the code are shown below. Every change is shown and explained separately===&lt;br /&gt;
&lt;br /&gt;
====A. Added the following to app/assets/stylesheets/grades.scss:====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    .teammate_table.hidden {&lt;br /&gt;
      display: none;&lt;br /&gt;
      }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====B. In app/controllers/grades_controller.rb: ====&lt;br /&gt;
&lt;br /&gt;
'''B.1:'''&lt;br /&gt;
&lt;br /&gt;
Old code: The existing code does not differentiate when adding a view model for the TeammateReview questionnaire&lt;br /&gt;
  questionnaires.each do |questionnaire|&lt;br /&gt;
     ...&lt;br /&gt;
     @vmlist &amp;lt;&amp;lt; populate_view_model(questionnaire)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
New code: Since the current page URL contains an ID for the participant, from which we get an assignment, which gives us a list of questionnaires, we need to iterate all participants for a `TeammateReveiwQuestionnaire` questionnaire, so that we get the heatgrid view models for all members of a team.&lt;br /&gt;
  questionnaires.each do |questionnaire|&lt;br /&gt;
     ...&lt;br /&gt;
     if questionnaire.type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
        # as teammate review will be different for each participant&lt;br /&gt;
        # we need to create a separate table for each teammate&lt;br /&gt;
        @participant.team.participants.each do |team_participant|&lt;br /&gt;
          @vmlist &amp;lt;&amp;lt; populate_view_model(team_participant, questionnaire, @team)&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        # only one participant needs iterating, as apart from teammatereview&lt;br /&gt;
        # all other reviews are at &amp;quot;team&amp;quot; level&lt;br /&gt;
        @vmlist &amp;lt;&amp;lt; populate_view_model(@participant, questionnaire, @team)&lt;br /&gt;
      end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
'''B.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code: This code uses @participant as an instance variable, but this structure will not work as we need to call this ViewModel with multiple participants when iterating for a teammate review questionnaire.&lt;br /&gt;
    def populate_view_model(questionnaire)&lt;br /&gt;
      vm = VmQuestionResponse.new(questionnaire, @assignment, @round)&lt;br /&gt;
      vmquestions = questionnaire.questions&lt;br /&gt;
      vm.add_questions(vmquestions)&lt;br /&gt;
      vm.add_team_members(@team)&lt;br /&gt;
      vm.add_reviews(@participant, @team, @assignment.vary_by_round)&lt;br /&gt;
      vm.number_of_comments_greater_than_10_words&lt;br /&gt;
      vm &lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
New code: We need to call this function with a separate participant in each invocation due to our change for TeammateReviewQuestionnaire, hence it makes sense to make `participant` as an argument to this function. Similarly, as `team` is a closely related model to `participant`, we are passing it as an argument, to keep this function as &amp;quot;pure&amp;quot; as possible.&lt;br /&gt;
    def populate_view_model(participant, questionnaire, team)&lt;br /&gt;
      ...&lt;br /&gt;
      vm.add_team_members(team)&lt;br /&gt;
      vm.add_reviews(participant, team, @assignment.vary_by_round)&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
====C. In app/models/vm_question_response.rb:====&lt;br /&gt;
&lt;br /&gt;
'''C.1: '''Added the reviewee_id method: Created a helper method within the VmQuestionReponse model to retrieve the `reviewee_id` for a heatgrid&lt;br /&gt;
&lt;br /&gt;
    def reviewee_id&lt;br /&gt;
      @participant_who_is_reviewee.user_id&lt;br /&gt;
    end &lt;br /&gt;
&lt;br /&gt;
'''C.2: '''Added the reviewee_name method: Created a helper method within the VmQuestionReponse model to retrieve the name of the student who is being reviewed for a heatgrid. This method uses the functionality to anonymize the name when we are in anonymized view.&lt;br /&gt;
&lt;br /&gt;
    def reviewee_name(ip_address = nil)&lt;br /&gt;
      part = @participant_who_is_reviewee&lt;br /&gt;
      User.find_by(id: part.user_id).fullname(ip_address)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''C.3: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Does not keep track of the student being reviewed&lt;br /&gt;
    elsif @questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
      reviews = participant.teammate_reviews&lt;br /&gt;
      reviews.each do |review|&lt;br /&gt;
        review_mapping = TeammateReviewResponseMap.find_by(id: review.map_id)&lt;br /&gt;
        participant = Participant.find(review_mapping.reviewer_id)&lt;br /&gt;
&lt;br /&gt;
New code: Add an instance variable to keep track of the student who is being reviewed in this VmQuestionReponse&lt;br /&gt;
    elsif @questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
      reviews = participant.teammate_reviews&lt;br /&gt;
      @participant_who_is_reviewee = participant&lt;br /&gt;
      reviews.each do |review|&lt;br /&gt;
        review_mapping = TeammateReviewResponseMap.find_by(id: review.map_id)&lt;br /&gt;
        participant = Participant.find(review_mapping.reviewer_id)&lt;br /&gt;
&lt;br /&gt;
'''C.4: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing VmQuestionReponseScoreCell keeps no information about the reviewer, as it only stores the answer score&lt;br /&gt;
    row.score_row.push(VmQuestionResponseScoreCell.new(answer.answer, color_code, answer.comments, vm_tag_prompts))&lt;br /&gt;
&lt;br /&gt;
New code: Keep track of the response ID, so that we can retrieve the user ID for the reviewer in the model to use in the view file.&lt;br /&gt;
    &lt;br /&gt;
    row.score_row.push(VmQuestionResponseScoreCell.new(answer.answer, color_code, answer.comments, vm_tag_prompts, answer.response_id))&lt;br /&gt;
&lt;br /&gt;
====D. In app/models/vm_question_response_score_cell.rb:====&lt;br /&gt;
&lt;br /&gt;
'''D.1: '''In the method initialize of class VmQuestionResponseScoreCell&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't keep track of the response id&lt;br /&gt;
    def initialize(score_value, color_code, comments, vmprompts = nil)&lt;br /&gt;
      @score_value = score_value&lt;br /&gt;
      @color_code = color_code&lt;br /&gt;
      @comment = comments&lt;br /&gt;
      @vm_prompts = vmprompts&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
New code: We added an instance variable to keep track of response_id&lt;br /&gt;
&lt;br /&gt;
    def initialize(score_value, color_code, comments, vmprompts = nil, response_id)&lt;br /&gt;
      ...&lt;br /&gt;
      @response_id = response_id&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''D.2: '''Added a method reviewer_id to the class VmQuestionResponseScoreCell: This helper method retrieves the ID for the reviewer who created this response.&lt;br /&gt;
&lt;br /&gt;
    def reviewer_id&lt;br /&gt;
      resp = Response.find(@response_id)&lt;br /&gt;
      map = ResponseMap.find(resp.map_id)&lt;br /&gt;
      map.reviewer_id&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
====E. In app/views/grades/_add_icon_to_name.html.erb:====&lt;br /&gt;
&lt;br /&gt;
'''E.1 '''Added the following code to the file: Write the code to generate the review text only once to reduce WET code&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;%# Determine the content of the reviewed by text %&amp;gt;&lt;br /&gt;
    &amp;lt;% review_text = &amp;quot;&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% if @current_role_name.eql?'Student' or questionnaire_type != &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
      &amp;lt;%# Use Review {{index}} format for student view, and when questionnaire_type is not teammatereview %&amp;gt;&lt;br /&gt;
      &amp;lt;% review_text = &amp;quot;Review #{i + 1}&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;% resp = Response.find(review.id) %&amp;gt;&lt;br /&gt;
      &amp;lt;% map = ResponseMap.find(resp.map_id) %&amp;gt;&lt;br /&gt;
      &amp;lt;% reviewer_id = map.reviewer_id %&amp;gt;&lt;br /&gt;
      &amp;lt;% fullname = Participant.find_by(id: reviewer_id).fullname(session[:ip]) %&amp;gt;&lt;br /&gt;
      &amp;lt;% review_text = &amp;quot;Review by #{fullname}&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% end%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''E.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code is very unreadable as it's not indented, and written in a single line with 359 characters, which breaks the ruby style guide rules&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;% if review.done_by_staff_participant? %&amp;gt;&lt;br /&gt;
      &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt; &amp;lt;img data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Icon indicates this review was done by course staff&amp;quot; class=&amp;quot;img_icon&amp;quot; src=&amp;quot;/assets/staff.png&amp;quot;&amp;gt; &amp;lt;a target=&amp;quot;_blank&amp;quot; href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Click to see details&amp;quot;&amp;gt;&amp;lt;%= &amp;quot;Review &amp;quot; + i.to_s  %&amp;gt;&amp;lt;/a&amp;gt; &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt; &amp;lt;a target=&amp;quot;_blank&amp;quot; href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Click to see details&amp;quot;&amp;gt;&amp;lt;%= &amp;quot;Review &amp;quot; + i.to_s %&amp;gt;&amp;lt;/a&amp;gt;  &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Correctly indented and removes WET repetition of code blocks and makes the resulting code DRYer&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;% if review.done_by_staff_participant? %&amp;gt;&lt;br /&gt;
      &amp;lt;img&lt;br /&gt;
      data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
      data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
      title=&amp;quot;Icon indicates this review was done by course staff&amp;quot; class=&amp;quot;img_icon&amp;quot;&lt;br /&gt;
      src=&amp;quot;/assets/staff.png&amp;quot;&lt;br /&gt;
      &amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;a&lt;br /&gt;
      target=&amp;quot;_blank&amp;quot;&lt;br /&gt;
      href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;&lt;br /&gt;
      data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
      data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
      title=&amp;quot;Click to see details&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;%= review_text %&amp;gt;&lt;br /&gt;
    &amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====F.In app/views/grades/view_team.html.erb:====&lt;br /&gt;
&lt;br /&gt;
'''F.1: '''Added function teammateSelectOnChange: This function toggles the visibility for the teammate heatgrids when the instructor changes the dropdown&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  function teammateSelectOnChange(selectNode) {&lt;br /&gt;
      const revieweeIdToShow= selectNode.value;&lt;br /&gt;
      const tableSelector = &amp;quot;.teammate_table&amp;quot;;&lt;br /&gt;
      if(revieweeIdToShow == &amp;quot;all&amp;quot;) {&lt;br /&gt;
        document.querySelectorAll(tableSelector).forEach((tableNode) =&amp;gt; {&lt;br /&gt;
          tableNode.classList.remove(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
        });&lt;br /&gt;
        return;&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
    document.querySelectorAll(tableSelector).forEach((tableNode) =&amp;gt; {&lt;br /&gt;
      const tableRevieweeId = tableNode.getAttribute('data-reviewee_id');&lt;br /&gt;
      if(tableRevieweeId == revieweeIdToShow) {&lt;br /&gt;
        tableNode.classList.remove(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
      } else {&lt;br /&gt;
        tableNode.classList.add(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
      }&lt;br /&gt;
      });&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't render TeammateReviewQuestionnaire&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;% @vmlist.each do |vm| %&amp;gt;&lt;br /&gt;
        &amp;lt;% if (vm.questionnaire_display_type == &amp;quot;Metareview&amp;quot; or vm.questionnaire_display_type == &amp;quot;Author Feedback&amp;quot; or vm.questionnaire_display_type == &amp;quot;Teammate Review&amp;quot;) and @current_role_name.eql?'Student' %&amp;gt;&lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
        &amp;lt;% if vm.list_of_reviewers.length &amp;gt; 0 %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Use a boolean to render a dropdown (that contains the students' IDs and names) just before the first TeammateReviewQuestionnaire, and unset that boolean so we only render 1 table. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;%# This boolean is used to render a dropdown just before the first teammate review heat grid %&amp;gt;&lt;br /&gt;
&amp;lt;% first_teammate_review_appeared = false %&amp;gt;&lt;br /&gt;
&amp;lt;% @vmlist.each do |vm| %&amp;gt;&lt;br /&gt;
     &amp;lt;% if (not @current_role_name.eql?'Student' and&lt;br /&gt;
        not first_teammate_review_appeared and&lt;br /&gt;
        vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; &lt;br /&gt;
      ) %&amp;gt;&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        &amp;lt;select onchange=&amp;quot;teammateSelectOnChange(this)&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;all&amp;quot;&amp;gt;All&amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;% @vmlist.select { |tm_vm| tm_vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; }.each do |tm_vm| %&amp;gt;&lt;br /&gt;
            &amp;lt;option value=&amp;quot;&amp;lt;%= tm_vm.reviewee_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;%= tm_vm.reviewee_name(session[:ip]) %&amp;gt;&lt;br /&gt;
            &amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
        &amp;lt;/select&amp;gt;&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;% first_teammate_review_appeared = true %&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Add conditions which check for the truthiness of ```@assignment.show_teammate_reviews``` and if the current user is a student to decide whether to render the table or not.  Since the existing code checks truthiness for the cases for which NOT to render a table, we have followed the existing style of the code.&lt;br /&gt;
&lt;br /&gt;
1) If type of view model is teammate review questionnaire, and current role is student, and if @assignment.show_teammate_reviews is false, then we don't render anything&lt;br /&gt;
2) If type of view model is teammate review questionnaire, and current role is student, but @assignment.show_teammate_reviews is true, then we don't render anything if the current reviewer_id is different to the currently logged in user.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;% if (vm.questionnaire_display_type == &amp;quot;Metareview&amp;quot; or vm.questionnaire_display_type == &amp;quot;Author Feedback&amp;quot;) and @current_role_name.eql?'Student' %&amp;gt;&lt;br /&gt;
    &amp;lt;% elsif (&lt;br /&gt;
      vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; and&lt;br /&gt;
      @current_role_name.eql?'Student' and&lt;br /&gt;
      !@assignment.show_teammate_reviews&lt;br /&gt;
      ) %&amp;gt;&lt;br /&gt;
    &amp;lt;% elsif (&lt;br /&gt;
      vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; and &lt;br /&gt;
      @current_role_name.eql?'Student' and&lt;br /&gt;
      @assignment.show_teammate_reviews and current_user.id != vm.reviewee_id&lt;br /&gt;
      )%&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Finally, add a CSS class and a `data-reviewee_id` to keep track of the heatgrids when toggling visibility.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
        &amp;lt;% if vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
          &amp;lt;div class=&amp;quot;teammate_table&amp;quot; data-reviewee_id=&amp;quot;&amp;lt;%= vm.reviewee_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
        &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.3  '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't print the teammate who is being reviewed.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
          &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
            &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: If TeammteReviewQuestionnaire is used, then use the `:reviewee_name` method for VmQuestionResponse model to print the name of the student who is being reviewed.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
          &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
            &amp;lt;% elsif vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (For: &amp;lt;%= vm.reviewee_name(session[:ip]) %&amp;gt;)&lt;br /&gt;
            &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.4 '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't inform the partial about the type of review being done&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_reviews.each do |review| %&amp;gt;&lt;br /&gt;
              &amp;lt;!-- instructors (or higher level users) see reviewer name, students see anonymized string --&amp;gt;&lt;br /&gt;
              &amp;lt;% if (['Student'].include? @current_role_name) &amp;amp;&amp;amp; @assignment.is_anonymous%&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i} %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                  &amp;lt;% user_name = User.find(Participant.find(ResponseMap.find(Response.find(review.id).map_id).reviewer_id).user_id).fullname(session[:ip]).to_s %&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i} %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% i += 1 %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
New code: Passes the type of review being done to the partial, so it can decide on how to render the review title. Note: This code seems to use repetition, but since the conditional used here are accessing `Anonymous` assignments and checking for user roles, we have not modified this code, as it is not directly related to our scope.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_reviews.each do |review| %&amp;gt;&lt;br /&gt;
              &amp;lt;!-- instructors (or higher level users) see reviewer name, students see anonymized string --&amp;gt;&lt;br /&gt;
              &amp;lt;% if (['Student'].include? @current_role_name) &amp;amp;&amp;amp; @assignment.is_anonymous%&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i, questionnaire_type: vm.questionnaire_type } %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                &amp;lt;% user_name = User.find(Participant.find(ResponseMap.find(Response.find(review.id).map_id).reviewer_id).user_id).fullname(session[:ip]).to_s %&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i, questionnaire_type: vm.questionnaire_type } %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% i += 1 %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Old code: Contains a `metrics-1` column&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-true&amp;quot; align=&amp;quot;right&amp;quot; &amp;gt;&lt;br /&gt;
            Avg&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;span  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;A count of comments, for the respective question, which have word count &amp;gt; 10. The purpose of this metric is to represent how many comments for the question are of a substantial length to provide quality feedback.&amp;quot;&amp;gt;metric-1&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/thead&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
New code: As per discussion with mentor, this column has been removed in our PR.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-true&amp;quot; align=&amp;quot;right&amp;quot; &amp;gt;&lt;br /&gt;
            Avg&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/thead&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.5 '''&lt;br /&gt;
&lt;br /&gt;
Old code: It creates the ID inline in multiple places, so if we decide to change the ID generation logic, we need to modify it in multiple places. (which happened when we started rendering multiple tables for each teammate).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_rows.each do |row| %&amp;gt;&lt;br /&gt;
            &amp;lt;!-- notice the data-target. because we're toggling via looped code, we need to dynamically generate the identifier. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr data-toggle=&amp;quot;collapse&amp;quot; class=&amp;quot;accordion-toggle&amp;quot; data-target=&amp;quot;#hid&amp;lt;%= row.question_id.to_s + vm.round.to_s %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Generate the unique HTML ID once, in a readable manner once. And conditionally make it more unique, if it is a TeammateReviewQuestionnaire, since jQuery code requires these IDs to be unique amongst different tables. If we don't make it more unique, then clicking on one teammate review table will toggle the table visibility for the first table. To prevent this &amp;quot;clashing&amp;quot;, we need to make these IDs more unique for a TeammateReviewQuestionnaire.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_rows.each do |row| %&amp;gt;&lt;br /&gt;
            &amp;lt;% target_id = &amp;quot;hid__#{row.question_id}__#{vm.round}&amp;quot; %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
              &amp;lt;%# Since we render different heatgrids with the same questions for each&lt;br /&gt;
              teammember, we need to distinguish the ID, based on the user for whom,&lt;br /&gt;
              the reviews have been created. %&amp;gt;&lt;br /&gt;
              &amp;lt;% target_id += &amp;quot;__#{vm.reviewee_id}&amp;quot; %&amp;gt;&lt;br /&gt;
            &amp;lt;% end%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;!-- notice the data-target. because we're toggling via looped code, we need to dynamically generate the identifier. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr data-toggle=&amp;quot;collapse&amp;quot; class=&amp;quot;accordion-toggle&amp;quot; data-target=&amp;quot;&amp;lt;%= &amp;quot;#&amp;quot; + target_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Old code: Written on a single line crossing 80 characters on a single line&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
              &amp;lt;% row.score_row.each do |score| %&amp;gt;&lt;br /&gt;
                  &amp;lt;% score_comment = score.comment.nil? ? '' : score.comment %&amp;gt; &amp;lt;!-- changing nil to null string to avoid Null Pointer Exception --&amp;gt;&lt;br /&gt;
                  &amp;lt;td class=&amp;quot;&amp;lt;%= score.color_code %&amp;gt;&amp;quot; align=&amp;quot;center&amp;quot; data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= strip_tags(score.comment).html_safe%&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;&amp;lt;%=  underlined?(score) %&amp;gt;&amp;quot;&amp;gt;&amp;lt;%= score.score_value.to_s %&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
                  &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
New code: Make code more readable by indenting it and splitting it over multiple lines&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
              &amp;lt;!-- actual cells with scores and colored background. --&amp;gt;&lt;br /&gt;
              &amp;lt;% row.score_row.each do |score| %&amp;gt;&lt;br /&gt;
                  &amp;lt;% score_comment = score.comment.nil? ? '' : score.comment %&amp;gt;&lt;br /&gt;
                  &amp;lt;!-- changing nil to null string to avoid Null Pointer Exception --&amp;gt;&lt;br /&gt;
                  &amp;lt;td class=&amp;quot;&amp;lt;%= score.color_code %&amp;gt;&amp;quot; align=&amp;quot;center&amp;quot; data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= strip_tags(score.comment).html_safe%&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;&amp;lt;%=  underlined?(score) %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                      &amp;lt;%= score.score_value.to_s %&amp;gt;&lt;br /&gt;
                    &amp;lt;/span&amp;gt;&lt;br /&gt;
                  &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.6 '''Removed the following code as it corresponds to the deleted column&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 &amp;lt;td  class = 'cf' align=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;%= row.countofcomments.to_s %&amp;gt;&lt;br /&gt;
              &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.7 '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code just unconditionally prints the text &amp;quot;Review&amp;quot; followed by an index.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                    &amp;lt;% for index in 0 .. row.score_row.length - 1 %&amp;gt;&lt;br /&gt;
                        &amp;lt;tr&amp;gt;&lt;br /&gt;
                          &amp;lt;td&amp;gt;Review &amp;lt;%=index + 1%&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Conditionally change the review text that is displayed based on the type of review and the access level of the user&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                    &amp;lt;% for index in 0 .. row.score_row.length - 1 %&amp;gt;&lt;br /&gt;
                        &amp;lt;tr&amp;gt;&lt;br /&gt;
                          &amp;lt;% if @current_role_name.eql?'Student' or vm.questionnaire_type != &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                            &amp;lt;%# Use Review {{index}} format for student view, and&lt;br /&gt;
                            when questionnaire_type is not teammatereview %&amp;gt;&lt;br /&gt;
                            &amp;lt;td&amp;gt;Review &amp;lt;%=index + 1%&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
                          &amp;lt;% else %&amp;gt;&lt;br /&gt;
                            &amp;lt;td&amp;gt;&lt;br /&gt;
                              &amp;lt;% reviewer_id = row.score_row[index].reviewer_id %&amp;gt;&lt;br /&gt;
                              &amp;lt;% fullname = Participant.find_by(id: reviewer_id).fullname(session[:ip]) %&amp;gt;&lt;br /&gt;
                              Review by &amp;lt;%= fullname %&amp;gt;&lt;br /&gt;
                            &amp;lt;/td&amp;gt;&lt;br /&gt;
                          &amp;lt;% end%&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====G. In spec/controllers/grades_controller_spec.rb:====&lt;br /&gt;
&lt;br /&gt;
'''G.1 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
before(:each) do&lt;br /&gt;
  allow(AssignmentParticipant).to receive(:find).with('1').and_return(participant)&lt;br /&gt;
  allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
  stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
@@ -91,29 +90,106 @@&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
before(:each) do&lt;br /&gt;
  allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
  stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
@@ -91,29 +90,106 @@&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''G.2 '''Remove xdescribe '#view_team' and change describe '#view_team' as follows.&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#view_team' do&lt;br /&gt;
render_views&lt;br /&gt;
context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
  it 'renders grades#view_team page' do&lt;br /&gt;
    allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
    allow(AssignmentQuestionnaire).to receive(:find_by).with(assignment_id: 1, questionnaire_id: 1).and_return(assignment_questionnaire)&lt;br /&gt;
    allow(AssignmentQuestionnaire).to receive(:where).with(any_args).and_return([assignment_questionnaire])&lt;br /&gt;
    allow(assignment).to receive(:late_policy_id).and_return(false)&lt;br /&gt;
    allow(assignment).to receive(:calculate_penalty).and_return(false)&lt;br /&gt;
    allow(assignment).to receive(:compute_total_score).with(any_args).and_return(100)&lt;br /&gt;
    allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
    allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
    params = {id: 1}&lt;br /&gt;
    allow(TaMapping).to receive(:exists?).with(ta_id: 1, course_id: 1).and_return(true)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#view_team' do&lt;br /&gt;
render_views&lt;br /&gt;
&lt;br /&gt;
# All stubs and factories are instantiated within this scope so as to not &lt;br /&gt;
# clash with other broken test.&lt;br /&gt;
# The names of the factories created for testing view_team&lt;br /&gt;
# have `_vt` suffix ```where necessary``` to differentiate them from &lt;br /&gt;
# the above declared factories&lt;br /&gt;
&lt;br /&gt;
let(:student1_vt) { create(:student, name: &amp;quot;barry&amp;quot;, id: 12) }&lt;br /&gt;
let(:student2_vt) { create(:student, name: &amp;quot;iris&amp;quot;, id: 13) }&lt;br /&gt;
&lt;br /&gt;
let(:tm_questionnaire) {&lt;br /&gt;
  build(&lt;br /&gt;
    :teammate_review_questionnaire,&lt;br /&gt;
    id: 12,&lt;br /&gt;
    questions: [question],&lt;br /&gt;
    max_question_score: 5&lt;br /&gt;
  )&lt;br /&gt;
}&lt;br /&gt;
let(:assignment_vt) {&lt;br /&gt;
  create(:assignment, id: 6, max_team_size: 2,&lt;br /&gt;
  questionnaires: [tm_questionnaire])&lt;br /&gt;
}&lt;br /&gt;
let(:assignment_questionnaire_vt) {&lt;br /&gt;
  create(:tm_assignment_questionnaire, id: 12, used_in_round: nil,&lt;br /&gt;
  assignment: assignment_vt, questionnaire: tm_questionnaire) }&lt;br /&gt;
let(:team_vt) { create(:assignment_team, id: 12,&lt;br /&gt;
assignment: assignment_vt) }&lt;br /&gt;
let(:participant_vt) { create(:participant, id: 12,&lt;br /&gt;
  assignment: assignment_vt, user_id: student1_vt.id) }&lt;br /&gt;
let(:participant2_vt) { create(:participant, id: 13,&lt;br /&gt;
  assignment: assignment_vt, user_id: student2_vt.id) }&lt;br /&gt;
&lt;br /&gt;
before(:each) do&lt;br /&gt;
  # Need to stub this method so the factory instance with&lt;br /&gt;
  # the stubbed :team method is returned by :find&lt;br /&gt;
  # instead of a separate instance with the same data&lt;br /&gt;
  allow(AssignmentParticipant)&lt;br /&gt;
    .to receive(:find)&lt;br /&gt;
    .with(participant_vt.id.to_s)&lt;br /&gt;
    .and_return(participant_vt)&lt;br /&gt;
  allow(participant_vt).to receive(:team).and_return(team_vt)&lt;br /&gt;
  allow(team_vt).to receive(:participants).and_return([participant_vt, participant2_vt])&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:find_by)&lt;br /&gt;
    .with(assignment_id: assignment_vt.id, questionnaire_id: tm_questionnaire.id)&lt;br /&gt;
    .and_return(assignment_questionnaire_vt)&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:find_by)&lt;br /&gt;
    .with(assignment_id: assignment.id, questionnaire_id: review_questionnaire.id)&lt;br /&gt;
    .and_return(assignment_questionnaire_vt)&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:where)&lt;br /&gt;
    .with(any_args)&lt;br /&gt;
    .and_return([assignment_questionnaire_vt])&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:late_policy_id)&lt;br /&gt;
    .and_return(false)&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:calculate_penalty)&lt;br /&gt;
    .and_return(false)&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:compute_total_score)&lt;br /&gt;
    .with(any_args)&lt;br /&gt;
    .and_return(100)&lt;br /&gt;
  allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
  allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
 it 'renders grades#view_team page' do&lt;br /&gt;
  params = {id: participant_vt.id}&lt;br /&gt;
  get :view_team, params&lt;br /&gt;
  expect(response).to render_template(:view_team)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is opened by student' do&lt;br /&gt;
  it 'dropdown is not rendered' do&lt;br /&gt;
    session = { user: student1_vt }&lt;br /&gt;
    params = {id: participant_vt.id}&lt;br /&gt;
    stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
    get :view_team, params&lt;br /&gt;
    expect(response.body).to_not have_selector('select')&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is opened by instructor' do&lt;br /&gt;
  it 'dropdown is rendered' do&lt;br /&gt;
    session = { user: instructor }&lt;br /&gt;
    params = {id: participant_vt.id}&lt;br /&gt;
    get :view_team, params&lt;br /&gt;
    expect(response.body).to have_selector('select')&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
  it 'renders grades#view_team page' do&lt;br /&gt;
    params = { id: participant_vt.id }&lt;br /&gt;
    allow(TaMapping).to receive(:exists?).with(ta_id: participant_vt.user_id, course_id: 1).and_return(true)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====H. In spec/factories/factories.rb:====&lt;br /&gt;
&lt;br /&gt;
'''H.1 '''Add the following factory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
factory :teammate_review_questionnaire, class: TeammateReviewQuestionnaire do&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''H.2 '''Add another factory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
factory :tm_assignment_questionnaire, class: AssignmentQuestionnaire do&lt;br /&gt;
  user_id 1&lt;br /&gt;
  questionnaire { association(:teammate_review_questionnaire) }&lt;br /&gt;
  questionnaire_weight 100&lt;br /&gt;
  used_in_round nil&lt;br /&gt;
  topic_id nil&lt;br /&gt;
  dropdown 1&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
The tests written as a part of this project can be run by running the following command on terminal:&lt;br /&gt;
&lt;br /&gt;
1. rspec ./spec/controllers/grades_controller_spec.rb  -e &amp;quot;#view_team&amp;quot;&lt;br /&gt;
&lt;br /&gt;
2. rspec .vm_question_response_score_cell_spec.rb  -e &amp;quot;#reviewer_id&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''OLD STATUS'''&lt;br /&gt;
&lt;br /&gt;
1. Earlier, the tests contained an xdescribe test to check if the view_team page is rendered correctly. However, this test was being skipped as this was an xdescribe segment. There was another test for when the view_team page is accessed by a student who is also a TA for another course. This can be checked [https://github.com/expertiza/expertiza/blob/beta/spec/controllers/grades_controller_spec.rb here].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 xdescribe '#view_team' do&lt;br /&gt;
    it 'renders grades#view_team page' do&lt;br /&gt;
      allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
      params = {id: 1}&lt;br /&gt;
      get :view_team, params&lt;br /&gt;
      expect(response).to render_template(:view_team)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#view_team' do&lt;br /&gt;
    render_views&lt;br /&gt;
    context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
      it 'renders grades#view_team page' do&lt;br /&gt;
        allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
        allow(AssignmentQuestionnaire).to receive(:find_by).with(assignment_id: 1, questionnaire_id: 1).and_return(assignment_questionnaire)&lt;br /&gt;
        allow(AssignmentQuestionnaire).to receive(:where).with(any_args).and_return([assignment_questionnaire])&lt;br /&gt;
        allow(assignment).to receive(:late_policy_id).and_return(false)&lt;br /&gt;
        allow(assignment).to receive(:calculate_penalty).and_return(false)&lt;br /&gt;
        allow(assignment).to receive(:compute_total_score).with(any_args).and_return(100)&lt;br /&gt;
        allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
        allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
        params = {id: 1}&lt;br /&gt;
        allow(TaMapping).to receive(:exists?).with(ta_id: 1, course_id: 1).and_return(true)&lt;br /&gt;
        stub_current_user(ta, ta.role.name, ta.role)&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).not_to have_content &amp;quot;TA&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''NEW STATUS'''&lt;br /&gt;
&lt;br /&gt;
1. The view_team page is rendered correctly for a given student or an instructor. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    it 'renders grades#view_team page' do&lt;br /&gt;
      params = {id: participant_vt.id}&lt;br /&gt;
      get :view_team, params&lt;br /&gt;
      expect(response).to render_template(:view_team)&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. When students access then the view_team page, the dropdown to select a student's teammate reviews is not rendered on the page. The dropdown is rendered if the page is accessed by an instructor. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   context 'dropdown for selecting a teammate review' do&lt;br /&gt;
    render_views&lt;br /&gt;
      it 'is not rendered is not rendered when page is opened by student' do&lt;br /&gt;
        session = { user: student1_vt }&lt;br /&gt;
        params = {id: participant_vt.id}&lt;br /&gt;
        stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to_not have_selector('select')&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      it 'is rendered when page is opened by instructor' do&lt;br /&gt;
        session = { user: instructor }&lt;br /&gt;
        params = {id: participant_vt.id}&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to have_selector('select')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. When a student who is also a TA for another course access the view_team page, that student should be able to a student's view to the page. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
      it 'renders grades#view_team page' do&lt;br /&gt;
        params = { id: participant_vt.id }&lt;br /&gt;
        allow(TaMapping).to receive(:exists?).with(ta_id: participant_vt.user_id, course_id: 1).and_return(true)&lt;br /&gt;
        stub_current_user(ta, ta.role.name, ta.role)&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).not_to have_content &amp;quot;TA&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. If show_teammate_reviews boolean is set to False, then the student should not be able to see the teammate reviews given to him/her. An instructor can still see the teammate reviews. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when assignment(show reviews) value is unchecked' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        allow(assignment_vt).to receive(:show_teammate_reviews).and_return(false) &lt;br /&gt;
      end&lt;br /&gt;
      it 'Student cannot view his score' do&lt;br /&gt;
        session = { user: student1_vt }&lt;br /&gt;
        params = {id: participant_vt.id}&lt;br /&gt;
        stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to_not have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
        expect(response.body).to_not have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant2_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      it 'Instructor can view the student score' do        &lt;br /&gt;
        params = {id: participant_vt.id}        &lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
        expect(response.body).to have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant2_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. If show_teammate_reviews boolean is set to True, then both the student should and instructor should be able to see the teammate reviews. The student should see only the reviews received by him/her. The instructor should be able to see all student's teammate reviews. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    context 'when assignment(show reviews) value is checked' do&lt;br /&gt;
      it 'Student can view his score' do&lt;br /&gt;
        session = { user: student1_vt }&lt;br /&gt;
        params = {id: participant_vt.id}&lt;br /&gt;
        stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
        expect(response.body).to_not have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant2_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      it 'Instructor can view the student score' do        &lt;br /&gt;
        params = {id: participant_vt.id}        &lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
        expect(response.body).to have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant2_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. The reviewer id is tracked correctly to show the correct reviewer name in the teammate reviews table. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/models/vm_question_response_score_cell_spec.rb this] file &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  	describe '#reviewer_id' do&lt;br /&gt;
  		it 'returns reviewer id' do&lt;br /&gt;
			allow(ResponseMap).to receive(:find).with(1).and_return(review_response_map)&lt;br /&gt;
			allow(response).to receive(:populate_new_response).with(:review_response_map, &amp;quot;0&amp;quot;).and_return(response)&lt;br /&gt;
        	expect(response.id).to eq(1)	&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Summary of file changes ==&lt;br /&gt;
&lt;br /&gt;
The following files are modified:&lt;br /&gt;
&lt;br /&gt;
1. app/controllers/grades_controller.rb - Controller file which changed how the view model is populated&lt;br /&gt;
&lt;br /&gt;
2. app/views/grades/view_team.html.erb - View file, which  conditionally rendered the teammate name, for a teammate review heatgrid&lt;br /&gt;
&lt;br /&gt;
3. spec/controllers/grades_controller_spec.rb - For tests verifying the proposed changes&lt;br /&gt;
&lt;br /&gt;
4. app/models/vm_question_response.rb - To modify the view-model so it can tell us the name of the person being reviewed for the current heatgrid&lt;br /&gt;
&lt;br /&gt;
5. app/models/vm_question_response_score_cell.rb - &lt;br /&gt;
&lt;br /&gt;
6. app/assets/stylesheets/grades.scss - &lt;br /&gt;
&lt;br /&gt;
7. app/views/grades/_add_icon_to_name.html.erb - &lt;br /&gt;
&lt;br /&gt;
8. spec/factories/factories.rb -&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Design Patterns ==&lt;br /&gt;
&lt;br /&gt;
Existing code does not use any design patterns, apart from if-else. It uses if-else conditional statements to check what type of questionnaire is present in the viewmodel `VmQuestionResponse`, and based on that, it renders the appropriate content.&lt;br /&gt;
&lt;br /&gt;
We decided to continue with this approach since to change the present coding style, there were required many changes (refactoring) to many files which were out of the scope of the present project. To complete the project in the assigned time, we followed the if-else approach.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;https://expertiza.ncsu.edu/&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Agarg25</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141768</id>
		<title>CSC/ECE 517 Fall 2021 - E2165. Fix teammate-review view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141768"/>
		<updated>2021-11-28T19:41:53Z</updated>

		<summary type="html">&lt;p&gt;Agarg25: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Introduction ==&lt;br /&gt;
&lt;br /&gt;
Dr. Edward Gehringer (instructor), Parimal Mehta (mentor)&lt;br /&gt;
&lt;br /&gt;
1. Anjali Garg (unity ID : agarg25)&lt;br /&gt;
&lt;br /&gt;
2. Arvasu Chikara (unity ID: achikar2)&lt;br /&gt;
&lt;br /&gt;
3. Lalit Bangad (unity ID: llbangad)&lt;br /&gt;
&lt;br /&gt;
4. Vinay Deshmukh (unity ID: vdeshmu)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Problems to be addressed ==&lt;br /&gt;
&lt;br /&gt;
After a project is submitted and reviewed, both the team members (students) and instructors should be able to view the teammate reviews. Students should be able to view the reviews by going to a particular assignment's -&amp;gt; your scores, at the bottom of the page. An instructor can view the teammate reviews by going to assignments -&amp;gt; assignment -&amp;gt; particular team's submission -&amp;gt; view submission -&amp;gt; assign grades -&amp;gt; view scores. &lt;br /&gt;
&lt;br /&gt;
In the case of the instructor, a single heat grid is shown whereas in the case of a team member, we cant view the scores. In the heat grid, it is not clear if the scores visible are for the reviews that the student has *written* for their teammates or the scores that the student has *received* from their teammates. Additionally, for instructors can choose from a list of the students on the team, but they have no way to tell whether the heat grid shows the reviews done *by* that student or done *for* that student.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Methodology Overview ==&lt;br /&gt;
&lt;br /&gt;
We have divided our work in the following tasks to address the above problems:&lt;br /&gt;
&lt;br /&gt;
1. Distinguish reviews done for a student by rendering separates heatgrids for each student&lt;br /&gt;
&lt;br /&gt;
2. For instructors, the table will have sections based on the students&lt;br /&gt;
&lt;br /&gt;
3. Include a checkbox on the edit assignment page that enables/disables visibility of heat grid to students&lt;br /&gt;
&lt;br /&gt;
4. Fix the average column for a table (which breaks for some reviews)&lt;br /&gt;
&lt;br /&gt;
5. Show a composite score derived from all reviews.  Make this code generalized, so other kinds of heat grid views could use it.&lt;br /&gt;
&lt;br /&gt;
6. Changes should work even in an anonymized view&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Motivations ==&lt;br /&gt;
&lt;br /&gt;
1. Enable users to clearly tell which reviews are done by them, and which reviews are done for them.&lt;br /&gt;
&lt;br /&gt;
2. Code should be generic so it can be used for different types of heat grids as well.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Control Flow to access the concerned screens ==&lt;br /&gt;
'''1. For instructor (Log in as an instructor):-'''&lt;br /&gt;
&lt;br /&gt;
Screen after logging in by the instructor&lt;br /&gt;
[[File:ss1.png |border|1000px|center]]&lt;br /&gt;
Got to assignments on the Manage menu &lt;br /&gt;
[[File:ss2.png |border|1000px|center]]&lt;br /&gt;
Go to assignments&lt;br /&gt;
[[File:ss3.png |border|1000px|center]]&lt;br /&gt;
Go to submissions for any assignment&lt;br /&gt;
[[File:ss4a.png |border|1000px|center]]&lt;br /&gt;
Go to Assign Grade&lt;br /&gt;
[[File:ss5a.png |border|1000px|center]]&lt;br /&gt;
You will land on the page where the changes are made and can be reviewed&lt;br /&gt;
[[File:ss7a.png |border|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
'''2. Student:- (Instructor impersonating a student)'''&lt;br /&gt;
&lt;br /&gt;
After landing on the assignments page, select any student from an assignment as shown below&lt;br /&gt;
[[File:ss6a.png |border|1000px|center]]&lt;br /&gt;
Go to/Select any assignment&lt;br /&gt;
[[File:ss9a.png |border|1000px|center]]&lt;br /&gt;
Go to your scores&lt;br /&gt;
[[File:ss10a.png |border|1000px|center]]&lt;br /&gt;
You will land on the page where the changes are made and can be reviewed&lt;br /&gt;
[[File:ss11a.png |border|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
== Old Status of the application ==&lt;br /&gt;
&lt;br /&gt;
'''1. Instructor's view of teammate review''': This is the current screen given to the instructor. Here we see that the instructor can not determine who has given which review to which student in a team.&lt;br /&gt;
&lt;br /&gt;
[[File:Instructor-view-1.png|border| 700px |center|alt=The proposed expanded student display.|The proposed expanded student display.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2. Student's view of teammate review''': Currently, a student is not able to see what grades were given by their teammates. We need to implement that functionality so that the student is able to view those grades.&lt;br /&gt;
&lt;br /&gt;
[[File:Student-view-2.png|border| 700px |center|alt=The current instructor view.|The current review display for instructors.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Error in existing UI for student''': In the existing UI for a student, the highlighted block should not be rendered. This part of the screen is meant for the instructors/TAs. &lt;br /&gt;
&lt;br /&gt;
[[File:Wrong render for student.png|border|700px|center|alt=Existing UI for student|Existing UI for student.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Proposed changes ==&lt;br /&gt;
&lt;br /&gt;
''' 1) Proposed UI for instructor ''': The instructor is able to see the score for all teammates. In the existing code, only one teammate's scores are being shown. But, we are planning to change the way the (VmQuestionResponse array is populated)[https://github.com/expertiza/expertiza/blob/master/app/controllers/grades_controller.rb#L114], so that the scores for all teammates are appended to it so it correctly shows what should have already been shown in this screen for the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Proposed_screen.png|border|700px|center|alt=Proposed UI for instructor|Proposed UI for instructor.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: When a student visits this screen, they will only be shown the reviews received by them, assuming the instructor has allowed visibility of teammate reviews to students.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' 2) Show detailed review for a particular question''': The instructor can see detailed review given to a student by their teammates by clicking on a particular question number in the table.&lt;br /&gt;
&lt;br /&gt;
[[File:ss12a.png|border|700px|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' 3) Show teammate review to student UI ''': The existing code doesn't render a student's teammate review scores at all. We are planning to render the scores to a student (as shown below) when they visit this screen. However, the visibility of this screen is contingent on whether the instructor has allowed visibility of the teammate review screen to students. If the instructor has disabled this feature, then the heatgrid will not be displayed at all.&lt;br /&gt;
&lt;br /&gt;
[[File:UI_for_student.png|border|700px|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== User Stories ==&lt;br /&gt;
&lt;br /&gt;
1. As an instructor, I can view what reviews one teammate has given to other teammates.&lt;br /&gt;
&lt;br /&gt;
2. As a student, I can view what reviews my teammates have given to me.&lt;br /&gt;
&lt;br /&gt;
3. As an instructor, I can choose if I want to see all student's teammates reviews together or one by one.&lt;br /&gt;
&lt;br /&gt;
4. As a student, if I am also a TA for another subject, I should not be able to see an instructor's view to the view_team page.&lt;br /&gt;
&lt;br /&gt;
5. As an instructor, I should be able to see the name of the reviewers for the reviews to a particular student.&lt;br /&gt;
&lt;br /&gt;
== UML diagram for the system ==  &lt;br /&gt;
&lt;br /&gt;
[[File:vie_team_use_case.png|border|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Changes to the models ==&lt;br /&gt;
&lt;br /&gt;
[[File:cd1.png |border|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:cd2.png |border|400px|center]]&lt;br /&gt;
&lt;br /&gt;
== Explanation of fixes ==&lt;br /&gt;
&lt;br /&gt;
The below diagram illustrates the proposed code change for showing all team members with the teammate review data to an instructor. The existing code only iterated on the `Participant` whose ID is present in the URL of the page. To fix this, we will iterate over all teammates of the given participant so that all teammate reviews for all team members are shown to the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Logic e2165.png|border|center|alt=Flow diagram of proposed changes for showing team review data to instructor]]&lt;br /&gt;
&lt;br /&gt;
===Changes made to the code are shown below. Every change is shown and explained separately===&lt;br /&gt;
&lt;br /&gt;
====A. Added the following to app/assets/stylesheets/grades.scss:====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    .teammate_table.hidden {&lt;br /&gt;
      display: none;&lt;br /&gt;
      }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====B. In app/controllers/grades_controller.rb: ====&lt;br /&gt;
&lt;br /&gt;
'''B.1:'''&lt;br /&gt;
&lt;br /&gt;
Old code: The existing code does not differentiate when adding a view model for the TeammateReview questionnaire&lt;br /&gt;
  questionnaires.each do |questionnaire|&lt;br /&gt;
     ...&lt;br /&gt;
     @vmlist &amp;lt;&amp;lt; populate_view_model(questionnaire)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
New code: Since the current page URL contains an ID for the participant, from which we get an assignment, which gives us a list of questionnaires, we need to iterate all participants for a `TeammateReveiwQuestionnaire` questionnaire, so that we get the heatgrid view models for all members of a team.&lt;br /&gt;
  questionnaires.each do |questionnaire|&lt;br /&gt;
     ...&lt;br /&gt;
     if questionnaire.type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
        # as teammate review will be different for each participant&lt;br /&gt;
        # we need to create a separate table for each teammate&lt;br /&gt;
        @participant.team.participants.each do |team_participant|&lt;br /&gt;
          @vmlist &amp;lt;&amp;lt; populate_view_model(team_participant, questionnaire, @team)&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        # only one participant needs iterating, as apart from teammatereview&lt;br /&gt;
        # all other reviews are at &amp;quot;team&amp;quot; level&lt;br /&gt;
        @vmlist &amp;lt;&amp;lt; populate_view_model(@participant, questionnaire, @team)&lt;br /&gt;
      end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
'''B.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code: This code uses @participant as an instance variable, but this structure will not work as we need to call this ViewModel with multiple participants when iterating for a teammate review questionnaire.&lt;br /&gt;
    def populate_view_model(questionnaire)&lt;br /&gt;
      vm = VmQuestionResponse.new(questionnaire, @assignment, @round)&lt;br /&gt;
      vmquestions = questionnaire.questions&lt;br /&gt;
      vm.add_questions(vmquestions)&lt;br /&gt;
      vm.add_team_members(@team)&lt;br /&gt;
      vm.add_reviews(@participant, @team, @assignment.vary_by_round)&lt;br /&gt;
      vm.number_of_comments_greater_than_10_words&lt;br /&gt;
      vm &lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
New code: We need to call this function with a separate participant in each invocation due to our change for TeammateReviewQuestionnaire, hence it makes sense to make `participant` as an argument to this function. Similarly, as `team` is a closely related model to `participant`, we are passing it as an argument, to keep this function as &amp;quot;pure&amp;quot; as possible.&lt;br /&gt;
    def populate_view_model(participant, questionnaire, team)&lt;br /&gt;
      ...&lt;br /&gt;
      vm.add_team_members(team)&lt;br /&gt;
      vm.add_reviews(participant, team, @assignment.vary_by_round)&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
====C. In app/models/vm_question_response.rb:====&lt;br /&gt;
&lt;br /&gt;
'''C.1: '''Added the reviewee_id method: Created a helper method within the VmQuestionReponse model to retrieve the `reviewee_id` for a heatgrid&lt;br /&gt;
&lt;br /&gt;
    def reviewee_id&lt;br /&gt;
      @participant_who_is_reviewee.user_id&lt;br /&gt;
    end &lt;br /&gt;
&lt;br /&gt;
'''C.2: '''Added the reviewee_name method: Created a helper method within the VmQuestionReponse model to retrieve the name of the student who is being reviewed for a heatgrid. This method uses the functionality to anonymize the name when we are in anonymized view.&lt;br /&gt;
&lt;br /&gt;
    def reviewee_name(ip_address = nil)&lt;br /&gt;
      part = @participant_who_is_reviewee&lt;br /&gt;
      User.find_by(id: part.user_id).fullname(ip_address)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''C.3: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Does not keep track of the student being reviewed&lt;br /&gt;
    elsif @questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
      reviews = participant.teammate_reviews&lt;br /&gt;
      reviews.each do |review|&lt;br /&gt;
        review_mapping = TeammateReviewResponseMap.find_by(id: review.map_id)&lt;br /&gt;
        participant = Participant.find(review_mapping.reviewer_id)&lt;br /&gt;
&lt;br /&gt;
New code: Add an instance variable to keep track of the student who is being reviewed in this VmQuestionReponse&lt;br /&gt;
    elsif @questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
      reviews = participant.teammate_reviews&lt;br /&gt;
      @participant_who_is_reviewee = participant&lt;br /&gt;
      reviews.each do |review|&lt;br /&gt;
        review_mapping = TeammateReviewResponseMap.find_by(id: review.map_id)&lt;br /&gt;
        participant = Participant.find(review_mapping.reviewer_id)&lt;br /&gt;
&lt;br /&gt;
'''C.4: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing VmQuestionReponseScoreCell keeps no information about the reviewer, as it only stores the answer score&lt;br /&gt;
    row.score_row.push(VmQuestionResponseScoreCell.new(answer.answer, color_code, answer.comments, vm_tag_prompts))&lt;br /&gt;
&lt;br /&gt;
New code: Keep track of the response ID, so that we can retrieve the user ID for the reviewer in the model to use in the view file.&lt;br /&gt;
    &lt;br /&gt;
    row.score_row.push(VmQuestionResponseScoreCell.new(answer.answer, color_code, answer.comments, vm_tag_prompts, answer.response_id))&lt;br /&gt;
&lt;br /&gt;
====D. In app/models/vm_question_response_score_cell.rb:====&lt;br /&gt;
&lt;br /&gt;
'''D.1: '''In the method initialize of class VmQuestionResponseScoreCell&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't keep track of the response id&lt;br /&gt;
    def initialize(score_value, color_code, comments, vmprompts = nil)&lt;br /&gt;
      @score_value = score_value&lt;br /&gt;
      @color_code = color_code&lt;br /&gt;
      @comment = comments&lt;br /&gt;
      @vm_prompts = vmprompts&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
New code: We added an instance variable to keep track of response_id&lt;br /&gt;
&lt;br /&gt;
    def initialize(score_value, color_code, comments, vmprompts = nil, response_id)&lt;br /&gt;
      ...&lt;br /&gt;
      @response_id = response_id&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''D.2: '''Added a method reviewer_id to the class VmQuestionResponseScoreCell: This helper method retrieves the ID for the reviewer who created this response.&lt;br /&gt;
&lt;br /&gt;
    def reviewer_id&lt;br /&gt;
      resp = Response.find(@response_id)&lt;br /&gt;
      map = ResponseMap.find(resp.map_id)&lt;br /&gt;
      map.reviewer_id&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
====E. In app/views/grades/_add_icon_to_name.html.erb:====&lt;br /&gt;
&lt;br /&gt;
'''E.1 '''Added the following code to the file: Write the code to generate the review text only once to reduce WET code&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;%# Determine the content of the reviewed by text %&amp;gt;&lt;br /&gt;
    &amp;lt;% review_text = &amp;quot;&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% if @current_role_name.eql?'Student' or questionnaire_type != &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
      &amp;lt;%# Use Review {{index}} format for student view, and when questionnaire_type is not teammatereview %&amp;gt;&lt;br /&gt;
      &amp;lt;% review_text = &amp;quot;Review #{i + 1}&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;% resp = Response.find(review.id) %&amp;gt;&lt;br /&gt;
      &amp;lt;% map = ResponseMap.find(resp.map_id) %&amp;gt;&lt;br /&gt;
      &amp;lt;% reviewer_id = map.reviewer_id %&amp;gt;&lt;br /&gt;
      &amp;lt;% fullname = Participant.find_by(id: reviewer_id).fullname(session[:ip]) %&amp;gt;&lt;br /&gt;
      &amp;lt;% review_text = &amp;quot;Review by #{fullname}&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% end%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''E.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code is very unreadable as it's not indented, and written in a single line with 359 characters, which breaks the ruby style guide rules&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;% if review.done_by_staff_participant? %&amp;gt;&lt;br /&gt;
      &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt; &amp;lt;img data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Icon indicates this review was done by course staff&amp;quot; class=&amp;quot;img_icon&amp;quot; src=&amp;quot;/assets/staff.png&amp;quot;&amp;gt; &amp;lt;a target=&amp;quot;_blank&amp;quot; href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Click to see details&amp;quot;&amp;gt;&amp;lt;%= &amp;quot;Review &amp;quot; + i.to_s  %&amp;gt;&amp;lt;/a&amp;gt; &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt; &amp;lt;a target=&amp;quot;_blank&amp;quot; href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Click to see details&amp;quot;&amp;gt;&amp;lt;%= &amp;quot;Review &amp;quot; + i.to_s %&amp;gt;&amp;lt;/a&amp;gt;  &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Correctly indented and removes WET repetition of code blocks and makes the resulting code DRYer&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;% if review.done_by_staff_participant? %&amp;gt;&lt;br /&gt;
      &amp;lt;img&lt;br /&gt;
      data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
      data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
      title=&amp;quot;Icon indicates this review was done by course staff&amp;quot; class=&amp;quot;img_icon&amp;quot;&lt;br /&gt;
      src=&amp;quot;/assets/staff.png&amp;quot;&lt;br /&gt;
      &amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;a&lt;br /&gt;
      target=&amp;quot;_blank&amp;quot;&lt;br /&gt;
      href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;&lt;br /&gt;
      data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
      data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
      title=&amp;quot;Click to see details&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;%= review_text %&amp;gt;&lt;br /&gt;
    &amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====F.In app/views/grades/view_team.html.erb:====&lt;br /&gt;
&lt;br /&gt;
'''F.1: '''Added function teammateSelectOnChange: This function toggles the visibility for the teammate heatgrids when the instructor changes the dropdown&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  function teammateSelectOnChange(selectNode) {&lt;br /&gt;
      const revieweeIdToShow= selectNode.value;&lt;br /&gt;
      const tableSelector = &amp;quot;.teammate_table&amp;quot;;&lt;br /&gt;
      if(revieweeIdToShow == &amp;quot;all&amp;quot;) {&lt;br /&gt;
        document.querySelectorAll(tableSelector).forEach((tableNode) =&amp;gt; {&lt;br /&gt;
          tableNode.classList.remove(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
        });&lt;br /&gt;
        return;&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
    document.querySelectorAll(tableSelector).forEach((tableNode) =&amp;gt; {&lt;br /&gt;
      const tableRevieweeId = tableNode.getAttribute('data-reviewee_id');&lt;br /&gt;
      if(tableRevieweeId == revieweeIdToShow) {&lt;br /&gt;
        tableNode.classList.remove(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
      } else {&lt;br /&gt;
        tableNode.classList.add(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
      }&lt;br /&gt;
      });&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't render TeammateReviewQuestionnaire&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;% @vmlist.each do |vm| %&amp;gt;&lt;br /&gt;
        &amp;lt;% if (vm.questionnaire_display_type == &amp;quot;Metareview&amp;quot; or vm.questionnaire_display_type == &amp;quot;Author Feedback&amp;quot; or vm.questionnaire_display_type == &amp;quot;Teammate Review&amp;quot;) and @current_role_name.eql?'Student' %&amp;gt;&lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
        &amp;lt;% if vm.list_of_reviewers.length &amp;gt; 0 %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Use a boolean to render a dropdown (that contains the students' IDs and names) just before the first TeammateReviewQuestionnaire, and unset that boolean so we only render 1 table. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;%# This boolean is used to render a dropdown just before the first teammate review heat grid %&amp;gt;&lt;br /&gt;
&amp;lt;% first_teammate_review_appeared = false %&amp;gt;&lt;br /&gt;
&amp;lt;% @vmlist.each do |vm| %&amp;gt;&lt;br /&gt;
     &amp;lt;% if (not @current_role_name.eql?'Student' and&lt;br /&gt;
        not first_teammate_review_appeared and&lt;br /&gt;
        vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; &lt;br /&gt;
      ) %&amp;gt;&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        &amp;lt;select onchange=&amp;quot;teammateSelectOnChange(this)&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;all&amp;quot;&amp;gt;All&amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;% @vmlist.select { |tm_vm| tm_vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; }.each do |tm_vm| %&amp;gt;&lt;br /&gt;
            &amp;lt;option value=&amp;quot;&amp;lt;%= tm_vm.reviewee_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;%= tm_vm.reviewee_name(session[:ip]) %&amp;gt;&lt;br /&gt;
            &amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
        &amp;lt;/select&amp;gt;&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;% first_teammate_review_appeared = true %&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Add conditions which check for the truthiness of ```@assignment.show_teammate_reviews``` and if the current user is a student to decide whether to render the table or not.  Since the existing code checks truthiness for the cases for which NOT to render a table, we have followed the existing style of the code.&lt;br /&gt;
&lt;br /&gt;
1) If type of view model is teammate review questionnaire, and current role is student, and if @assignment.show_teammate_reviews is false, then we don't render anything&lt;br /&gt;
2) If type of view model is teammate review questionnaire, and current role is student, but @assignment.show_teammate_reviews is true, then we don't render anything if the current reviewer_id is different to the currently logged in user.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;% if (vm.questionnaire_display_type == &amp;quot;Metareview&amp;quot; or vm.questionnaire_display_type == &amp;quot;Author Feedback&amp;quot;) and @current_role_name.eql?'Student' %&amp;gt;&lt;br /&gt;
    &amp;lt;% elsif (&lt;br /&gt;
      vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; and&lt;br /&gt;
      @current_role_name.eql?'Student' and&lt;br /&gt;
      !@assignment.show_teammate_reviews&lt;br /&gt;
      ) %&amp;gt;&lt;br /&gt;
    &amp;lt;% elsif (&lt;br /&gt;
      vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; and &lt;br /&gt;
      @current_role_name.eql?'Student' and&lt;br /&gt;
      @assignment.show_teammate_reviews and current_user.id != vm.reviewee_id&lt;br /&gt;
      )%&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Finally, add a CSS class and a `data-reviewee_id` to keep track of the heatgrids when toggling visibility.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
        &amp;lt;% if vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
          &amp;lt;div class=&amp;quot;teammate_table&amp;quot; data-reviewee_id=&amp;quot;&amp;lt;%= vm.reviewee_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
        &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.3  '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't print the teammate who is being reviewed.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
          &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
            &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: If TeammteReviewQuestionnaire is used, then use the `:reviewee_name` method for VmQuestionResponse model to print the name of the student who is being reviewed.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
          &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
            &amp;lt;% elsif vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (For: &amp;lt;%= vm.reviewee_name(session[:ip]) %&amp;gt;)&lt;br /&gt;
            &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.4 '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't inform the partial about the type of review being done&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_reviews.each do |review| %&amp;gt;&lt;br /&gt;
              &amp;lt;!-- instructors (or higher level users) see reviewer name, students see anonymized string --&amp;gt;&lt;br /&gt;
              &amp;lt;% if (['Student'].include? @current_role_name) &amp;amp;&amp;amp; @assignment.is_anonymous%&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i} %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                  &amp;lt;% user_name = User.find(Participant.find(ResponseMap.find(Response.find(review.id).map_id).reviewer_id).user_id).fullname(session[:ip]).to_s %&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i} %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% i += 1 %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
New code: Passes the type of review being done to the partial, so it can decide on how to render the review title. Note: This code seems to use repetition, but since the conditional used here are accessing `Anonymous` assignments and checking for user roles, we have not modified this code, as it is not directly related to our scope.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_reviews.each do |review| %&amp;gt;&lt;br /&gt;
              &amp;lt;!-- instructors (or higher level users) see reviewer name, students see anonymized string --&amp;gt;&lt;br /&gt;
              &amp;lt;% if (['Student'].include? @current_role_name) &amp;amp;&amp;amp; @assignment.is_anonymous%&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i, questionnaire_type: vm.questionnaire_type } %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                &amp;lt;% user_name = User.find(Participant.find(ResponseMap.find(Response.find(review.id).map_id).reviewer_id).user_id).fullname(session[:ip]).to_s %&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i, questionnaire_type: vm.questionnaire_type } %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% i += 1 %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Old code: Contains a `metrics-1` column&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-true&amp;quot; align=&amp;quot;right&amp;quot; &amp;gt;&lt;br /&gt;
            Avg&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;span  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;A count of comments, for the respective question, which have word count &amp;gt; 10. The purpose of this metric is to represent how many comments for the question are of a substantial length to provide quality feedback.&amp;quot;&amp;gt;metric-1&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/thead&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
New code: As per discussion with mentor, this column has been removed in our PR.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-true&amp;quot; align=&amp;quot;right&amp;quot; &amp;gt;&lt;br /&gt;
            Avg&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/thead&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.5 '''&lt;br /&gt;
&lt;br /&gt;
Old code: It creates the ID inline in multiple places, so if we decide to change the ID generation logic, we need to modify it in multiple places. (which happened when we started rendering multiple tables for each teammate).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_rows.each do |row| %&amp;gt;&lt;br /&gt;
            &amp;lt;!-- notice the data-target. because we're toggling via looped code, we need to dynamically generate the identifier. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr data-toggle=&amp;quot;collapse&amp;quot; class=&amp;quot;accordion-toggle&amp;quot; data-target=&amp;quot;#hid&amp;lt;%= row.question_id.to_s + vm.round.to_s %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Generate the unique HTML ID once, in a readable manner once. And conditionally make it more unique, if it is a TeammateReviewQuestionnaire, since jQuery code requires these IDs to be unique amongst different tables. If we don't make it more unique, then clicking on one teammate review table will toggle the table visibility for the first table. To prevent this &amp;quot;clashing&amp;quot;, we need to make these IDs more unique for a TeammateReviewQuestionnaire.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_rows.each do |row| %&amp;gt;&lt;br /&gt;
            &amp;lt;% target_id = &amp;quot;hid__#{row.question_id}__#{vm.round}&amp;quot; %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
              &amp;lt;%# Since we render different heatgrids with the same questions for each&lt;br /&gt;
              teammember, we need to distinguish the ID, based on the user for whom,&lt;br /&gt;
              the reviews have been created. %&amp;gt;&lt;br /&gt;
              &amp;lt;% target_id += &amp;quot;__#{vm.reviewee_id}&amp;quot; %&amp;gt;&lt;br /&gt;
            &amp;lt;% end%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;!-- notice the data-target. because we're toggling via looped code, we need to dynamically generate the identifier. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr data-toggle=&amp;quot;collapse&amp;quot; class=&amp;quot;accordion-toggle&amp;quot; data-target=&amp;quot;&amp;lt;%= &amp;quot;#&amp;quot; + target_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Old code: Written on a single line crossing 80 characters on a single line&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
              &amp;lt;% row.score_row.each do |score| %&amp;gt;&lt;br /&gt;
                  &amp;lt;% score_comment = score.comment.nil? ? '' : score.comment %&amp;gt; &amp;lt;!-- changing nil to null string to avoid Null Pointer Exception --&amp;gt;&lt;br /&gt;
                  &amp;lt;td class=&amp;quot;&amp;lt;%= score.color_code %&amp;gt;&amp;quot; align=&amp;quot;center&amp;quot; data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= strip_tags(score.comment).html_safe%&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;&amp;lt;%=  underlined?(score) %&amp;gt;&amp;quot;&amp;gt;&amp;lt;%= score.score_value.to_s %&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
                  &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
New code: Make code more readable by indenting it and splitting it over multiple lines&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
              &amp;lt;!-- actual cells with scores and colored background. --&amp;gt;&lt;br /&gt;
              &amp;lt;% row.score_row.each do |score| %&amp;gt;&lt;br /&gt;
                  &amp;lt;% score_comment = score.comment.nil? ? '' : score.comment %&amp;gt;&lt;br /&gt;
                  &amp;lt;!-- changing nil to null string to avoid Null Pointer Exception --&amp;gt;&lt;br /&gt;
                  &amp;lt;td class=&amp;quot;&amp;lt;%= score.color_code %&amp;gt;&amp;quot; align=&amp;quot;center&amp;quot; data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= strip_tags(score.comment).html_safe%&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;&amp;lt;%=  underlined?(score) %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                      &amp;lt;%= score.score_value.to_s %&amp;gt;&lt;br /&gt;
                    &amp;lt;/span&amp;gt;&lt;br /&gt;
                  &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.6 '''Removed the following code as it corresponds to the deleted column&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 &amp;lt;td  class = 'cf' align=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;%= row.countofcomments.to_s %&amp;gt;&lt;br /&gt;
              &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.7 '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code just unconditionally prints the text &amp;quot;Review&amp;quot; followed by an index.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                    &amp;lt;% for index in 0 .. row.score_row.length - 1 %&amp;gt;&lt;br /&gt;
                        &amp;lt;tr&amp;gt;&lt;br /&gt;
                          &amp;lt;td&amp;gt;Review &amp;lt;%=index + 1%&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Conditionally change the review text that is displayed based on the type of review and the access level of the user&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                    &amp;lt;% for index in 0 .. row.score_row.length - 1 %&amp;gt;&lt;br /&gt;
                        &amp;lt;tr&amp;gt;&lt;br /&gt;
                          &amp;lt;% if @current_role_name.eql?'Student' or vm.questionnaire_type != &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                            &amp;lt;%# Use Review {{index}} format for student view, and&lt;br /&gt;
                            when questionnaire_type is not teammatereview %&amp;gt;&lt;br /&gt;
                            &amp;lt;td&amp;gt;Review &amp;lt;%=index + 1%&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
                          &amp;lt;% else %&amp;gt;&lt;br /&gt;
                            &amp;lt;td&amp;gt;&lt;br /&gt;
                              &amp;lt;% reviewer_id = row.score_row[index].reviewer_id %&amp;gt;&lt;br /&gt;
                              &amp;lt;% fullname = Participant.find_by(id: reviewer_id).fullname(session[:ip]) %&amp;gt;&lt;br /&gt;
                              Review by &amp;lt;%= fullname %&amp;gt;&lt;br /&gt;
                            &amp;lt;/td&amp;gt;&lt;br /&gt;
                          &amp;lt;% end%&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====G. In spec/controllers/grades_controller_spec.rb:====&lt;br /&gt;
&lt;br /&gt;
'''G.1 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
before(:each) do&lt;br /&gt;
  allow(AssignmentParticipant).to receive(:find).with('1').and_return(participant)&lt;br /&gt;
  allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
  stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
@@ -91,29 +90,106 @@&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
before(:each) do&lt;br /&gt;
  allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
  stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
@@ -91,29 +90,106 @@&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''G.2 '''Remove xdescribe '#view_team' and change describe '#view_team' as follows.&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#view_team' do&lt;br /&gt;
render_views&lt;br /&gt;
context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
  it 'renders grades#view_team page' do&lt;br /&gt;
    allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
    allow(AssignmentQuestionnaire).to receive(:find_by).with(assignment_id: 1, questionnaire_id: 1).and_return(assignment_questionnaire)&lt;br /&gt;
    allow(AssignmentQuestionnaire).to receive(:where).with(any_args).and_return([assignment_questionnaire])&lt;br /&gt;
    allow(assignment).to receive(:late_policy_id).and_return(false)&lt;br /&gt;
    allow(assignment).to receive(:calculate_penalty).and_return(false)&lt;br /&gt;
    allow(assignment).to receive(:compute_total_score).with(any_args).and_return(100)&lt;br /&gt;
    allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
    allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
    params = {id: 1}&lt;br /&gt;
    allow(TaMapping).to receive(:exists?).with(ta_id: 1, course_id: 1).and_return(true)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#view_team' do&lt;br /&gt;
render_views&lt;br /&gt;
&lt;br /&gt;
# All stubs and factories are instantiated within this scope so as to not &lt;br /&gt;
# clash with other broken test.&lt;br /&gt;
# The names of the factories created for testing view_team&lt;br /&gt;
# have `_vt` suffix ```where necessary``` to differentiate them from &lt;br /&gt;
# the above declared factories&lt;br /&gt;
&lt;br /&gt;
let(:student1_vt) { create(:student, name: &amp;quot;barry&amp;quot;, id: 12) }&lt;br /&gt;
let(:student2_vt) { create(:student, name: &amp;quot;iris&amp;quot;, id: 13) }&lt;br /&gt;
&lt;br /&gt;
let(:tm_questionnaire) {&lt;br /&gt;
  build(&lt;br /&gt;
    :teammate_review_questionnaire,&lt;br /&gt;
    id: 12,&lt;br /&gt;
    questions: [question],&lt;br /&gt;
    max_question_score: 5&lt;br /&gt;
  )&lt;br /&gt;
}&lt;br /&gt;
let(:assignment_vt) {&lt;br /&gt;
  create(:assignment, id: 6, max_team_size: 2,&lt;br /&gt;
  questionnaires: [tm_questionnaire])&lt;br /&gt;
}&lt;br /&gt;
let(:assignment_questionnaire_vt) {&lt;br /&gt;
  create(:tm_assignment_questionnaire, id: 12, used_in_round: nil,&lt;br /&gt;
  assignment: assignment_vt, questionnaire: tm_questionnaire) }&lt;br /&gt;
let(:team_vt) { create(:assignment_team, id: 12,&lt;br /&gt;
assignment: assignment_vt) }&lt;br /&gt;
let(:participant_vt) { create(:participant, id: 12,&lt;br /&gt;
  assignment: assignment_vt, user_id: student1_vt.id) }&lt;br /&gt;
let(:participant2_vt) { create(:participant, id: 13,&lt;br /&gt;
  assignment: assignment_vt, user_id: student2_vt.id) }&lt;br /&gt;
&lt;br /&gt;
before(:each) do&lt;br /&gt;
  # Need to stub this method so the factory instance with&lt;br /&gt;
  # the stubbed :team method is returned by :find&lt;br /&gt;
  # instead of a separate instance with the same data&lt;br /&gt;
  allow(AssignmentParticipant)&lt;br /&gt;
    .to receive(:find)&lt;br /&gt;
    .with(participant_vt.id.to_s)&lt;br /&gt;
    .and_return(participant_vt)&lt;br /&gt;
  allow(participant_vt).to receive(:team).and_return(team_vt)&lt;br /&gt;
  allow(team_vt).to receive(:participants).and_return([participant_vt, participant2_vt])&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:find_by)&lt;br /&gt;
    .with(assignment_id: assignment_vt.id, questionnaire_id: tm_questionnaire.id)&lt;br /&gt;
    .and_return(assignment_questionnaire_vt)&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:find_by)&lt;br /&gt;
    .with(assignment_id: assignment.id, questionnaire_id: review_questionnaire.id)&lt;br /&gt;
    .and_return(assignment_questionnaire_vt)&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:where)&lt;br /&gt;
    .with(any_args)&lt;br /&gt;
    .and_return([assignment_questionnaire_vt])&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:late_policy_id)&lt;br /&gt;
    .and_return(false)&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:calculate_penalty)&lt;br /&gt;
    .and_return(false)&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:compute_total_score)&lt;br /&gt;
    .with(any_args)&lt;br /&gt;
    .and_return(100)&lt;br /&gt;
  allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
  allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
 it 'renders grades#view_team page' do&lt;br /&gt;
  params = {id: participant_vt.id}&lt;br /&gt;
  get :view_team, params&lt;br /&gt;
  expect(response).to render_template(:view_team)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is opened by student' do&lt;br /&gt;
  it 'dropdown is not rendered' do&lt;br /&gt;
    session = { user: student1_vt }&lt;br /&gt;
    params = {id: participant_vt.id}&lt;br /&gt;
    stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
    get :view_team, params&lt;br /&gt;
    expect(response.body).to_not have_selector('select')&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is opened by instructor' do&lt;br /&gt;
  it 'dropdown is rendered' do&lt;br /&gt;
    session = { user: instructor }&lt;br /&gt;
    params = {id: participant_vt.id}&lt;br /&gt;
    get :view_team, params&lt;br /&gt;
    expect(response.body).to have_selector('select')&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
  it 'renders grades#view_team page' do&lt;br /&gt;
    params = { id: participant_vt.id }&lt;br /&gt;
    allow(TaMapping).to receive(:exists?).with(ta_id: participant_vt.user_id, course_id: 1).and_return(true)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====H. In spec/factories/factories.rb:====&lt;br /&gt;
&lt;br /&gt;
'''H.1 '''Add the following factory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
factory :teammate_review_questionnaire, class: TeammateReviewQuestionnaire do&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''H.2 '''Add another factory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
factory :tm_assignment_questionnaire, class: AssignmentQuestionnaire do&lt;br /&gt;
  user_id 1&lt;br /&gt;
  questionnaire { association(:teammate_review_questionnaire) }&lt;br /&gt;
  questionnaire_weight 100&lt;br /&gt;
  used_in_round nil&lt;br /&gt;
  topic_id nil&lt;br /&gt;
  dropdown 1&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
The tests written as a part of this project can be run by running the following command on terminal:&lt;br /&gt;
&lt;br /&gt;
1. rspec ./spec/controllers/grades_controller_spec.rb  -e &amp;quot;#view_team&amp;quot;&lt;br /&gt;
&lt;br /&gt;
2. rspec .vm_question_response_score_cell_spec.rb  -e &amp;quot;#reviewer_id&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''OLD STATUS'''&lt;br /&gt;
&lt;br /&gt;
1. Earlier, the tests contained an xdescribe test to check if the view_team page is rendered correctly. However, this test was being skipped as this was an xdescribe segment. There was another test for when the view_team page is accessed by a student who is also a TA for another course. This can be checked [https://github.com/expertiza/expertiza/blob/beta/spec/controllers/grades_controller_spec.rb here].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 xdescribe '#view_team' do&lt;br /&gt;
    it 'renders grades#view_team page' do&lt;br /&gt;
      allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
      params = {id: 1}&lt;br /&gt;
      get :view_team, params&lt;br /&gt;
      expect(response).to render_template(:view_team)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#view_team' do&lt;br /&gt;
    render_views&lt;br /&gt;
    context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
      it 'renders grades#view_team page' do&lt;br /&gt;
        allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
        allow(AssignmentQuestionnaire).to receive(:find_by).with(assignment_id: 1, questionnaire_id: 1).and_return(assignment_questionnaire)&lt;br /&gt;
        allow(AssignmentQuestionnaire).to receive(:where).with(any_args).and_return([assignment_questionnaire])&lt;br /&gt;
        allow(assignment).to receive(:late_policy_id).and_return(false)&lt;br /&gt;
        allow(assignment).to receive(:calculate_penalty).and_return(false)&lt;br /&gt;
        allow(assignment).to receive(:compute_total_score).with(any_args).and_return(100)&lt;br /&gt;
        allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
        allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
        params = {id: 1}&lt;br /&gt;
        allow(TaMapping).to receive(:exists?).with(ta_id: 1, course_id: 1).and_return(true)&lt;br /&gt;
        stub_current_user(ta, ta.role.name, ta.role)&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).not_to have_content &amp;quot;TA&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''NEW STATUS'''&lt;br /&gt;
&lt;br /&gt;
1. The view_team page is rendered correctly for a given student or an instructor. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    it 'renders grades#view_team page' do&lt;br /&gt;
      params = {id: participant_vt.id}&lt;br /&gt;
      get :view_team, params&lt;br /&gt;
      expect(response).to render_template(:view_team)&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. When students access then the view_team page, the dropdown to select a student's teammate reviews is not rendered on the page. The dropdown is rendered if the page is accessed by an instructor. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   context 'dropdown for selecting a teammate review' do&lt;br /&gt;
    render_views&lt;br /&gt;
      it 'is not rendered is not rendered when page is opened by student' do&lt;br /&gt;
        session = { user: student1_vt }&lt;br /&gt;
        params = {id: participant_vt.id}&lt;br /&gt;
        stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to_not have_selector('select')&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      it 'is rendered when page is opened by instructor' do&lt;br /&gt;
        session = { user: instructor }&lt;br /&gt;
        params = {id: participant_vt.id}&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to have_selector('select')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. When a student who is also a TA for another course access the view_team page, that student should be able to a student's view to the page. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
      it 'renders grades#view_team page' do&lt;br /&gt;
        params = { id: participant_vt.id }&lt;br /&gt;
        allow(TaMapping).to receive(:exists?).with(ta_id: participant_vt.user_id, course_id: 1).and_return(true)&lt;br /&gt;
        stub_current_user(ta, ta.role.name, ta.role)&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).not_to have_content &amp;quot;TA&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. If show_teammate_reviews boolean is set to False, then the student should not be able to see the teammate reviews given to him/her. An instructor can still see the teammate reviews. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when assignment(show reviews) value is unchecked' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        allow(assignment_vt).to receive(:show_teammate_reviews).and_return(false) &lt;br /&gt;
      end&lt;br /&gt;
      it 'Student cannot view his score' do&lt;br /&gt;
        session = { user: student1_vt }&lt;br /&gt;
        params = {id: participant_vt.id}&lt;br /&gt;
        stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to_not have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
        expect(response.body).to_not have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant2_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      it 'Instructor can view the student score' do        &lt;br /&gt;
        params = {id: participant_vt.id}        &lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
        expect(response.body).to have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant2_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. If show_teammate_reviews boolean is set to True, then both the student should and instructor should be able to see the teammate reviews. The student should see only the reviews received by him/her. The instructor should be able to see all student's teammate reviews. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    context 'when assignment(show reviews) value is checked' do&lt;br /&gt;
      it 'Student can view his score' do&lt;br /&gt;
        session = { user: student1_vt }&lt;br /&gt;
        params = {id: participant_vt.id}&lt;br /&gt;
        stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
        expect(response.body).to_not have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant2_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      it 'Instructor can view the student score' do        &lt;br /&gt;
        params = {id: participant_vt.id}        &lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
        expect(response.body).to have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant2_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. The reviewer id is tracked correctly to show the correct reviewer name in the teammate reviews table. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/models/vm_question_response_score_cell_spec.rb this] file &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  	describe '#reviewer_id' do&lt;br /&gt;
  		it 'returns reviewer id' do&lt;br /&gt;
			allow(ResponseMap).to receive(:find).with(1).and_return(review_response_map)&lt;br /&gt;
			allow(response).to receive(:populate_new_response).with(:review_response_map, &amp;quot;0&amp;quot;).and_return(response)&lt;br /&gt;
        	expect(response.id).to eq(1)	&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Summary of file changes ==&lt;br /&gt;
&lt;br /&gt;
The following files are modified:&lt;br /&gt;
&lt;br /&gt;
1. app/controllers/grades_controller.rb - Controller file which changed how the view model is populated&lt;br /&gt;
&lt;br /&gt;
2. app/views/grades/view_team.html.erb - View file, which  conditionally rendered the teammate name, for a teammate review heatgrid&lt;br /&gt;
&lt;br /&gt;
3. spec/controllers/grades_controller_spec.rb - For tests verifying the proposed changes&lt;br /&gt;
&lt;br /&gt;
4. app/models/vm_question_response.rb - To modify the view-model so it can tell us the name of the person being reviewed for the current heatgrid&lt;br /&gt;
&lt;br /&gt;
5. app/models/vm_question_response_score_cell.rb - &lt;br /&gt;
&lt;br /&gt;
6. app/assets/stylesheets/grades.scss - &lt;br /&gt;
&lt;br /&gt;
7. app/views/grades/_add_icon_to_name.html.erb - &lt;br /&gt;
&lt;br /&gt;
8. spec/factories/factories.rb -&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Design Patterns ==&lt;br /&gt;
&lt;br /&gt;
Existing code does not use any design patterns, apart from if-else. It uses if-else conditional statements to check what type of questionnaire is present in the viewmodel `VmQuestionResponse`, and based on that, it renders the appropriate content.&lt;br /&gt;
&lt;br /&gt;
We decided to continue with this approach since to change the present coding style, there were required many changes (refactoring) to many files which were out of the scope of the present project. To complete the project in the assigned time, we followed the if-else approach.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;https://expertiza.ncsu.edu/&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Agarg25</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141767</id>
		<title>CSC/ECE 517 Fall 2021 - E2165. Fix teammate-review view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141767"/>
		<updated>2021-11-28T19:40:15Z</updated>

		<summary type="html">&lt;p&gt;Agarg25: /* Changes to the models */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Introduction ==&lt;br /&gt;
&lt;br /&gt;
Dr. Edward Gehringer (instructor), Parimal Mehta (mentor)&lt;br /&gt;
&lt;br /&gt;
1. Anjali Garg (unity ID : agarg25)&lt;br /&gt;
&lt;br /&gt;
2. Arvasu Chikara (unity ID: achikar2)&lt;br /&gt;
&lt;br /&gt;
3. Lalit Bangad (unity ID: llbangad)&lt;br /&gt;
&lt;br /&gt;
4. Vinay Deshmukh (unity ID: vdeshmu)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Problems to be addressed ==&lt;br /&gt;
&lt;br /&gt;
After a project is submitted and reviewed, both the team members (students) and instructors should be able to view the teammate reviews. Students should be able to view the reviews by going to a particular assignment's -&amp;gt; your scores, at the bottom of the page. An instructor can view the teammate reviews by going to assignments -&amp;gt; assignment -&amp;gt; particular team's submission -&amp;gt; view submission -&amp;gt; assign grades -&amp;gt; view scores. &lt;br /&gt;
&lt;br /&gt;
In the case of the instructor, a single heat grid is shown whereas in the case of a team member, we cant view the scores. In the heat grid, it is not clear if the scores visible are for the reviews that the student has *written* for their teammates or the scores that the student has *received* from their teammates. Additionally, for instructors can choose from a list of the students on the team, but they have no way to tell whether the heat grid shows the reviews done *by* that student or done *for* that student.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Methodology Overview ==&lt;br /&gt;
&lt;br /&gt;
We have divided our work in the following tasks to address the above problems:&lt;br /&gt;
&lt;br /&gt;
1. Distinguish reviews done for a student by rendering separates heatgrids for each student&lt;br /&gt;
&lt;br /&gt;
2. For instructors, the table will have sections based on the students&lt;br /&gt;
&lt;br /&gt;
3. Include a checkbox on the edit assignment page that enables/disables visibility of heat grid to students&lt;br /&gt;
&lt;br /&gt;
4. Fix the average column for a table (which breaks for some reviews)&lt;br /&gt;
&lt;br /&gt;
5. Show a composite score derived from all reviews.  Make this code generalized, so other kinds of heat grid views could use it.&lt;br /&gt;
&lt;br /&gt;
6. Changes should work even in an anonymized view&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Motivations ==&lt;br /&gt;
&lt;br /&gt;
1. Enable users to clearly tell which reviews are done by them, and which reviews are done for them.&lt;br /&gt;
&lt;br /&gt;
2. Code should be generic so it can be used for different types of heat grids as well.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Control Flow to access the concerned screens ==&lt;br /&gt;
'''1. For instructor (Log in as an instructor):-'''&lt;br /&gt;
&lt;br /&gt;
Screen after logging in by the instructor&lt;br /&gt;
[[File:ss1.png |border|1000px|center]]&lt;br /&gt;
Got to assignments on the Manage menu &lt;br /&gt;
[[File:ss2.png |border|1000px|center]]&lt;br /&gt;
Go to assignments&lt;br /&gt;
[[File:ss3.png |border|1000px|center]]&lt;br /&gt;
Go to submissions for any assignment&lt;br /&gt;
[[File:ss4a.png |border|1000px|center]]&lt;br /&gt;
Go to Assign Grade&lt;br /&gt;
[[File:ss5a.png |border|1000px|center]]&lt;br /&gt;
You will land on the page where the changes are made and can be reviewed&lt;br /&gt;
[[File:ss7a.png |border|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
'''2. Student:- (Instructor impersonating a student)'''&lt;br /&gt;
&lt;br /&gt;
After landing on the assignments page, select any student from an assignment as shown below&lt;br /&gt;
[[File:ss6a.png |border|1000px|center]]&lt;br /&gt;
Go to/Select any assignment&lt;br /&gt;
[[File:ss9a.png |border|1000px|center]]&lt;br /&gt;
Go to your scores&lt;br /&gt;
[[File:ss10a.png |border|1000px|center]]&lt;br /&gt;
You will land on the page where the changes are made and can be reviewed&lt;br /&gt;
[[File:ss11a.png |border|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
== Old Status of the application ==&lt;br /&gt;
&lt;br /&gt;
'''1. Instructor's view of teammate review''': This is the current screen given to the instructor. Here we see that the instructor can not determine who has given which review to which student in a team.&lt;br /&gt;
&lt;br /&gt;
[[File:Instructor-view-1.png|border| 700px |center|alt=The proposed expanded student display.|The proposed expanded student display.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2. Student's view of teammate review''': Currently, a student is not able to see what grades were given by their teammates. We need to implement that functionality so that the student is able to view those grades.&lt;br /&gt;
&lt;br /&gt;
[[File:Student-view-2.png|border| 700px |center|alt=The current instructor view.|The current review display for instructors.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Error in existing UI for student''': In the existing UI for a student, the highlighted block should not be rendered. This part of the screen is meant for the instructors/TAs. &lt;br /&gt;
&lt;br /&gt;
[[File:Wrong render for student.png|border|700px|center|alt=Existing UI for student|Existing UI for student.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Proposed changes ==&lt;br /&gt;
&lt;br /&gt;
''' 1) Proposed UI for instructor ''': The instructor is able to see the score for all teammates. In the existing code, only one teammate's scores are being shown. But, we are planning to change the way the (VmQuestionResponse array is populated)[https://github.com/expertiza/expertiza/blob/master/app/controllers/grades_controller.rb#L114], so that the scores for all teammates are appended to it so it correctly shows what should have already been shown in this screen for the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Proposed_screen.png|border|700px|center|alt=Proposed UI for instructor|Proposed UI for instructor.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: When a student visits this screen, they will only be shown the reviews received by them, assuming the instructor has allowed visibility of teammate reviews to students.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' 2) Show detailed review for a particular question''': The instructor can see detailed review given to a student by their teammates by clicking on a particular question number in the table.&lt;br /&gt;
&lt;br /&gt;
[[File:ss12a.png|border|700px|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' 3) Show teammate review to student UI ''': The existing code doesn't render a student's teammate review scores at all. We are planning to render the scores to a student (as shown below) when they visit this screen. However, the visibility of this screen is contingent on whether the instructor has allowed visibility of the teammate review screen to students. If the instructor has disabled this feature, then the heatgrid will not be displayed at all.&lt;br /&gt;
&lt;br /&gt;
[[File:UI_for_student.png|border|700px|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== User Stories ==&lt;br /&gt;
&lt;br /&gt;
1. As an instructor, I can view what reviews one teammate has given to other teammates.&lt;br /&gt;
&lt;br /&gt;
2. As a student, I can view what reviews my teammates have given to me.&lt;br /&gt;
&lt;br /&gt;
3. As an instructor, I can choose if I want to see all student's teammates reviews together or one by one.&lt;br /&gt;
&lt;br /&gt;
4. As a student, if I am also a TA for another subject, I should not be able to see an instructor's view to the view_team page.&lt;br /&gt;
&lt;br /&gt;
5. As an instructor, I should be able to see the name of the reviewers for the reviews to a particular student.&lt;br /&gt;
&lt;br /&gt;
== UML diagram for the system ==  &lt;br /&gt;
&lt;br /&gt;
[[File:vie_team_use_case.png|border|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Changes to the models ==&lt;br /&gt;
&lt;br /&gt;
== Explanation of fixes ==&lt;br /&gt;
&lt;br /&gt;
The below diagram illustrates the proposed code change for showing all team members with the teammate review data to an instructor. The existing code only iterated on the `Participant` whose ID is present in the URL of the page. To fix this, we will iterate over all teammates of the given participant so that all teammate reviews for all team members are shown to the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Logic e2165.png|border|center|alt=Flow diagram of proposed changes for showing team review data to instructor]]&lt;br /&gt;
&lt;br /&gt;
===Changes made to the code are shown below. Every change is shown and explained separately===&lt;br /&gt;
&lt;br /&gt;
====A. Added the following to app/assets/stylesheets/grades.scss:====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    .teammate_table.hidden {&lt;br /&gt;
      display: none;&lt;br /&gt;
      }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====B. In app/controllers/grades_controller.rb: ====&lt;br /&gt;
&lt;br /&gt;
'''B.1:'''&lt;br /&gt;
&lt;br /&gt;
Old code: The existing code does not differentiate when adding a view model for the TeammateReview questionnaire&lt;br /&gt;
  questionnaires.each do |questionnaire|&lt;br /&gt;
     ...&lt;br /&gt;
     @vmlist &amp;lt;&amp;lt; populate_view_model(questionnaire)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
New code: Since the current page URL contains an ID for the participant, from which we get an assignment, which gives us a list of questionnaires, we need to iterate all participants for a `TeammateReveiwQuestionnaire` questionnaire, so that we get the heatgrid view models for all members of a team.&lt;br /&gt;
  questionnaires.each do |questionnaire|&lt;br /&gt;
     ...&lt;br /&gt;
     if questionnaire.type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
        # as teammate review will be different for each participant&lt;br /&gt;
        # we need to create a separate table for each teammate&lt;br /&gt;
        @participant.team.participants.each do |team_participant|&lt;br /&gt;
          @vmlist &amp;lt;&amp;lt; populate_view_model(team_participant, questionnaire, @team)&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        # only one participant needs iterating, as apart from teammatereview&lt;br /&gt;
        # all other reviews are at &amp;quot;team&amp;quot; level&lt;br /&gt;
        @vmlist &amp;lt;&amp;lt; populate_view_model(@participant, questionnaire, @team)&lt;br /&gt;
      end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
'''B.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code: This code uses @participant as an instance variable, but this structure will not work as we need to call this ViewModel with multiple participants when iterating for a teammate review questionnaire.&lt;br /&gt;
    def populate_view_model(questionnaire)&lt;br /&gt;
      vm = VmQuestionResponse.new(questionnaire, @assignment, @round)&lt;br /&gt;
      vmquestions = questionnaire.questions&lt;br /&gt;
      vm.add_questions(vmquestions)&lt;br /&gt;
      vm.add_team_members(@team)&lt;br /&gt;
      vm.add_reviews(@participant, @team, @assignment.vary_by_round)&lt;br /&gt;
      vm.number_of_comments_greater_than_10_words&lt;br /&gt;
      vm &lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
New code: We need to call this function with a separate participant in each invocation due to our change for TeammateReviewQuestionnaire, hence it makes sense to make `participant` as an argument to this function. Similarly, as `team` is a closely related model to `participant`, we are passing it as an argument, to keep this function as &amp;quot;pure&amp;quot; as possible.&lt;br /&gt;
    def populate_view_model(participant, questionnaire, team)&lt;br /&gt;
      ...&lt;br /&gt;
      vm.add_team_members(team)&lt;br /&gt;
      vm.add_reviews(participant, team, @assignment.vary_by_round)&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
====C. In app/models/vm_question_response.rb:====&lt;br /&gt;
&lt;br /&gt;
'''C.1: '''Added the reviewee_id method: Created a helper method within the VmQuestionReponse model to retrieve the `reviewee_id` for a heatgrid&lt;br /&gt;
&lt;br /&gt;
    def reviewee_id&lt;br /&gt;
      @participant_who_is_reviewee.user_id&lt;br /&gt;
    end &lt;br /&gt;
&lt;br /&gt;
'''C.2: '''Added the reviewee_name method: Created a helper method within the VmQuestionReponse model to retrieve the name of the student who is being reviewed for a heatgrid. This method uses the functionality to anonymize the name when we are in anonymized view.&lt;br /&gt;
&lt;br /&gt;
    def reviewee_name(ip_address = nil)&lt;br /&gt;
      part = @participant_who_is_reviewee&lt;br /&gt;
      User.find_by(id: part.user_id).fullname(ip_address)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''C.3: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Does not keep track of the student being reviewed&lt;br /&gt;
    elsif @questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
      reviews = participant.teammate_reviews&lt;br /&gt;
      reviews.each do |review|&lt;br /&gt;
        review_mapping = TeammateReviewResponseMap.find_by(id: review.map_id)&lt;br /&gt;
        participant = Participant.find(review_mapping.reviewer_id)&lt;br /&gt;
&lt;br /&gt;
New code: Add an instance variable to keep track of the student who is being reviewed in this VmQuestionReponse&lt;br /&gt;
    elsif @questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
      reviews = participant.teammate_reviews&lt;br /&gt;
      @participant_who_is_reviewee = participant&lt;br /&gt;
      reviews.each do |review|&lt;br /&gt;
        review_mapping = TeammateReviewResponseMap.find_by(id: review.map_id)&lt;br /&gt;
        participant = Participant.find(review_mapping.reviewer_id)&lt;br /&gt;
&lt;br /&gt;
'''C.4: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing VmQuestionReponseScoreCell keeps no information about the reviewer, as it only stores the answer score&lt;br /&gt;
    row.score_row.push(VmQuestionResponseScoreCell.new(answer.answer, color_code, answer.comments, vm_tag_prompts))&lt;br /&gt;
&lt;br /&gt;
New code: Keep track of the response ID, so that we can retrieve the user ID for the reviewer in the model to use in the view file.&lt;br /&gt;
    &lt;br /&gt;
    row.score_row.push(VmQuestionResponseScoreCell.new(answer.answer, color_code, answer.comments, vm_tag_prompts, answer.response_id))&lt;br /&gt;
&lt;br /&gt;
====D. In app/models/vm_question_response_score_cell.rb:====&lt;br /&gt;
&lt;br /&gt;
'''D.1: '''In the method initialize of class VmQuestionResponseScoreCell&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't keep track of the response id&lt;br /&gt;
    def initialize(score_value, color_code, comments, vmprompts = nil)&lt;br /&gt;
      @score_value = score_value&lt;br /&gt;
      @color_code = color_code&lt;br /&gt;
      @comment = comments&lt;br /&gt;
      @vm_prompts = vmprompts&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
New code: We added an instance variable to keep track of response_id&lt;br /&gt;
&lt;br /&gt;
    def initialize(score_value, color_code, comments, vmprompts = nil, response_id)&lt;br /&gt;
      ...&lt;br /&gt;
      @response_id = response_id&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''D.2: '''Added a method reviewer_id to the class VmQuestionResponseScoreCell: This helper method retrieves the ID for the reviewer who created this response.&lt;br /&gt;
&lt;br /&gt;
    def reviewer_id&lt;br /&gt;
      resp = Response.find(@response_id)&lt;br /&gt;
      map = ResponseMap.find(resp.map_id)&lt;br /&gt;
      map.reviewer_id&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
====E. In app/views/grades/_add_icon_to_name.html.erb:====&lt;br /&gt;
&lt;br /&gt;
'''E.1 '''Added the following code to the file: Write the code to generate the review text only once to reduce WET code&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;%# Determine the content of the reviewed by text %&amp;gt;&lt;br /&gt;
    &amp;lt;% review_text = &amp;quot;&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% if @current_role_name.eql?'Student' or questionnaire_type != &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
      &amp;lt;%# Use Review {{index}} format for student view, and when questionnaire_type is not teammatereview %&amp;gt;&lt;br /&gt;
      &amp;lt;% review_text = &amp;quot;Review #{i + 1}&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;% resp = Response.find(review.id) %&amp;gt;&lt;br /&gt;
      &amp;lt;% map = ResponseMap.find(resp.map_id) %&amp;gt;&lt;br /&gt;
      &amp;lt;% reviewer_id = map.reviewer_id %&amp;gt;&lt;br /&gt;
      &amp;lt;% fullname = Participant.find_by(id: reviewer_id).fullname(session[:ip]) %&amp;gt;&lt;br /&gt;
      &amp;lt;% review_text = &amp;quot;Review by #{fullname}&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% end%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''E.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code is very unreadable as it's not indented, and written in a single line with 359 characters, which breaks the ruby style guide rules&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;% if review.done_by_staff_participant? %&amp;gt;&lt;br /&gt;
      &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt; &amp;lt;img data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Icon indicates this review was done by course staff&amp;quot; class=&amp;quot;img_icon&amp;quot; src=&amp;quot;/assets/staff.png&amp;quot;&amp;gt; &amp;lt;a target=&amp;quot;_blank&amp;quot; href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Click to see details&amp;quot;&amp;gt;&amp;lt;%= &amp;quot;Review &amp;quot; + i.to_s  %&amp;gt;&amp;lt;/a&amp;gt; &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt; &amp;lt;a target=&amp;quot;_blank&amp;quot; href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Click to see details&amp;quot;&amp;gt;&amp;lt;%= &amp;quot;Review &amp;quot; + i.to_s %&amp;gt;&amp;lt;/a&amp;gt;  &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Correctly indented and removes WET repetition of code blocks and makes the resulting code DRYer&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;% if review.done_by_staff_participant? %&amp;gt;&lt;br /&gt;
      &amp;lt;img&lt;br /&gt;
      data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
      data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
      title=&amp;quot;Icon indicates this review was done by course staff&amp;quot; class=&amp;quot;img_icon&amp;quot;&lt;br /&gt;
      src=&amp;quot;/assets/staff.png&amp;quot;&lt;br /&gt;
      &amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;a&lt;br /&gt;
      target=&amp;quot;_blank&amp;quot;&lt;br /&gt;
      href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;&lt;br /&gt;
      data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
      data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
      title=&amp;quot;Click to see details&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;%= review_text %&amp;gt;&lt;br /&gt;
    &amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====F.In app/views/grades/view_team.html.erb:====&lt;br /&gt;
&lt;br /&gt;
'''F.1: '''Added function teammateSelectOnChange: This function toggles the visibility for the teammate heatgrids when the instructor changes the dropdown&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  function teammateSelectOnChange(selectNode) {&lt;br /&gt;
      const revieweeIdToShow= selectNode.value;&lt;br /&gt;
      const tableSelector = &amp;quot;.teammate_table&amp;quot;;&lt;br /&gt;
      if(revieweeIdToShow == &amp;quot;all&amp;quot;) {&lt;br /&gt;
        document.querySelectorAll(tableSelector).forEach((tableNode) =&amp;gt; {&lt;br /&gt;
          tableNode.classList.remove(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
        });&lt;br /&gt;
        return;&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
    document.querySelectorAll(tableSelector).forEach((tableNode) =&amp;gt; {&lt;br /&gt;
      const tableRevieweeId = tableNode.getAttribute('data-reviewee_id');&lt;br /&gt;
      if(tableRevieweeId == revieweeIdToShow) {&lt;br /&gt;
        tableNode.classList.remove(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
      } else {&lt;br /&gt;
        tableNode.classList.add(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
      }&lt;br /&gt;
      });&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't render TeammateReviewQuestionnaire&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;% @vmlist.each do |vm| %&amp;gt;&lt;br /&gt;
        &amp;lt;% if (vm.questionnaire_display_type == &amp;quot;Metareview&amp;quot; or vm.questionnaire_display_type == &amp;quot;Author Feedback&amp;quot; or vm.questionnaire_display_type == &amp;quot;Teammate Review&amp;quot;) and @current_role_name.eql?'Student' %&amp;gt;&lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
        &amp;lt;% if vm.list_of_reviewers.length &amp;gt; 0 %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Use a boolean to render a dropdown (that contains the students' IDs and names) just before the first TeammateReviewQuestionnaire, and unset that boolean so we only render 1 table. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;%# This boolean is used to render a dropdown just before the first teammate review heat grid %&amp;gt;&lt;br /&gt;
&amp;lt;% first_teammate_review_appeared = false %&amp;gt;&lt;br /&gt;
&amp;lt;% @vmlist.each do |vm| %&amp;gt;&lt;br /&gt;
     &amp;lt;% if (not @current_role_name.eql?'Student' and&lt;br /&gt;
        not first_teammate_review_appeared and&lt;br /&gt;
        vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; &lt;br /&gt;
      ) %&amp;gt;&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        &amp;lt;select onchange=&amp;quot;teammateSelectOnChange(this)&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;all&amp;quot;&amp;gt;All&amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;% @vmlist.select { |tm_vm| tm_vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; }.each do |tm_vm| %&amp;gt;&lt;br /&gt;
            &amp;lt;option value=&amp;quot;&amp;lt;%= tm_vm.reviewee_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;%= tm_vm.reviewee_name(session[:ip]) %&amp;gt;&lt;br /&gt;
            &amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
        &amp;lt;/select&amp;gt;&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;% first_teammate_review_appeared = true %&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Add conditions which check for the truthiness of ```@assignment.show_teammate_reviews``` and if the current user is a student to decide whether to render the table or not.  Since the existing code checks truthiness for the cases for which NOT to render a table, we have followed the existing style of the code.&lt;br /&gt;
&lt;br /&gt;
1) If type of view model is teammate review questionnaire, and current role is student, and if @assignment.show_teammate_reviews is false, then we don't render anything&lt;br /&gt;
2) If type of view model is teammate review questionnaire, and current role is student, but @assignment.show_teammate_reviews is true, then we don't render anything if the current reviewer_id is different to the currently logged in user.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;% if (vm.questionnaire_display_type == &amp;quot;Metareview&amp;quot; or vm.questionnaire_display_type == &amp;quot;Author Feedback&amp;quot;) and @current_role_name.eql?'Student' %&amp;gt;&lt;br /&gt;
    &amp;lt;% elsif (&lt;br /&gt;
      vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; and&lt;br /&gt;
      @current_role_name.eql?'Student' and&lt;br /&gt;
      !@assignment.show_teammate_reviews&lt;br /&gt;
      ) %&amp;gt;&lt;br /&gt;
    &amp;lt;% elsif (&lt;br /&gt;
      vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; and &lt;br /&gt;
      @current_role_name.eql?'Student' and&lt;br /&gt;
      @assignment.show_teammate_reviews and current_user.id != vm.reviewee_id&lt;br /&gt;
      )%&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Finally, add a CSS class and a `data-reviewee_id` to keep track of the heatgrids when toggling visibility.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
        &amp;lt;% if vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
          &amp;lt;div class=&amp;quot;teammate_table&amp;quot; data-reviewee_id=&amp;quot;&amp;lt;%= vm.reviewee_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
        &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.3  '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't print the teammate who is being reviewed.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
          &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
            &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: If TeammteReviewQuestionnaire is used, then use the `:reviewee_name` method for VmQuestionResponse model to print the name of the student who is being reviewed.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
          &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
            &amp;lt;% elsif vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (For: &amp;lt;%= vm.reviewee_name(session[:ip]) %&amp;gt;)&lt;br /&gt;
            &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.4 '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't inform the partial about the type of review being done&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_reviews.each do |review| %&amp;gt;&lt;br /&gt;
              &amp;lt;!-- instructors (or higher level users) see reviewer name, students see anonymized string --&amp;gt;&lt;br /&gt;
              &amp;lt;% if (['Student'].include? @current_role_name) &amp;amp;&amp;amp; @assignment.is_anonymous%&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i} %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                  &amp;lt;% user_name = User.find(Participant.find(ResponseMap.find(Response.find(review.id).map_id).reviewer_id).user_id).fullname(session[:ip]).to_s %&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i} %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% i += 1 %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
New code: Passes the type of review being done to the partial, so it can decide on how to render the review title. Note: This code seems to use repetition, but since the conditional used here are accessing `Anonymous` assignments and checking for user roles, we have not modified this code, as it is not directly related to our scope.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_reviews.each do |review| %&amp;gt;&lt;br /&gt;
              &amp;lt;!-- instructors (or higher level users) see reviewer name, students see anonymized string --&amp;gt;&lt;br /&gt;
              &amp;lt;% if (['Student'].include? @current_role_name) &amp;amp;&amp;amp; @assignment.is_anonymous%&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i, questionnaire_type: vm.questionnaire_type } %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                &amp;lt;% user_name = User.find(Participant.find(ResponseMap.find(Response.find(review.id).map_id).reviewer_id).user_id).fullname(session[:ip]).to_s %&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i, questionnaire_type: vm.questionnaire_type } %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% i += 1 %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Old code: Contains a `metrics-1` column&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-true&amp;quot; align=&amp;quot;right&amp;quot; &amp;gt;&lt;br /&gt;
            Avg&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;span  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;A count of comments, for the respective question, which have word count &amp;gt; 10. The purpose of this metric is to represent how many comments for the question are of a substantial length to provide quality feedback.&amp;quot;&amp;gt;metric-1&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/thead&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
New code: As per discussion with mentor, this column has been removed in our PR.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-true&amp;quot; align=&amp;quot;right&amp;quot; &amp;gt;&lt;br /&gt;
            Avg&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/thead&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.5 '''&lt;br /&gt;
&lt;br /&gt;
Old code: It creates the ID inline in multiple places, so if we decide to change the ID generation logic, we need to modify it in multiple places. (which happened when we started rendering multiple tables for each teammate).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_rows.each do |row| %&amp;gt;&lt;br /&gt;
            &amp;lt;!-- notice the data-target. because we're toggling via looped code, we need to dynamically generate the identifier. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr data-toggle=&amp;quot;collapse&amp;quot; class=&amp;quot;accordion-toggle&amp;quot; data-target=&amp;quot;#hid&amp;lt;%= row.question_id.to_s + vm.round.to_s %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Generate the unique HTML ID once, in a readable manner once. And conditionally make it more unique, if it is a TeammateReviewQuestionnaire, since jQuery code requires these IDs to be unique amongst different tables. If we don't make it more unique, then clicking on one teammate review table will toggle the table visibility for the first table. To prevent this &amp;quot;clashing&amp;quot;, we need to make these IDs more unique for a TeammateReviewQuestionnaire.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_rows.each do |row| %&amp;gt;&lt;br /&gt;
            &amp;lt;% target_id = &amp;quot;hid__#{row.question_id}__#{vm.round}&amp;quot; %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
              &amp;lt;%# Since we render different heatgrids with the same questions for each&lt;br /&gt;
              teammember, we need to distinguish the ID, based on the user for whom,&lt;br /&gt;
              the reviews have been created. %&amp;gt;&lt;br /&gt;
              &amp;lt;% target_id += &amp;quot;__#{vm.reviewee_id}&amp;quot; %&amp;gt;&lt;br /&gt;
            &amp;lt;% end%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;!-- notice the data-target. because we're toggling via looped code, we need to dynamically generate the identifier. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr data-toggle=&amp;quot;collapse&amp;quot; class=&amp;quot;accordion-toggle&amp;quot; data-target=&amp;quot;&amp;lt;%= &amp;quot;#&amp;quot; + target_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Old code: Written on a single line crossing 80 characters on a single line&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
              &amp;lt;% row.score_row.each do |score| %&amp;gt;&lt;br /&gt;
                  &amp;lt;% score_comment = score.comment.nil? ? '' : score.comment %&amp;gt; &amp;lt;!-- changing nil to null string to avoid Null Pointer Exception --&amp;gt;&lt;br /&gt;
                  &amp;lt;td class=&amp;quot;&amp;lt;%= score.color_code %&amp;gt;&amp;quot; align=&amp;quot;center&amp;quot; data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= strip_tags(score.comment).html_safe%&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;&amp;lt;%=  underlined?(score) %&amp;gt;&amp;quot;&amp;gt;&amp;lt;%= score.score_value.to_s %&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
                  &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
New code: Make code more readable by indenting it and splitting it over multiple lines&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
              &amp;lt;!-- actual cells with scores and colored background. --&amp;gt;&lt;br /&gt;
              &amp;lt;% row.score_row.each do |score| %&amp;gt;&lt;br /&gt;
                  &amp;lt;% score_comment = score.comment.nil? ? '' : score.comment %&amp;gt;&lt;br /&gt;
                  &amp;lt;!-- changing nil to null string to avoid Null Pointer Exception --&amp;gt;&lt;br /&gt;
                  &amp;lt;td class=&amp;quot;&amp;lt;%= score.color_code %&amp;gt;&amp;quot; align=&amp;quot;center&amp;quot; data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= strip_tags(score.comment).html_safe%&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;&amp;lt;%=  underlined?(score) %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                      &amp;lt;%= score.score_value.to_s %&amp;gt;&lt;br /&gt;
                    &amp;lt;/span&amp;gt;&lt;br /&gt;
                  &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.6 '''Removed the following code as it corresponds to the deleted column&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 &amp;lt;td  class = 'cf' align=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;%= row.countofcomments.to_s %&amp;gt;&lt;br /&gt;
              &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.7 '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code just unconditionally prints the text &amp;quot;Review&amp;quot; followed by an index.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                    &amp;lt;% for index in 0 .. row.score_row.length - 1 %&amp;gt;&lt;br /&gt;
                        &amp;lt;tr&amp;gt;&lt;br /&gt;
                          &amp;lt;td&amp;gt;Review &amp;lt;%=index + 1%&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Conditionally change the review text that is displayed based on the type of review and the access level of the user&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                    &amp;lt;% for index in 0 .. row.score_row.length - 1 %&amp;gt;&lt;br /&gt;
                        &amp;lt;tr&amp;gt;&lt;br /&gt;
                          &amp;lt;% if @current_role_name.eql?'Student' or vm.questionnaire_type != &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                            &amp;lt;%# Use Review {{index}} format for student view, and&lt;br /&gt;
                            when questionnaire_type is not teammatereview %&amp;gt;&lt;br /&gt;
                            &amp;lt;td&amp;gt;Review &amp;lt;%=index + 1%&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
                          &amp;lt;% else %&amp;gt;&lt;br /&gt;
                            &amp;lt;td&amp;gt;&lt;br /&gt;
                              &amp;lt;% reviewer_id = row.score_row[index].reviewer_id %&amp;gt;&lt;br /&gt;
                              &amp;lt;% fullname = Participant.find_by(id: reviewer_id).fullname(session[:ip]) %&amp;gt;&lt;br /&gt;
                              Review by &amp;lt;%= fullname %&amp;gt;&lt;br /&gt;
                            &amp;lt;/td&amp;gt;&lt;br /&gt;
                          &amp;lt;% end%&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====G. In spec/controllers/grades_controller_spec.rb:====&lt;br /&gt;
&lt;br /&gt;
'''G.1 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
before(:each) do&lt;br /&gt;
  allow(AssignmentParticipant).to receive(:find).with('1').and_return(participant)&lt;br /&gt;
  allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
  stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
@@ -91,29 +90,106 @@&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
before(:each) do&lt;br /&gt;
  allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
  stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
@@ -91,29 +90,106 @@&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''G.2 '''Remove xdescribe '#view_team' and change describe '#view_team' as follows.&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#view_team' do&lt;br /&gt;
render_views&lt;br /&gt;
context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
  it 'renders grades#view_team page' do&lt;br /&gt;
    allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
    allow(AssignmentQuestionnaire).to receive(:find_by).with(assignment_id: 1, questionnaire_id: 1).and_return(assignment_questionnaire)&lt;br /&gt;
    allow(AssignmentQuestionnaire).to receive(:where).with(any_args).and_return([assignment_questionnaire])&lt;br /&gt;
    allow(assignment).to receive(:late_policy_id).and_return(false)&lt;br /&gt;
    allow(assignment).to receive(:calculate_penalty).and_return(false)&lt;br /&gt;
    allow(assignment).to receive(:compute_total_score).with(any_args).and_return(100)&lt;br /&gt;
    allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
    allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
    params = {id: 1}&lt;br /&gt;
    allow(TaMapping).to receive(:exists?).with(ta_id: 1, course_id: 1).and_return(true)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#view_team' do&lt;br /&gt;
render_views&lt;br /&gt;
&lt;br /&gt;
# All stubs and factories are instantiated within this scope so as to not &lt;br /&gt;
# clash with other broken test.&lt;br /&gt;
# The names of the factories created for testing view_team&lt;br /&gt;
# have `_vt` suffix ```where necessary``` to differentiate them from &lt;br /&gt;
# the above declared factories&lt;br /&gt;
&lt;br /&gt;
let(:student1_vt) { create(:student, name: &amp;quot;barry&amp;quot;, id: 12) }&lt;br /&gt;
let(:student2_vt) { create(:student, name: &amp;quot;iris&amp;quot;, id: 13) }&lt;br /&gt;
&lt;br /&gt;
let(:tm_questionnaire) {&lt;br /&gt;
  build(&lt;br /&gt;
    :teammate_review_questionnaire,&lt;br /&gt;
    id: 12,&lt;br /&gt;
    questions: [question],&lt;br /&gt;
    max_question_score: 5&lt;br /&gt;
  )&lt;br /&gt;
}&lt;br /&gt;
let(:assignment_vt) {&lt;br /&gt;
  create(:assignment, id: 6, max_team_size: 2,&lt;br /&gt;
  questionnaires: [tm_questionnaire])&lt;br /&gt;
}&lt;br /&gt;
let(:assignment_questionnaire_vt) {&lt;br /&gt;
  create(:tm_assignment_questionnaire, id: 12, used_in_round: nil,&lt;br /&gt;
  assignment: assignment_vt, questionnaire: tm_questionnaire) }&lt;br /&gt;
let(:team_vt) { create(:assignment_team, id: 12,&lt;br /&gt;
assignment: assignment_vt) }&lt;br /&gt;
let(:participant_vt) { create(:participant, id: 12,&lt;br /&gt;
  assignment: assignment_vt, user_id: student1_vt.id) }&lt;br /&gt;
let(:participant2_vt) { create(:participant, id: 13,&lt;br /&gt;
  assignment: assignment_vt, user_id: student2_vt.id) }&lt;br /&gt;
&lt;br /&gt;
before(:each) do&lt;br /&gt;
  # Need to stub this method so the factory instance with&lt;br /&gt;
  # the stubbed :team method is returned by :find&lt;br /&gt;
  # instead of a separate instance with the same data&lt;br /&gt;
  allow(AssignmentParticipant)&lt;br /&gt;
    .to receive(:find)&lt;br /&gt;
    .with(participant_vt.id.to_s)&lt;br /&gt;
    .and_return(participant_vt)&lt;br /&gt;
  allow(participant_vt).to receive(:team).and_return(team_vt)&lt;br /&gt;
  allow(team_vt).to receive(:participants).and_return([participant_vt, participant2_vt])&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:find_by)&lt;br /&gt;
    .with(assignment_id: assignment_vt.id, questionnaire_id: tm_questionnaire.id)&lt;br /&gt;
    .and_return(assignment_questionnaire_vt)&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:find_by)&lt;br /&gt;
    .with(assignment_id: assignment.id, questionnaire_id: review_questionnaire.id)&lt;br /&gt;
    .and_return(assignment_questionnaire_vt)&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:where)&lt;br /&gt;
    .with(any_args)&lt;br /&gt;
    .and_return([assignment_questionnaire_vt])&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:late_policy_id)&lt;br /&gt;
    .and_return(false)&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:calculate_penalty)&lt;br /&gt;
    .and_return(false)&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:compute_total_score)&lt;br /&gt;
    .with(any_args)&lt;br /&gt;
    .and_return(100)&lt;br /&gt;
  allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
  allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
 it 'renders grades#view_team page' do&lt;br /&gt;
  params = {id: participant_vt.id}&lt;br /&gt;
  get :view_team, params&lt;br /&gt;
  expect(response).to render_template(:view_team)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is opened by student' do&lt;br /&gt;
  it 'dropdown is not rendered' do&lt;br /&gt;
    session = { user: student1_vt }&lt;br /&gt;
    params = {id: participant_vt.id}&lt;br /&gt;
    stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
    get :view_team, params&lt;br /&gt;
    expect(response.body).to_not have_selector('select')&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is opened by instructor' do&lt;br /&gt;
  it 'dropdown is rendered' do&lt;br /&gt;
    session = { user: instructor }&lt;br /&gt;
    params = {id: participant_vt.id}&lt;br /&gt;
    get :view_team, params&lt;br /&gt;
    expect(response.body).to have_selector('select')&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
  it 'renders grades#view_team page' do&lt;br /&gt;
    params = { id: participant_vt.id }&lt;br /&gt;
    allow(TaMapping).to receive(:exists?).with(ta_id: participant_vt.user_id, course_id: 1).and_return(true)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====H. In spec/factories/factories.rb:====&lt;br /&gt;
&lt;br /&gt;
'''H.1 '''Add the following factory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
factory :teammate_review_questionnaire, class: TeammateReviewQuestionnaire do&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''H.2 '''Add another factory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
factory :tm_assignment_questionnaire, class: AssignmentQuestionnaire do&lt;br /&gt;
  user_id 1&lt;br /&gt;
  questionnaire { association(:teammate_review_questionnaire) }&lt;br /&gt;
  questionnaire_weight 100&lt;br /&gt;
  used_in_round nil&lt;br /&gt;
  topic_id nil&lt;br /&gt;
  dropdown 1&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
The tests written as a part of this project can be run by running the following command on terminal:&lt;br /&gt;
&lt;br /&gt;
1. rspec ./spec/controllers/grades_controller_spec.rb  -e &amp;quot;#view_team&amp;quot;&lt;br /&gt;
&lt;br /&gt;
2. rspec .vm_question_response_score_cell_spec.rb  -e &amp;quot;#reviewer_id&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''OLD STATUS'''&lt;br /&gt;
&lt;br /&gt;
1. Earlier, the tests contained an xdescribe test to check if the view_team page is rendered correctly. However, this test was being skipped as this was an xdescribe segment. There was another test for when the view_team page is accessed by a student who is also a TA for another course. This can be checked [https://github.com/expertiza/expertiza/blob/beta/spec/controllers/grades_controller_spec.rb here].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 xdescribe '#view_team' do&lt;br /&gt;
    it 'renders grades#view_team page' do&lt;br /&gt;
      allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
      params = {id: 1}&lt;br /&gt;
      get :view_team, params&lt;br /&gt;
      expect(response).to render_template(:view_team)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#view_team' do&lt;br /&gt;
    render_views&lt;br /&gt;
    context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
      it 'renders grades#view_team page' do&lt;br /&gt;
        allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
        allow(AssignmentQuestionnaire).to receive(:find_by).with(assignment_id: 1, questionnaire_id: 1).and_return(assignment_questionnaire)&lt;br /&gt;
        allow(AssignmentQuestionnaire).to receive(:where).with(any_args).and_return([assignment_questionnaire])&lt;br /&gt;
        allow(assignment).to receive(:late_policy_id).and_return(false)&lt;br /&gt;
        allow(assignment).to receive(:calculate_penalty).and_return(false)&lt;br /&gt;
        allow(assignment).to receive(:compute_total_score).with(any_args).and_return(100)&lt;br /&gt;
        allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
        allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
        params = {id: 1}&lt;br /&gt;
        allow(TaMapping).to receive(:exists?).with(ta_id: 1, course_id: 1).and_return(true)&lt;br /&gt;
        stub_current_user(ta, ta.role.name, ta.role)&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).not_to have_content &amp;quot;TA&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''NEW STATUS'''&lt;br /&gt;
&lt;br /&gt;
1. The view_team page is rendered correctly for a given student or an instructor. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    it 'renders grades#view_team page' do&lt;br /&gt;
      params = {id: participant_vt.id}&lt;br /&gt;
      get :view_team, params&lt;br /&gt;
      expect(response).to render_template(:view_team)&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. When students access then the view_team page, the dropdown to select a student's teammate reviews is not rendered on the page. The dropdown is rendered if the page is accessed by an instructor. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   context 'dropdown for selecting a teammate review' do&lt;br /&gt;
    render_views&lt;br /&gt;
      it 'is not rendered is not rendered when page is opened by student' do&lt;br /&gt;
        session = { user: student1_vt }&lt;br /&gt;
        params = {id: participant_vt.id}&lt;br /&gt;
        stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to_not have_selector('select')&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      it 'is rendered when page is opened by instructor' do&lt;br /&gt;
        session = { user: instructor }&lt;br /&gt;
        params = {id: participant_vt.id}&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to have_selector('select')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. When a student who is also a TA for another course access the view_team page, that student should be able to a student's view to the page. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
      it 'renders grades#view_team page' do&lt;br /&gt;
        params = { id: participant_vt.id }&lt;br /&gt;
        allow(TaMapping).to receive(:exists?).with(ta_id: participant_vt.user_id, course_id: 1).and_return(true)&lt;br /&gt;
        stub_current_user(ta, ta.role.name, ta.role)&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).not_to have_content &amp;quot;TA&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. If show_teammate_reviews boolean is set to False, then the student should not be able to see the teammate reviews given to him/her. An instructor can still see the teammate reviews. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when assignment(show reviews) value is unchecked' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        allow(assignment_vt).to receive(:show_teammate_reviews).and_return(false) &lt;br /&gt;
      end&lt;br /&gt;
      it 'Student cannot view his score' do&lt;br /&gt;
        session = { user: student1_vt }&lt;br /&gt;
        params = {id: participant_vt.id}&lt;br /&gt;
        stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to_not have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
        expect(response.body).to_not have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant2_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      it 'Instructor can view the student score' do        &lt;br /&gt;
        params = {id: participant_vt.id}        &lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
        expect(response.body).to have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant2_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. If show_teammate_reviews boolean is set to True, then both the student should and instructor should be able to see the teammate reviews. The student should see only the reviews received by him/her. The instructor should be able to see all student's teammate reviews. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    context 'when assignment(show reviews) value is checked' do&lt;br /&gt;
      it 'Student can view his score' do&lt;br /&gt;
        session = { user: student1_vt }&lt;br /&gt;
        params = {id: participant_vt.id}&lt;br /&gt;
        stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
        expect(response.body).to_not have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant2_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      it 'Instructor can view the student score' do        &lt;br /&gt;
        params = {id: participant_vt.id}        &lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
        expect(response.body).to have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant2_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. The reviewer id is tracked correctly to show the correct reviewer name in the teammate reviews table. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/models/vm_question_response_score_cell_spec.rb this] file &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  	describe '#reviewer_id' do&lt;br /&gt;
  		it 'returns reviewer id' do&lt;br /&gt;
			allow(ResponseMap).to receive(:find).with(1).and_return(review_response_map)&lt;br /&gt;
			allow(response).to receive(:populate_new_response).with(:review_response_map, &amp;quot;0&amp;quot;).and_return(response)&lt;br /&gt;
        	expect(response.id).to eq(1)	&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Summary of file changes ==&lt;br /&gt;
&lt;br /&gt;
The following files are modified:&lt;br /&gt;
&lt;br /&gt;
1. app/controllers/grades_controller.rb - Controller file which changed how the view model is populated&lt;br /&gt;
&lt;br /&gt;
2. app/views/grades/view_team.html.erb - View file, which  conditionally rendered the teammate name, for a teammate review heatgrid&lt;br /&gt;
&lt;br /&gt;
3. spec/controllers/grades_controller_spec.rb - For tests verifying the proposed changes&lt;br /&gt;
&lt;br /&gt;
4. app/models/vm_question_response.rb - To modify the view-model so it can tell us the name of the person being reviewed for the current heatgrid&lt;br /&gt;
&lt;br /&gt;
5. app/models/vm_question_response_score_cell.rb - &lt;br /&gt;
&lt;br /&gt;
6. app/assets/stylesheets/grades.scss - &lt;br /&gt;
&lt;br /&gt;
7. app/views/grades/_add_icon_to_name.html.erb - &lt;br /&gt;
&lt;br /&gt;
8. spec/factories/factories.rb -&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Design Patterns ==&lt;br /&gt;
&lt;br /&gt;
Existing code does not use any design patterns, apart from if-else. It uses if-else conditional statements to check what type of questionnaire is present in the viewmodel `VmQuestionResponse`, and based on that, it renders the appropriate content.&lt;br /&gt;
&lt;br /&gt;
We decided to continue with this approach since to change the present coding style, there were required many changes (refactoring) to many files which were out of the scope of the present project. To complete the project in the assigned time, we followed the if-else approach.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;https://expertiza.ncsu.edu/&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Agarg25</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Cd2.png&amp;diff=141766</id>
		<title>File:Cd2.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Cd2.png&amp;diff=141766"/>
		<updated>2021-11-28T19:39:52Z</updated>

		<summary type="html">&lt;p&gt;Agarg25: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Agarg25</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Cd1.png&amp;diff=141765</id>
		<title>File:Cd1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Cd1.png&amp;diff=141765"/>
		<updated>2021-11-28T19:39:40Z</updated>

		<summary type="html">&lt;p&gt;Agarg25: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Agarg25</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141764</id>
		<title>CSC/ECE 517 Fall 2021 - E2165. Fix teammate-review view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141764"/>
		<updated>2021-11-28T19:32:49Z</updated>

		<summary type="html">&lt;p&gt;Agarg25: /* Changes to the models */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Introduction ==&lt;br /&gt;
&lt;br /&gt;
Dr. Edward Gehringer (instructor), Parimal Mehta (mentor)&lt;br /&gt;
&lt;br /&gt;
1. Anjali Garg (unity ID : agarg25)&lt;br /&gt;
&lt;br /&gt;
2. Arvasu Chikara (unity ID: achikar2)&lt;br /&gt;
&lt;br /&gt;
3. Lalit Bangad (unity ID: llbangad)&lt;br /&gt;
&lt;br /&gt;
4. Vinay Deshmukh (unity ID: vdeshmu)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Problems to be addressed ==&lt;br /&gt;
&lt;br /&gt;
After a project is submitted and reviewed, both the team members (students) and instructors should be able to view the teammate reviews. Students should be able to view the reviews by going to a particular assignment's -&amp;gt; your scores, at the bottom of the page. An instructor can view the teammate reviews by going to assignments -&amp;gt; assignment -&amp;gt; particular team's submission -&amp;gt; view submission -&amp;gt; assign grades -&amp;gt; view scores. &lt;br /&gt;
&lt;br /&gt;
In the case of the instructor, a single heat grid is shown whereas in the case of a team member, we cant view the scores. In the heat grid, it is not clear if the scores visible are for the reviews that the student has *written* for their teammates or the scores that the student has *received* from their teammates. Additionally, for instructors can choose from a list of the students on the team, but they have no way to tell whether the heat grid shows the reviews done *by* that student or done *for* that student.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Methodology Overview ==&lt;br /&gt;
&lt;br /&gt;
We have divided our work in the following tasks to address the above problems:&lt;br /&gt;
&lt;br /&gt;
1. Distinguish reviews done for a student by rendering separates heatgrids for each student&lt;br /&gt;
&lt;br /&gt;
2. For instructors, the table will have sections based on the students&lt;br /&gt;
&lt;br /&gt;
3. Include a checkbox on the edit assignment page that enables/disables visibility of heat grid to students&lt;br /&gt;
&lt;br /&gt;
4. Fix the average column for a table (which breaks for some reviews)&lt;br /&gt;
&lt;br /&gt;
5. Show a composite score derived from all reviews.  Make this code generalized, so other kinds of heat grid views could use it.&lt;br /&gt;
&lt;br /&gt;
6. Changes should work even in an anonymized view&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Motivations ==&lt;br /&gt;
&lt;br /&gt;
1. Enable users to clearly tell which reviews are done by them, and which reviews are done for them.&lt;br /&gt;
&lt;br /&gt;
2. Code should be generic so it can be used for different types of heat grids as well.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Control Flow to access the concerned screens ==&lt;br /&gt;
'''1. For instructor (Log in as an instructor):-'''&lt;br /&gt;
&lt;br /&gt;
Screen after logging in by the instructor&lt;br /&gt;
[[File:ss1.png |border|1000px|center]]&lt;br /&gt;
Got to assignments on the Manage menu &lt;br /&gt;
[[File:ss2.png |border|1000px|center]]&lt;br /&gt;
Go to assignments&lt;br /&gt;
[[File:ss3.png |border|1000px|center]]&lt;br /&gt;
Go to submissions for any assignment&lt;br /&gt;
[[File:ss4a.png |border|1000px|center]]&lt;br /&gt;
Go to Assign Grade&lt;br /&gt;
[[File:ss5a.png |border|1000px|center]]&lt;br /&gt;
You will land on the page where the changes are made and can be reviewed&lt;br /&gt;
[[File:ss7a.png |border|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
'''2. Student:- (Instructor impersonating a student)'''&lt;br /&gt;
&lt;br /&gt;
After landing on the assignments page, select any student from an assignment as shown below&lt;br /&gt;
[[File:ss6a.png |border|1000px|center]]&lt;br /&gt;
Go to/Select any assignment&lt;br /&gt;
[[File:ss9a.png |border|1000px|center]]&lt;br /&gt;
Go to your scores&lt;br /&gt;
[[File:ss10a.png |border|1000px|center]]&lt;br /&gt;
You will land on the page where the changes are made and can be reviewed&lt;br /&gt;
[[File:ss11a.png |border|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
== Old Status of the application ==&lt;br /&gt;
&lt;br /&gt;
'''1. Instructor's view of teammate review''': This is the current screen given to the instructor. Here we see that the instructor can not determine who has given which review to which student in a team.&lt;br /&gt;
&lt;br /&gt;
[[File:Instructor-view-1.png|border| 700px |center|alt=The proposed expanded student display.|The proposed expanded student display.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2. Student's view of teammate review''': Currently, a student is not able to see what grades were given by their teammates. We need to implement that functionality so that the student is able to view those grades.&lt;br /&gt;
&lt;br /&gt;
[[File:Student-view-2.png|border| 700px |center|alt=The current instructor view.|The current review display for instructors.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Error in existing UI for student''': In the existing UI for a student, the highlighted block should not be rendered. This part of the screen is meant for the instructors/TAs. &lt;br /&gt;
&lt;br /&gt;
[[File:Wrong render for student.png|border|700px|center|alt=Existing UI for student|Existing UI for student.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Proposed changes ==&lt;br /&gt;
&lt;br /&gt;
''' 1) Proposed UI for instructor ''': The instructor is able to see the score for all teammates. In the existing code, only one teammate's scores are being shown. But, we are planning to change the way the (VmQuestionResponse array is populated)[https://github.com/expertiza/expertiza/blob/master/app/controllers/grades_controller.rb#L114], so that the scores for all teammates are appended to it so it correctly shows what should have already been shown in this screen for the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Proposed_screen.png|border|700px|center|alt=Proposed UI for instructor|Proposed UI for instructor.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: When a student visits this screen, they will only be shown the reviews received by them, assuming the instructor has allowed visibility of teammate reviews to students.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' 2) Show detailed review for a particular question''': The instructor can see detailed review given to a student by their teammates by clicking on a particular question number in the table.&lt;br /&gt;
&lt;br /&gt;
[[File:ss12a.png|border|700px|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' 3) Show teammate review to student UI ''': The existing code doesn't render a student's teammate review scores at all. We are planning to render the scores to a student (as shown below) when they visit this screen. However, the visibility of this screen is contingent on whether the instructor has allowed visibility of the teammate review screen to students. If the instructor has disabled this feature, then the heatgrid will not be displayed at all.&lt;br /&gt;
&lt;br /&gt;
[[File:UI_for_student.png|border|700px|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== User Stories ==&lt;br /&gt;
&lt;br /&gt;
1. As an instructor, I can view what reviews one teammate has given to other teammates.&lt;br /&gt;
&lt;br /&gt;
2. As a student, I can view what reviews my teammates have given to me.&lt;br /&gt;
&lt;br /&gt;
3. As an instructor, I can choose if I want to see all student's teammates reviews together or one by one.&lt;br /&gt;
&lt;br /&gt;
4. As a student, if I am also a TA for another subject, I should not be able to see an instructor's view to the view_team page.&lt;br /&gt;
&lt;br /&gt;
5. As an instructor, I should be able to see the name of the reviewers for the reviews to a particular student.&lt;br /&gt;
&lt;br /&gt;
== UML diagram for the system ==  &lt;br /&gt;
&lt;br /&gt;
[[File:vie_team_use_case.png|border|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Changes to the models ==&lt;br /&gt;
We have&lt;br /&gt;
&lt;br /&gt;
== Explanation of fixes ==&lt;br /&gt;
&lt;br /&gt;
The below diagram illustrates the proposed code change for showing all team members with the teammate review data to an instructor. The existing code only iterated on the `Participant` whose ID is present in the URL of the page. To fix this, we will iterate over all teammates of the given participant so that all teammate reviews for all team members are shown to the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Logic e2165.png|border|center|alt=Flow diagram of proposed changes for showing team review data to instructor]]&lt;br /&gt;
&lt;br /&gt;
===Changes made to the code are shown below. Every change is shown and explained separately===&lt;br /&gt;
&lt;br /&gt;
====A. Added the following to app/assets/stylesheets/grades.scss:====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    .teammate_table.hidden {&lt;br /&gt;
      display: none;&lt;br /&gt;
      }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====B. In app/controllers/grades_controller.rb: ====&lt;br /&gt;
&lt;br /&gt;
'''B.1:'''&lt;br /&gt;
&lt;br /&gt;
Old code: The existing code does not differentiate when adding a view model for the TeammateReview questionnaire&lt;br /&gt;
  questionnaires.each do |questionnaire|&lt;br /&gt;
     ...&lt;br /&gt;
     @vmlist &amp;lt;&amp;lt; populate_view_model(questionnaire)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
New code: Since the current page URL contains an ID for the participant, from which we get an assignment, which gives us a list of questionnaires, we need to iterate all participants for a `TeammateReveiwQuestionnaire` questionnaire, so that we get the heatgrid view models for all members of a team.&lt;br /&gt;
  questionnaires.each do |questionnaire|&lt;br /&gt;
     ...&lt;br /&gt;
     if questionnaire.type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
        # as teammate review will be different for each participant&lt;br /&gt;
        # we need to create a separate table for each teammate&lt;br /&gt;
        @participant.team.participants.each do |team_participant|&lt;br /&gt;
          @vmlist &amp;lt;&amp;lt; populate_view_model(team_participant, questionnaire, @team)&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        # only one participant needs iterating, as apart from teammatereview&lt;br /&gt;
        # all other reviews are at &amp;quot;team&amp;quot; level&lt;br /&gt;
        @vmlist &amp;lt;&amp;lt; populate_view_model(@participant, questionnaire, @team)&lt;br /&gt;
      end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
'''B.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code: This code uses @participant as an instance variable, but this structure will not work as we need to call this ViewModel with multiple participants when iterating for a teammate review questionnaire.&lt;br /&gt;
    def populate_view_model(questionnaire)&lt;br /&gt;
      vm = VmQuestionResponse.new(questionnaire, @assignment, @round)&lt;br /&gt;
      vmquestions = questionnaire.questions&lt;br /&gt;
      vm.add_questions(vmquestions)&lt;br /&gt;
      vm.add_team_members(@team)&lt;br /&gt;
      vm.add_reviews(@participant, @team, @assignment.vary_by_round)&lt;br /&gt;
      vm.number_of_comments_greater_than_10_words&lt;br /&gt;
      vm &lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
New code: We need to call this function with a separate participant in each invocation due to our change for TeammateReviewQuestionnaire, hence it makes sense to make `participant` as an argument to this function. Similarly, as `team` is a closely related model to `participant`, we are passing it as an argument, to keep this function as &amp;quot;pure&amp;quot; as possible.&lt;br /&gt;
    def populate_view_model(participant, questionnaire, team)&lt;br /&gt;
      ...&lt;br /&gt;
      vm.add_team_members(team)&lt;br /&gt;
      vm.add_reviews(participant, team, @assignment.vary_by_round)&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
====C. In app/models/vm_question_response.rb:====&lt;br /&gt;
&lt;br /&gt;
'''C.1: '''Added the reviewee_id method: Created a helper method within the VmQuestionReponse model to retrieve the `reviewee_id` for a heatgrid&lt;br /&gt;
&lt;br /&gt;
    def reviewee_id&lt;br /&gt;
      @participant_who_is_reviewee.user_id&lt;br /&gt;
    end &lt;br /&gt;
&lt;br /&gt;
'''C.2: '''Added the reviewee_name method: Created a helper method within the VmQuestionReponse model to retrieve the name of the student who is being reviewed for a heatgrid. This method uses the functionality to anonymize the name when we are in anonymized view.&lt;br /&gt;
&lt;br /&gt;
    def reviewee_name(ip_address = nil)&lt;br /&gt;
      part = @participant_who_is_reviewee&lt;br /&gt;
      User.find_by(id: part.user_id).fullname(ip_address)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''C.3: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Does not keep track of the student being reviewed&lt;br /&gt;
    elsif @questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
      reviews = participant.teammate_reviews&lt;br /&gt;
      reviews.each do |review|&lt;br /&gt;
        review_mapping = TeammateReviewResponseMap.find_by(id: review.map_id)&lt;br /&gt;
        participant = Participant.find(review_mapping.reviewer_id)&lt;br /&gt;
&lt;br /&gt;
New code: Add an instance variable to keep track of the student who is being reviewed in this VmQuestionReponse&lt;br /&gt;
    elsif @questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
      reviews = participant.teammate_reviews&lt;br /&gt;
      @participant_who_is_reviewee = participant&lt;br /&gt;
      reviews.each do |review|&lt;br /&gt;
        review_mapping = TeammateReviewResponseMap.find_by(id: review.map_id)&lt;br /&gt;
        participant = Participant.find(review_mapping.reviewer_id)&lt;br /&gt;
&lt;br /&gt;
'''C.4: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing VmQuestionReponseScoreCell keeps no information about the reviewer, as it only stores the answer score&lt;br /&gt;
    row.score_row.push(VmQuestionResponseScoreCell.new(answer.answer, color_code, answer.comments, vm_tag_prompts))&lt;br /&gt;
&lt;br /&gt;
New code: Keep track of the response ID, so that we can retrieve the user ID for the reviewer in the model to use in the view file.&lt;br /&gt;
    &lt;br /&gt;
    row.score_row.push(VmQuestionResponseScoreCell.new(answer.answer, color_code, answer.comments, vm_tag_prompts, answer.response_id))&lt;br /&gt;
&lt;br /&gt;
====D. In app/models/vm_question_response_score_cell.rb:====&lt;br /&gt;
&lt;br /&gt;
'''D.1: '''In the method initialize of class VmQuestionResponseScoreCell&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't keep track of the response id&lt;br /&gt;
    def initialize(score_value, color_code, comments, vmprompts = nil)&lt;br /&gt;
      @score_value = score_value&lt;br /&gt;
      @color_code = color_code&lt;br /&gt;
      @comment = comments&lt;br /&gt;
      @vm_prompts = vmprompts&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
New code: We added an instance variable to keep track of response_id&lt;br /&gt;
&lt;br /&gt;
    def initialize(score_value, color_code, comments, vmprompts = nil, response_id)&lt;br /&gt;
      ...&lt;br /&gt;
      @response_id = response_id&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''D.2: '''Added a method reviewer_id to the class VmQuestionResponseScoreCell: This helper method retrieves the ID for the reviewer who created this response.&lt;br /&gt;
&lt;br /&gt;
    def reviewer_id&lt;br /&gt;
      resp = Response.find(@response_id)&lt;br /&gt;
      map = ResponseMap.find(resp.map_id)&lt;br /&gt;
      map.reviewer_id&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
====E. In app/views/grades/_add_icon_to_name.html.erb:====&lt;br /&gt;
&lt;br /&gt;
'''E.1 '''Added the following code to the file: Write the code to generate the review text only once to reduce WET code&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;%# Determine the content of the reviewed by text %&amp;gt;&lt;br /&gt;
    &amp;lt;% review_text = &amp;quot;&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% if @current_role_name.eql?'Student' or questionnaire_type != &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
      &amp;lt;%# Use Review {{index}} format for student view, and when questionnaire_type is not teammatereview %&amp;gt;&lt;br /&gt;
      &amp;lt;% review_text = &amp;quot;Review #{i + 1}&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;% resp = Response.find(review.id) %&amp;gt;&lt;br /&gt;
      &amp;lt;% map = ResponseMap.find(resp.map_id) %&amp;gt;&lt;br /&gt;
      &amp;lt;% reviewer_id = map.reviewer_id %&amp;gt;&lt;br /&gt;
      &amp;lt;% fullname = Participant.find_by(id: reviewer_id).fullname(session[:ip]) %&amp;gt;&lt;br /&gt;
      &amp;lt;% review_text = &amp;quot;Review by #{fullname}&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% end%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''E.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code is very unreadable as it's not indented, and written in a single line with 359 characters, which breaks the ruby style guide rules&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;% if review.done_by_staff_participant? %&amp;gt;&lt;br /&gt;
      &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt; &amp;lt;img data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Icon indicates this review was done by course staff&amp;quot; class=&amp;quot;img_icon&amp;quot; src=&amp;quot;/assets/staff.png&amp;quot;&amp;gt; &amp;lt;a target=&amp;quot;_blank&amp;quot; href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Click to see details&amp;quot;&amp;gt;&amp;lt;%= &amp;quot;Review &amp;quot; + i.to_s  %&amp;gt;&amp;lt;/a&amp;gt; &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt; &amp;lt;a target=&amp;quot;_blank&amp;quot; href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Click to see details&amp;quot;&amp;gt;&amp;lt;%= &amp;quot;Review &amp;quot; + i.to_s %&amp;gt;&amp;lt;/a&amp;gt;  &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Correctly indented and removes WET repetition of code blocks and makes the resulting code DRYer&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;% if review.done_by_staff_participant? %&amp;gt;&lt;br /&gt;
      &amp;lt;img&lt;br /&gt;
      data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
      data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
      title=&amp;quot;Icon indicates this review was done by course staff&amp;quot; class=&amp;quot;img_icon&amp;quot;&lt;br /&gt;
      src=&amp;quot;/assets/staff.png&amp;quot;&lt;br /&gt;
      &amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;a&lt;br /&gt;
      target=&amp;quot;_blank&amp;quot;&lt;br /&gt;
      href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;&lt;br /&gt;
      data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
      data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
      title=&amp;quot;Click to see details&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;%= review_text %&amp;gt;&lt;br /&gt;
    &amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====F.In app/views/grades/view_team.html.erb:====&lt;br /&gt;
&lt;br /&gt;
'''F.1: '''Added function teammateSelectOnChange: This function toggles the visibility for the teammate heatgrids when the instructor changes the dropdown&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  function teammateSelectOnChange(selectNode) {&lt;br /&gt;
      const revieweeIdToShow= selectNode.value;&lt;br /&gt;
      const tableSelector = &amp;quot;.teammate_table&amp;quot;;&lt;br /&gt;
      if(revieweeIdToShow == &amp;quot;all&amp;quot;) {&lt;br /&gt;
        document.querySelectorAll(tableSelector).forEach((tableNode) =&amp;gt; {&lt;br /&gt;
          tableNode.classList.remove(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
        });&lt;br /&gt;
        return;&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
    document.querySelectorAll(tableSelector).forEach((tableNode) =&amp;gt; {&lt;br /&gt;
      const tableRevieweeId = tableNode.getAttribute('data-reviewee_id');&lt;br /&gt;
      if(tableRevieweeId == revieweeIdToShow) {&lt;br /&gt;
        tableNode.classList.remove(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
      } else {&lt;br /&gt;
        tableNode.classList.add(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
      }&lt;br /&gt;
      });&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't render TeammateReviewQuestionnaire&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;% @vmlist.each do |vm| %&amp;gt;&lt;br /&gt;
        &amp;lt;% if (vm.questionnaire_display_type == &amp;quot;Metareview&amp;quot; or vm.questionnaire_display_type == &amp;quot;Author Feedback&amp;quot; or vm.questionnaire_display_type == &amp;quot;Teammate Review&amp;quot;) and @current_role_name.eql?'Student' %&amp;gt;&lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
        &amp;lt;% if vm.list_of_reviewers.length &amp;gt; 0 %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Use a boolean to render a dropdown (that contains the students' IDs and names) just before the first TeammateReviewQuestionnaire, and unset that boolean so we only render 1 table. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;%# This boolean is used to render a dropdown just before the first teammate review heat grid %&amp;gt;&lt;br /&gt;
&amp;lt;% first_teammate_review_appeared = false %&amp;gt;&lt;br /&gt;
&amp;lt;% @vmlist.each do |vm| %&amp;gt;&lt;br /&gt;
     &amp;lt;% if (not @current_role_name.eql?'Student' and&lt;br /&gt;
        not first_teammate_review_appeared and&lt;br /&gt;
        vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; &lt;br /&gt;
      ) %&amp;gt;&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        &amp;lt;select onchange=&amp;quot;teammateSelectOnChange(this)&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;all&amp;quot;&amp;gt;All&amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;% @vmlist.select { |tm_vm| tm_vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; }.each do |tm_vm| %&amp;gt;&lt;br /&gt;
            &amp;lt;option value=&amp;quot;&amp;lt;%= tm_vm.reviewee_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;%= tm_vm.reviewee_name(session[:ip]) %&amp;gt;&lt;br /&gt;
            &amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
        &amp;lt;/select&amp;gt;&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;% first_teammate_review_appeared = true %&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Add conditions which check for the truthiness of ```@assignment.show_teammate_reviews``` and if the current user is a student to decide whether to render the table or not.  Since the existing code checks truthiness for the cases for which NOT to render a table, we have followed the existing style of the code.&lt;br /&gt;
&lt;br /&gt;
1) If type of view model is teammate review questionnaire, and current role is student, and if @assignment.show_teammate_reviews is false, then we don't render anything&lt;br /&gt;
2) If type of view model is teammate review questionnaire, and current role is student, but @assignment.show_teammate_reviews is true, then we don't render anything if the current reviewer_id is different to the currently logged in user.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;% if (vm.questionnaire_display_type == &amp;quot;Metareview&amp;quot; or vm.questionnaire_display_type == &amp;quot;Author Feedback&amp;quot;) and @current_role_name.eql?'Student' %&amp;gt;&lt;br /&gt;
    &amp;lt;% elsif (&lt;br /&gt;
      vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; and&lt;br /&gt;
      @current_role_name.eql?'Student' and&lt;br /&gt;
      !@assignment.show_teammate_reviews&lt;br /&gt;
      ) %&amp;gt;&lt;br /&gt;
    &amp;lt;% elsif (&lt;br /&gt;
      vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; and &lt;br /&gt;
      @current_role_name.eql?'Student' and&lt;br /&gt;
      @assignment.show_teammate_reviews and current_user.id != vm.reviewee_id&lt;br /&gt;
      )%&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Finally, add a CSS class and a `data-reviewee_id` to keep track of the heatgrids when toggling visibility.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
        &amp;lt;% if vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
          &amp;lt;div class=&amp;quot;teammate_table&amp;quot; data-reviewee_id=&amp;quot;&amp;lt;%= vm.reviewee_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
        &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.3  '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't print the teammate who is being reviewed.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
          &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
            &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: If TeammteReviewQuestionnaire is used, then use the `:reviewee_name` method for VmQuestionResponse model to print the name of the student who is being reviewed.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
          &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
            &amp;lt;% elsif vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (For: &amp;lt;%= vm.reviewee_name(session[:ip]) %&amp;gt;)&lt;br /&gt;
            &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.4 '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't inform the partial about the type of review being done&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_reviews.each do |review| %&amp;gt;&lt;br /&gt;
              &amp;lt;!-- instructors (or higher level users) see reviewer name, students see anonymized string --&amp;gt;&lt;br /&gt;
              &amp;lt;% if (['Student'].include? @current_role_name) &amp;amp;&amp;amp; @assignment.is_anonymous%&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i} %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                  &amp;lt;% user_name = User.find(Participant.find(ResponseMap.find(Response.find(review.id).map_id).reviewer_id).user_id).fullname(session[:ip]).to_s %&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i} %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% i += 1 %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
New code: Passes the type of review being done to the partial, so it can decide on how to render the review title. Note: This code seems to use repetition, but since the conditional used here are accessing `Anonymous` assignments and checking for user roles, we have not modified this code, as it is not directly related to our scope.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_reviews.each do |review| %&amp;gt;&lt;br /&gt;
              &amp;lt;!-- instructors (or higher level users) see reviewer name, students see anonymized string --&amp;gt;&lt;br /&gt;
              &amp;lt;% if (['Student'].include? @current_role_name) &amp;amp;&amp;amp; @assignment.is_anonymous%&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i, questionnaire_type: vm.questionnaire_type } %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                &amp;lt;% user_name = User.find(Participant.find(ResponseMap.find(Response.find(review.id).map_id).reviewer_id).user_id).fullname(session[:ip]).to_s %&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i, questionnaire_type: vm.questionnaire_type } %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% i += 1 %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Old code: Contains a `metrics-1` column&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-true&amp;quot; align=&amp;quot;right&amp;quot; &amp;gt;&lt;br /&gt;
            Avg&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;span  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;A count of comments, for the respective question, which have word count &amp;gt; 10. The purpose of this metric is to represent how many comments for the question are of a substantial length to provide quality feedback.&amp;quot;&amp;gt;metric-1&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/thead&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
New code: As per discussion with mentor, this column has been removed in our PR.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-true&amp;quot; align=&amp;quot;right&amp;quot; &amp;gt;&lt;br /&gt;
            Avg&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/thead&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.5 '''&lt;br /&gt;
&lt;br /&gt;
Old code: It creates the ID inline in multiple places, so if we decide to change the ID generation logic, we need to modify it in multiple places. (which happened when we started rendering multiple tables for each teammate).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_rows.each do |row| %&amp;gt;&lt;br /&gt;
            &amp;lt;!-- notice the data-target. because we're toggling via looped code, we need to dynamically generate the identifier. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr data-toggle=&amp;quot;collapse&amp;quot; class=&amp;quot;accordion-toggle&amp;quot; data-target=&amp;quot;#hid&amp;lt;%= row.question_id.to_s + vm.round.to_s %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Generate the unique HTML ID once, in a readable manner once. And conditionally make it more unique, if it is a TeammateReviewQuestionnaire, since jQuery code requires these IDs to be unique amongst different tables. If we don't make it more unique, then clicking on one teammate review table will toggle the table visibility for the first table. To prevent this &amp;quot;clashing&amp;quot;, we need to make these IDs more unique for a TeammateReviewQuestionnaire.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_rows.each do |row| %&amp;gt;&lt;br /&gt;
            &amp;lt;% target_id = &amp;quot;hid__#{row.question_id}__#{vm.round}&amp;quot; %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
              &amp;lt;%# Since we render different heatgrids with the same questions for each&lt;br /&gt;
              teammember, we need to distinguish the ID, based on the user for whom,&lt;br /&gt;
              the reviews have been created. %&amp;gt;&lt;br /&gt;
              &amp;lt;% target_id += &amp;quot;__#{vm.reviewee_id}&amp;quot; %&amp;gt;&lt;br /&gt;
            &amp;lt;% end%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;!-- notice the data-target. because we're toggling via looped code, we need to dynamically generate the identifier. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr data-toggle=&amp;quot;collapse&amp;quot; class=&amp;quot;accordion-toggle&amp;quot; data-target=&amp;quot;&amp;lt;%= &amp;quot;#&amp;quot; + target_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Old code: Written on a single line crossing 80 characters on a single line&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
              &amp;lt;% row.score_row.each do |score| %&amp;gt;&lt;br /&gt;
                  &amp;lt;% score_comment = score.comment.nil? ? '' : score.comment %&amp;gt; &amp;lt;!-- changing nil to null string to avoid Null Pointer Exception --&amp;gt;&lt;br /&gt;
                  &amp;lt;td class=&amp;quot;&amp;lt;%= score.color_code %&amp;gt;&amp;quot; align=&amp;quot;center&amp;quot; data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= strip_tags(score.comment).html_safe%&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;&amp;lt;%=  underlined?(score) %&amp;gt;&amp;quot;&amp;gt;&amp;lt;%= score.score_value.to_s %&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
                  &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
New code: Make code more readable by indenting it and splitting it over multiple lines&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
              &amp;lt;!-- actual cells with scores and colored background. --&amp;gt;&lt;br /&gt;
              &amp;lt;% row.score_row.each do |score| %&amp;gt;&lt;br /&gt;
                  &amp;lt;% score_comment = score.comment.nil? ? '' : score.comment %&amp;gt;&lt;br /&gt;
                  &amp;lt;!-- changing nil to null string to avoid Null Pointer Exception --&amp;gt;&lt;br /&gt;
                  &amp;lt;td class=&amp;quot;&amp;lt;%= score.color_code %&amp;gt;&amp;quot; align=&amp;quot;center&amp;quot; data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= strip_tags(score.comment).html_safe%&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;&amp;lt;%=  underlined?(score) %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                      &amp;lt;%= score.score_value.to_s %&amp;gt;&lt;br /&gt;
                    &amp;lt;/span&amp;gt;&lt;br /&gt;
                  &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.6 '''Removed the following code as it corresponds to the deleted column&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 &amp;lt;td  class = 'cf' align=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;%= row.countofcomments.to_s %&amp;gt;&lt;br /&gt;
              &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.7 '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code just unconditionally prints the text &amp;quot;Review&amp;quot; followed by an index.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                    &amp;lt;% for index in 0 .. row.score_row.length - 1 %&amp;gt;&lt;br /&gt;
                        &amp;lt;tr&amp;gt;&lt;br /&gt;
                          &amp;lt;td&amp;gt;Review &amp;lt;%=index + 1%&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Conditionally change the review text that is displayed based on the type of review and the access level of the user&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                    &amp;lt;% for index in 0 .. row.score_row.length - 1 %&amp;gt;&lt;br /&gt;
                        &amp;lt;tr&amp;gt;&lt;br /&gt;
                          &amp;lt;% if @current_role_name.eql?'Student' or vm.questionnaire_type != &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                            &amp;lt;%# Use Review {{index}} format for student view, and&lt;br /&gt;
                            when questionnaire_type is not teammatereview %&amp;gt;&lt;br /&gt;
                            &amp;lt;td&amp;gt;Review &amp;lt;%=index + 1%&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
                          &amp;lt;% else %&amp;gt;&lt;br /&gt;
                            &amp;lt;td&amp;gt;&lt;br /&gt;
                              &amp;lt;% reviewer_id = row.score_row[index].reviewer_id %&amp;gt;&lt;br /&gt;
                              &amp;lt;% fullname = Participant.find_by(id: reviewer_id).fullname(session[:ip]) %&amp;gt;&lt;br /&gt;
                              Review by &amp;lt;%= fullname %&amp;gt;&lt;br /&gt;
                            &amp;lt;/td&amp;gt;&lt;br /&gt;
                          &amp;lt;% end%&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====G. In spec/controllers/grades_controller_spec.rb:====&lt;br /&gt;
&lt;br /&gt;
'''G.1 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
before(:each) do&lt;br /&gt;
  allow(AssignmentParticipant).to receive(:find).with('1').and_return(participant)&lt;br /&gt;
  allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
  stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
@@ -91,29 +90,106 @@&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
before(:each) do&lt;br /&gt;
  allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
  stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
@@ -91,29 +90,106 @@&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''G.2 '''Remove xdescribe '#view_team' and change describe '#view_team' as follows.&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#view_team' do&lt;br /&gt;
render_views&lt;br /&gt;
context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
  it 'renders grades#view_team page' do&lt;br /&gt;
    allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
    allow(AssignmentQuestionnaire).to receive(:find_by).with(assignment_id: 1, questionnaire_id: 1).and_return(assignment_questionnaire)&lt;br /&gt;
    allow(AssignmentQuestionnaire).to receive(:where).with(any_args).and_return([assignment_questionnaire])&lt;br /&gt;
    allow(assignment).to receive(:late_policy_id).and_return(false)&lt;br /&gt;
    allow(assignment).to receive(:calculate_penalty).and_return(false)&lt;br /&gt;
    allow(assignment).to receive(:compute_total_score).with(any_args).and_return(100)&lt;br /&gt;
    allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
    allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
    params = {id: 1}&lt;br /&gt;
    allow(TaMapping).to receive(:exists?).with(ta_id: 1, course_id: 1).and_return(true)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#view_team' do&lt;br /&gt;
render_views&lt;br /&gt;
&lt;br /&gt;
# All stubs and factories are instantiated within this scope so as to not &lt;br /&gt;
# clash with other broken test.&lt;br /&gt;
# The names of the factories created for testing view_team&lt;br /&gt;
# have `_vt` suffix ```where necessary``` to differentiate them from &lt;br /&gt;
# the above declared factories&lt;br /&gt;
&lt;br /&gt;
let(:student1_vt) { create(:student, name: &amp;quot;barry&amp;quot;, id: 12) }&lt;br /&gt;
let(:student2_vt) { create(:student, name: &amp;quot;iris&amp;quot;, id: 13) }&lt;br /&gt;
&lt;br /&gt;
let(:tm_questionnaire) {&lt;br /&gt;
  build(&lt;br /&gt;
    :teammate_review_questionnaire,&lt;br /&gt;
    id: 12,&lt;br /&gt;
    questions: [question],&lt;br /&gt;
    max_question_score: 5&lt;br /&gt;
  )&lt;br /&gt;
}&lt;br /&gt;
let(:assignment_vt) {&lt;br /&gt;
  create(:assignment, id: 6, max_team_size: 2,&lt;br /&gt;
  questionnaires: [tm_questionnaire])&lt;br /&gt;
}&lt;br /&gt;
let(:assignment_questionnaire_vt) {&lt;br /&gt;
  create(:tm_assignment_questionnaire, id: 12, used_in_round: nil,&lt;br /&gt;
  assignment: assignment_vt, questionnaire: tm_questionnaire) }&lt;br /&gt;
let(:team_vt) { create(:assignment_team, id: 12,&lt;br /&gt;
assignment: assignment_vt) }&lt;br /&gt;
let(:participant_vt) { create(:participant, id: 12,&lt;br /&gt;
  assignment: assignment_vt, user_id: student1_vt.id) }&lt;br /&gt;
let(:participant2_vt) { create(:participant, id: 13,&lt;br /&gt;
  assignment: assignment_vt, user_id: student2_vt.id) }&lt;br /&gt;
&lt;br /&gt;
before(:each) do&lt;br /&gt;
  # Need to stub this method so the factory instance with&lt;br /&gt;
  # the stubbed :team method is returned by :find&lt;br /&gt;
  # instead of a separate instance with the same data&lt;br /&gt;
  allow(AssignmentParticipant)&lt;br /&gt;
    .to receive(:find)&lt;br /&gt;
    .with(participant_vt.id.to_s)&lt;br /&gt;
    .and_return(participant_vt)&lt;br /&gt;
  allow(participant_vt).to receive(:team).and_return(team_vt)&lt;br /&gt;
  allow(team_vt).to receive(:participants).and_return([participant_vt, participant2_vt])&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:find_by)&lt;br /&gt;
    .with(assignment_id: assignment_vt.id, questionnaire_id: tm_questionnaire.id)&lt;br /&gt;
    .and_return(assignment_questionnaire_vt)&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:find_by)&lt;br /&gt;
    .with(assignment_id: assignment.id, questionnaire_id: review_questionnaire.id)&lt;br /&gt;
    .and_return(assignment_questionnaire_vt)&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:where)&lt;br /&gt;
    .with(any_args)&lt;br /&gt;
    .and_return([assignment_questionnaire_vt])&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:late_policy_id)&lt;br /&gt;
    .and_return(false)&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:calculate_penalty)&lt;br /&gt;
    .and_return(false)&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:compute_total_score)&lt;br /&gt;
    .with(any_args)&lt;br /&gt;
    .and_return(100)&lt;br /&gt;
  allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
  allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
 it 'renders grades#view_team page' do&lt;br /&gt;
  params = {id: participant_vt.id}&lt;br /&gt;
  get :view_team, params&lt;br /&gt;
  expect(response).to render_template(:view_team)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is opened by student' do&lt;br /&gt;
  it 'dropdown is not rendered' do&lt;br /&gt;
    session = { user: student1_vt }&lt;br /&gt;
    params = {id: participant_vt.id}&lt;br /&gt;
    stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
    get :view_team, params&lt;br /&gt;
    expect(response.body).to_not have_selector('select')&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is opened by instructor' do&lt;br /&gt;
  it 'dropdown is rendered' do&lt;br /&gt;
    session = { user: instructor }&lt;br /&gt;
    params = {id: participant_vt.id}&lt;br /&gt;
    get :view_team, params&lt;br /&gt;
    expect(response.body).to have_selector('select')&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
  it 'renders grades#view_team page' do&lt;br /&gt;
    params = { id: participant_vt.id }&lt;br /&gt;
    allow(TaMapping).to receive(:exists?).with(ta_id: participant_vt.user_id, course_id: 1).and_return(true)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====H. In spec/factories/factories.rb:====&lt;br /&gt;
&lt;br /&gt;
'''H.1 '''Add the following factory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
factory :teammate_review_questionnaire, class: TeammateReviewQuestionnaire do&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''H.2 '''Add another factory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
factory :tm_assignment_questionnaire, class: AssignmentQuestionnaire do&lt;br /&gt;
  user_id 1&lt;br /&gt;
  questionnaire { association(:teammate_review_questionnaire) }&lt;br /&gt;
  questionnaire_weight 100&lt;br /&gt;
  used_in_round nil&lt;br /&gt;
  topic_id nil&lt;br /&gt;
  dropdown 1&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
The tests written as a part of this project can be run by running the following command on terminal:&lt;br /&gt;
&lt;br /&gt;
1. rspec ./spec/controllers/grades_controller_spec.rb  -e &amp;quot;#view_team&amp;quot;&lt;br /&gt;
&lt;br /&gt;
2. rspec .vm_question_response_score_cell_spec.rb  -e &amp;quot;#reviewer_id&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''OLD STATUS'''&lt;br /&gt;
&lt;br /&gt;
1. Earlier, the tests contained an xdescribe test to check if the view_team page is rendered correctly. However, this test was being skipped as this was an xdescribe segment. There was another test for when the view_team page is accessed by a student who is also a TA for another course. This can be checked [https://github.com/expertiza/expertiza/blob/beta/spec/controllers/grades_controller_spec.rb here].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 xdescribe '#view_team' do&lt;br /&gt;
    it 'renders grades#view_team page' do&lt;br /&gt;
      allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
      params = {id: 1}&lt;br /&gt;
      get :view_team, params&lt;br /&gt;
      expect(response).to render_template(:view_team)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#view_team' do&lt;br /&gt;
    render_views&lt;br /&gt;
    context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
      it 'renders grades#view_team page' do&lt;br /&gt;
        allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
        allow(AssignmentQuestionnaire).to receive(:find_by).with(assignment_id: 1, questionnaire_id: 1).and_return(assignment_questionnaire)&lt;br /&gt;
        allow(AssignmentQuestionnaire).to receive(:where).with(any_args).and_return([assignment_questionnaire])&lt;br /&gt;
        allow(assignment).to receive(:late_policy_id).and_return(false)&lt;br /&gt;
        allow(assignment).to receive(:calculate_penalty).and_return(false)&lt;br /&gt;
        allow(assignment).to receive(:compute_total_score).with(any_args).and_return(100)&lt;br /&gt;
        allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
        allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
        params = {id: 1}&lt;br /&gt;
        allow(TaMapping).to receive(:exists?).with(ta_id: 1, course_id: 1).and_return(true)&lt;br /&gt;
        stub_current_user(ta, ta.role.name, ta.role)&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).not_to have_content &amp;quot;TA&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''NEW STATUS'''&lt;br /&gt;
&lt;br /&gt;
1. The view_team page is rendered correctly for a given student or an instructor. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    it 'renders grades#view_team page' do&lt;br /&gt;
      params = {id: participant_vt.id}&lt;br /&gt;
      get :view_team, params&lt;br /&gt;
      expect(response).to render_template(:view_team)&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. When students access then the view_team page, the dropdown to select a student's teammate reviews is not rendered on the page. The dropdown is rendered if the page is accessed by an instructor. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   context 'dropdown for selecting a teammate review' do&lt;br /&gt;
    render_views&lt;br /&gt;
      it 'is not rendered is not rendered when page is opened by student' do&lt;br /&gt;
        session = { user: student1_vt }&lt;br /&gt;
        params = {id: participant_vt.id}&lt;br /&gt;
        stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to_not have_selector('select')&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      it 'is rendered when page is opened by instructor' do&lt;br /&gt;
        session = { user: instructor }&lt;br /&gt;
        params = {id: participant_vt.id}&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to have_selector('select')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. When a student who is also a TA for another course access the view_team page, that student should be able to a student's view to the page. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
      it 'renders grades#view_team page' do&lt;br /&gt;
        params = { id: participant_vt.id }&lt;br /&gt;
        allow(TaMapping).to receive(:exists?).with(ta_id: participant_vt.user_id, course_id: 1).and_return(true)&lt;br /&gt;
        stub_current_user(ta, ta.role.name, ta.role)&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).not_to have_content &amp;quot;TA&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. If show_teammate_reviews boolean is set to False, then the student should not be able to see the teammate reviews given to him/her. An instructor can still see the teammate reviews. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when assignment(show reviews) value is unchecked' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        allow(assignment_vt).to receive(:show_teammate_reviews).and_return(false) &lt;br /&gt;
      end&lt;br /&gt;
      it 'Student cannot view his score' do&lt;br /&gt;
        session = { user: student1_vt }&lt;br /&gt;
        params = {id: participant_vt.id}&lt;br /&gt;
        stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to_not have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
        expect(response.body).to_not have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant2_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      it 'Instructor can view the student score' do        &lt;br /&gt;
        params = {id: participant_vt.id}        &lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
        expect(response.body).to have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant2_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. If show_teammate_reviews boolean is set to True, then both the student should and instructor should be able to see the teammate reviews. The student should see only the reviews received by him/her. The instructor should be able to see all student's teammate reviews. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    context 'when assignment(show reviews) value is checked' do&lt;br /&gt;
      it 'Student can view his score' do&lt;br /&gt;
        session = { user: student1_vt }&lt;br /&gt;
        params = {id: participant_vt.id}&lt;br /&gt;
        stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
        expect(response.body).to_not have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant2_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      it 'Instructor can view the student score' do        &lt;br /&gt;
        params = {id: participant_vt.id}        &lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
        expect(response.body).to have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant2_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. The reviewer id is tracked correctly to show the correct reviewer name in the teammate reviews table. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/models/vm_question_response_score_cell_spec.rb this] file &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  	describe '#reviewer_id' do&lt;br /&gt;
  		it 'returns reviewer id' do&lt;br /&gt;
			allow(ResponseMap).to receive(:find).with(1).and_return(review_response_map)&lt;br /&gt;
			allow(response).to receive(:populate_new_response).with(:review_response_map, &amp;quot;0&amp;quot;).and_return(response)&lt;br /&gt;
        	expect(response.id).to eq(1)	&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Summary of file changes ==&lt;br /&gt;
&lt;br /&gt;
The following files are modified:&lt;br /&gt;
&lt;br /&gt;
1. app/controllers/grades_controller.rb - Controller file which changed how the view model is populated&lt;br /&gt;
&lt;br /&gt;
2. app/views/grades/view_team.html.erb - View file, which  conditionally rendered the teammate name, for a teammate review heatgrid&lt;br /&gt;
&lt;br /&gt;
3. spec/controllers/grades_controller_spec.rb - For tests verifying the proposed changes&lt;br /&gt;
&lt;br /&gt;
4. app/models/vm_question_response.rb - To modify the view-model so it can tell us the name of the person being reviewed for the current heatgrid&lt;br /&gt;
&lt;br /&gt;
5. app/models/vm_question_response_score_cell.rb - &lt;br /&gt;
&lt;br /&gt;
6. app/assets/stylesheets/grades.scss - &lt;br /&gt;
&lt;br /&gt;
7. app/views/grades/_add_icon_to_name.html.erb - &lt;br /&gt;
&lt;br /&gt;
8. spec/factories/factories.rb -&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Design Patterns ==&lt;br /&gt;
&lt;br /&gt;
Existing code does not use any design patterns, apart from if-else. It uses if-else conditional statements to check what type of questionnaire is present in the viewmodel `VmQuestionResponse`, and based on that, it renders the appropriate content.&lt;br /&gt;
&lt;br /&gt;
We decided to continue with this approach since to change the present coding style, there were required many changes (refactoring) to many files which were out of the scope of the present project. To complete the project in the assigned time, we followed the if-else approach.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;https://expertiza.ncsu.edu/&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Agarg25</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141763</id>
		<title>CSC/ECE 517 Fall 2021 - E2165. Fix teammate-review view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141763"/>
		<updated>2021-11-28T19:30:17Z</updated>

		<summary type="html">&lt;p&gt;Agarg25: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Introduction ==&lt;br /&gt;
&lt;br /&gt;
Dr. Edward Gehringer (instructor), Parimal Mehta (mentor)&lt;br /&gt;
&lt;br /&gt;
1. Anjali Garg (unity ID : agarg25)&lt;br /&gt;
&lt;br /&gt;
2. Arvasu Chikara (unity ID: achikar2)&lt;br /&gt;
&lt;br /&gt;
3. Lalit Bangad (unity ID: llbangad)&lt;br /&gt;
&lt;br /&gt;
4. Vinay Deshmukh (unity ID: vdeshmu)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Problems to be addressed ==&lt;br /&gt;
&lt;br /&gt;
After a project is submitted and reviewed, both the team members (students) and instructors should be able to view the teammate reviews. Students should be able to view the reviews by going to a particular assignment's -&amp;gt; your scores, at the bottom of the page. An instructor can view the teammate reviews by going to assignments -&amp;gt; assignment -&amp;gt; particular team's submission -&amp;gt; view submission -&amp;gt; assign grades -&amp;gt; view scores. &lt;br /&gt;
&lt;br /&gt;
In the case of the instructor, a single heat grid is shown whereas in the case of a team member, we cant view the scores. In the heat grid, it is not clear if the scores visible are for the reviews that the student has *written* for their teammates or the scores that the student has *received* from their teammates. Additionally, for instructors can choose from a list of the students on the team, but they have no way to tell whether the heat grid shows the reviews done *by* that student or done *for* that student.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Methodology Overview ==&lt;br /&gt;
&lt;br /&gt;
We have divided our work in the following tasks to address the above problems:&lt;br /&gt;
&lt;br /&gt;
1. Distinguish reviews done for a student by rendering separates heatgrids for each student&lt;br /&gt;
&lt;br /&gt;
2. For instructors, the table will have sections based on the students&lt;br /&gt;
&lt;br /&gt;
3. Include a checkbox on the edit assignment page that enables/disables visibility of heat grid to students&lt;br /&gt;
&lt;br /&gt;
4. Fix the average column for a table (which breaks for some reviews)&lt;br /&gt;
&lt;br /&gt;
5. Show a composite score derived from all reviews.  Make this code generalized, so other kinds of heat grid views could use it.&lt;br /&gt;
&lt;br /&gt;
6. Changes should work even in an anonymized view&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Motivations ==&lt;br /&gt;
&lt;br /&gt;
1. Enable users to clearly tell which reviews are done by them, and which reviews are done for them.&lt;br /&gt;
&lt;br /&gt;
2. Code should be generic so it can be used for different types of heat grids as well.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Control Flow to access the concerned screens ==&lt;br /&gt;
'''1. For instructor (Log in as an instructor):-'''&lt;br /&gt;
&lt;br /&gt;
Screen after logging in by the instructor&lt;br /&gt;
[[File:ss1.png |border|1000px|center]]&lt;br /&gt;
Got to assignments on the Manage menu &lt;br /&gt;
[[File:ss2.png |border|1000px|center]]&lt;br /&gt;
Go to assignments&lt;br /&gt;
[[File:ss3.png |border|1000px|center]]&lt;br /&gt;
Go to submissions for any assignment&lt;br /&gt;
[[File:ss4a.png |border|1000px|center]]&lt;br /&gt;
Go to Assign Grade&lt;br /&gt;
[[File:ss5a.png |border|1000px|center]]&lt;br /&gt;
You will land on the page where the changes are made and can be reviewed&lt;br /&gt;
[[File:ss7a.png |border|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
'''2. Student:- (Instructor impersonating a student)'''&lt;br /&gt;
&lt;br /&gt;
After landing on the assignments page, select any student from an assignment as shown below&lt;br /&gt;
[[File:ss6a.png |border|1000px|center]]&lt;br /&gt;
Go to/Select any assignment&lt;br /&gt;
[[File:ss9a.png |border|1000px|center]]&lt;br /&gt;
Go to your scores&lt;br /&gt;
[[File:ss10a.png |border|1000px|center]]&lt;br /&gt;
You will land on the page where the changes are made and can be reviewed&lt;br /&gt;
[[File:ss11a.png |border|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
== Old Status of the application ==&lt;br /&gt;
&lt;br /&gt;
'''1. Instructor's view of teammate review''': This is the current screen given to the instructor. Here we see that the instructor can not determine who has given which review to which student in a team.&lt;br /&gt;
&lt;br /&gt;
[[File:Instructor-view-1.png|border| 700px |center|alt=The proposed expanded student display.|The proposed expanded student display.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2. Student's view of teammate review''': Currently, a student is not able to see what grades were given by their teammates. We need to implement that functionality so that the student is able to view those grades.&lt;br /&gt;
&lt;br /&gt;
[[File:Student-view-2.png|border| 700px |center|alt=The current instructor view.|The current review display for instructors.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Error in existing UI for student''': In the existing UI for a student, the highlighted block should not be rendered. This part of the screen is meant for the instructors/TAs. &lt;br /&gt;
&lt;br /&gt;
[[File:Wrong render for student.png|border|700px|center|alt=Existing UI for student|Existing UI for student.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Proposed changes ==&lt;br /&gt;
&lt;br /&gt;
''' 1) Proposed UI for instructor ''': The instructor is able to see the score for all teammates. In the existing code, only one teammate's scores are being shown. But, we are planning to change the way the (VmQuestionResponse array is populated)[https://github.com/expertiza/expertiza/blob/master/app/controllers/grades_controller.rb#L114], so that the scores for all teammates are appended to it so it correctly shows what should have already been shown in this screen for the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Proposed_screen.png|border|700px|center|alt=Proposed UI for instructor|Proposed UI for instructor.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: When a student visits this screen, they will only be shown the reviews received by them, assuming the instructor has allowed visibility of teammate reviews to students.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' 2) Show detailed review for a particular question''': The instructor can see detailed review given to a student by their teammates by clicking on a particular question number in the table.&lt;br /&gt;
&lt;br /&gt;
[[File:ss12a.png|border|700px|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' 3) Show teammate review to student UI ''': The existing code doesn't render a student's teammate review scores at all. We are planning to render the scores to a student (as shown below) when they visit this screen. However, the visibility of this screen is contingent on whether the instructor has allowed visibility of the teammate review screen to students. If the instructor has disabled this feature, then the heatgrid will not be displayed at all.&lt;br /&gt;
&lt;br /&gt;
[[File:UI_for_student.png|border|700px|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== User Stories ==&lt;br /&gt;
&lt;br /&gt;
1. As an instructor, I can view what reviews one teammate has given to other teammates.&lt;br /&gt;
&lt;br /&gt;
2. As a student, I can view what reviews my teammates have given to me.&lt;br /&gt;
&lt;br /&gt;
3. As an instructor, I can choose if I want to see all student's teammates reviews together or one by one.&lt;br /&gt;
&lt;br /&gt;
4. As a student, if I am also a TA for another subject, I should not be able to see an instructor's view to the view_team page.&lt;br /&gt;
&lt;br /&gt;
5. As an instructor, I should be able to see the name of the reviewers for the reviews to a particular student.&lt;br /&gt;
&lt;br /&gt;
== UML diagram for the system ==  &lt;br /&gt;
&lt;br /&gt;
[[File:vie_team_use_case.png|border|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Changes to the models ==&lt;br /&gt;
&lt;br /&gt;
== Explanation of fixes ==&lt;br /&gt;
&lt;br /&gt;
The below diagram illustrates the proposed code change for showing all team members with the teammate review data to an instructor. The existing code only iterated on the `Participant` whose ID is present in the URL of the page. To fix this, we will iterate over all teammates of the given participant so that all teammate reviews for all team members are shown to the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Logic e2165.png|border|center|alt=Flow diagram of proposed changes for showing team review data to instructor]]&lt;br /&gt;
&lt;br /&gt;
===Changes made to the code are shown below. Every change is shown and explained separately===&lt;br /&gt;
&lt;br /&gt;
====A. Added the following to app/assets/stylesheets/grades.scss:====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    .teammate_table.hidden {&lt;br /&gt;
      display: none;&lt;br /&gt;
      }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====B. In app/controllers/grades_controller.rb: ====&lt;br /&gt;
&lt;br /&gt;
'''B.1:'''&lt;br /&gt;
&lt;br /&gt;
Old code: The existing code does not differentiate when adding a view model for the TeammateReview questionnaire&lt;br /&gt;
  questionnaires.each do |questionnaire|&lt;br /&gt;
     ...&lt;br /&gt;
     @vmlist &amp;lt;&amp;lt; populate_view_model(questionnaire)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
New code: Since the current page URL contains an ID for the participant, from which we get an assignment, which gives us a list of questionnaires, we need to iterate all participants for a `TeammateReveiwQuestionnaire` questionnaire, so that we get the heatgrid view models for all members of a team.&lt;br /&gt;
  questionnaires.each do |questionnaire|&lt;br /&gt;
     ...&lt;br /&gt;
     if questionnaire.type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
        # as teammate review will be different for each participant&lt;br /&gt;
        # we need to create a separate table for each teammate&lt;br /&gt;
        @participant.team.participants.each do |team_participant|&lt;br /&gt;
          @vmlist &amp;lt;&amp;lt; populate_view_model(team_participant, questionnaire, @team)&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        # only one participant needs iterating, as apart from teammatereview&lt;br /&gt;
        # all other reviews are at &amp;quot;team&amp;quot; level&lt;br /&gt;
        @vmlist &amp;lt;&amp;lt; populate_view_model(@participant, questionnaire, @team)&lt;br /&gt;
      end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
'''B.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code: This code uses @participant as an instance variable, but this structure will not work as we need to call this ViewModel with multiple participants when iterating for a teammate review questionnaire.&lt;br /&gt;
    def populate_view_model(questionnaire)&lt;br /&gt;
      vm = VmQuestionResponse.new(questionnaire, @assignment, @round)&lt;br /&gt;
      vmquestions = questionnaire.questions&lt;br /&gt;
      vm.add_questions(vmquestions)&lt;br /&gt;
      vm.add_team_members(@team)&lt;br /&gt;
      vm.add_reviews(@participant, @team, @assignment.vary_by_round)&lt;br /&gt;
      vm.number_of_comments_greater_than_10_words&lt;br /&gt;
      vm &lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
New code: We need to call this function with a separate participant in each invocation due to our change for TeammateReviewQuestionnaire, hence it makes sense to make `participant` as an argument to this function. Similarly, as `team` is a closely related model to `participant`, we are passing it as an argument, to keep this function as &amp;quot;pure&amp;quot; as possible.&lt;br /&gt;
    def populate_view_model(participant, questionnaire, team)&lt;br /&gt;
      ...&lt;br /&gt;
      vm.add_team_members(team)&lt;br /&gt;
      vm.add_reviews(participant, team, @assignment.vary_by_round)&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
====C. In app/models/vm_question_response.rb:====&lt;br /&gt;
&lt;br /&gt;
'''C.1: '''Added the reviewee_id method: Created a helper method within the VmQuestionReponse model to retrieve the `reviewee_id` for a heatgrid&lt;br /&gt;
&lt;br /&gt;
    def reviewee_id&lt;br /&gt;
      @participant_who_is_reviewee.user_id&lt;br /&gt;
    end &lt;br /&gt;
&lt;br /&gt;
'''C.2: '''Added the reviewee_name method: Created a helper method within the VmQuestionReponse model to retrieve the name of the student who is being reviewed for a heatgrid. This method uses the functionality to anonymize the name when we are in anonymized view.&lt;br /&gt;
&lt;br /&gt;
    def reviewee_name(ip_address = nil)&lt;br /&gt;
      part = @participant_who_is_reviewee&lt;br /&gt;
      User.find_by(id: part.user_id).fullname(ip_address)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''C.3: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Does not keep track of the student being reviewed&lt;br /&gt;
    elsif @questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
      reviews = participant.teammate_reviews&lt;br /&gt;
      reviews.each do |review|&lt;br /&gt;
        review_mapping = TeammateReviewResponseMap.find_by(id: review.map_id)&lt;br /&gt;
        participant = Participant.find(review_mapping.reviewer_id)&lt;br /&gt;
&lt;br /&gt;
New code: Add an instance variable to keep track of the student who is being reviewed in this VmQuestionReponse&lt;br /&gt;
    elsif @questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
      reviews = participant.teammate_reviews&lt;br /&gt;
      @participant_who_is_reviewee = participant&lt;br /&gt;
      reviews.each do |review|&lt;br /&gt;
        review_mapping = TeammateReviewResponseMap.find_by(id: review.map_id)&lt;br /&gt;
        participant = Participant.find(review_mapping.reviewer_id)&lt;br /&gt;
&lt;br /&gt;
'''C.4: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing VmQuestionReponseScoreCell keeps no information about the reviewer, as it only stores the answer score&lt;br /&gt;
    row.score_row.push(VmQuestionResponseScoreCell.new(answer.answer, color_code, answer.comments, vm_tag_prompts))&lt;br /&gt;
&lt;br /&gt;
New code: Keep track of the response ID, so that we can retrieve the user ID for the reviewer in the model to use in the view file.&lt;br /&gt;
    &lt;br /&gt;
    row.score_row.push(VmQuestionResponseScoreCell.new(answer.answer, color_code, answer.comments, vm_tag_prompts, answer.response_id))&lt;br /&gt;
&lt;br /&gt;
====D. In app/models/vm_question_response_score_cell.rb:====&lt;br /&gt;
&lt;br /&gt;
'''D.1: '''In the method initialize of class VmQuestionResponseScoreCell&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't keep track of the response id&lt;br /&gt;
    def initialize(score_value, color_code, comments, vmprompts = nil)&lt;br /&gt;
      @score_value = score_value&lt;br /&gt;
      @color_code = color_code&lt;br /&gt;
      @comment = comments&lt;br /&gt;
      @vm_prompts = vmprompts&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
New code: We added an instance variable to keep track of response_id&lt;br /&gt;
&lt;br /&gt;
    def initialize(score_value, color_code, comments, vmprompts = nil, response_id)&lt;br /&gt;
      ...&lt;br /&gt;
      @response_id = response_id&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''D.2: '''Added a method reviewer_id to the class VmQuestionResponseScoreCell: This helper method retrieves the ID for the reviewer who created this response.&lt;br /&gt;
&lt;br /&gt;
    def reviewer_id&lt;br /&gt;
      resp = Response.find(@response_id)&lt;br /&gt;
      map = ResponseMap.find(resp.map_id)&lt;br /&gt;
      map.reviewer_id&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
====E. In app/views/grades/_add_icon_to_name.html.erb:====&lt;br /&gt;
&lt;br /&gt;
'''E.1 '''Added the following code to the file: Write the code to generate the review text only once to reduce WET code&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;%# Determine the content of the reviewed by text %&amp;gt;&lt;br /&gt;
    &amp;lt;% review_text = &amp;quot;&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% if @current_role_name.eql?'Student' or questionnaire_type != &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
      &amp;lt;%# Use Review {{index}} format for student view, and when questionnaire_type is not teammatereview %&amp;gt;&lt;br /&gt;
      &amp;lt;% review_text = &amp;quot;Review #{i + 1}&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;% resp = Response.find(review.id) %&amp;gt;&lt;br /&gt;
      &amp;lt;% map = ResponseMap.find(resp.map_id) %&amp;gt;&lt;br /&gt;
      &amp;lt;% reviewer_id = map.reviewer_id %&amp;gt;&lt;br /&gt;
      &amp;lt;% fullname = Participant.find_by(id: reviewer_id).fullname(session[:ip]) %&amp;gt;&lt;br /&gt;
      &amp;lt;% review_text = &amp;quot;Review by #{fullname}&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% end%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''E.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code is very unreadable as it's not indented, and written in a single line with 359 characters, which breaks the ruby style guide rules&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;% if review.done_by_staff_participant? %&amp;gt;&lt;br /&gt;
      &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt; &amp;lt;img data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Icon indicates this review was done by course staff&amp;quot; class=&amp;quot;img_icon&amp;quot; src=&amp;quot;/assets/staff.png&amp;quot;&amp;gt; &amp;lt;a target=&amp;quot;_blank&amp;quot; href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Click to see details&amp;quot;&amp;gt;&amp;lt;%= &amp;quot;Review &amp;quot; + i.to_s  %&amp;gt;&amp;lt;/a&amp;gt; &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt; &amp;lt;a target=&amp;quot;_blank&amp;quot; href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Click to see details&amp;quot;&amp;gt;&amp;lt;%= &amp;quot;Review &amp;quot; + i.to_s %&amp;gt;&amp;lt;/a&amp;gt;  &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Correctly indented and removes WET repetition of code blocks and makes the resulting code DRYer&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;% if review.done_by_staff_participant? %&amp;gt;&lt;br /&gt;
      &amp;lt;img&lt;br /&gt;
      data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
      data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
      title=&amp;quot;Icon indicates this review was done by course staff&amp;quot; class=&amp;quot;img_icon&amp;quot;&lt;br /&gt;
      src=&amp;quot;/assets/staff.png&amp;quot;&lt;br /&gt;
      &amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;a&lt;br /&gt;
      target=&amp;quot;_blank&amp;quot;&lt;br /&gt;
      href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;&lt;br /&gt;
      data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
      data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
      title=&amp;quot;Click to see details&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;%= review_text %&amp;gt;&lt;br /&gt;
    &amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====F.In app/views/grades/view_team.html.erb:====&lt;br /&gt;
&lt;br /&gt;
'''F.1: '''Added function teammateSelectOnChange: This function toggles the visibility for the teammate heatgrids when the instructor changes the dropdown&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  function teammateSelectOnChange(selectNode) {&lt;br /&gt;
      const revieweeIdToShow= selectNode.value;&lt;br /&gt;
      const tableSelector = &amp;quot;.teammate_table&amp;quot;;&lt;br /&gt;
      if(revieweeIdToShow == &amp;quot;all&amp;quot;) {&lt;br /&gt;
        document.querySelectorAll(tableSelector).forEach((tableNode) =&amp;gt; {&lt;br /&gt;
          tableNode.classList.remove(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
        });&lt;br /&gt;
        return;&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
    document.querySelectorAll(tableSelector).forEach((tableNode) =&amp;gt; {&lt;br /&gt;
      const tableRevieweeId = tableNode.getAttribute('data-reviewee_id');&lt;br /&gt;
      if(tableRevieweeId == revieweeIdToShow) {&lt;br /&gt;
        tableNode.classList.remove(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
      } else {&lt;br /&gt;
        tableNode.classList.add(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
      }&lt;br /&gt;
      });&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't render TeammateReviewQuestionnaire&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;% @vmlist.each do |vm| %&amp;gt;&lt;br /&gt;
        &amp;lt;% if (vm.questionnaire_display_type == &amp;quot;Metareview&amp;quot; or vm.questionnaire_display_type == &amp;quot;Author Feedback&amp;quot; or vm.questionnaire_display_type == &amp;quot;Teammate Review&amp;quot;) and @current_role_name.eql?'Student' %&amp;gt;&lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
        &amp;lt;% if vm.list_of_reviewers.length &amp;gt; 0 %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Use a boolean to render a dropdown (that contains the students' IDs and names) just before the first TeammateReviewQuestionnaire, and unset that boolean so we only render 1 table. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;%# This boolean is used to render a dropdown just before the first teammate review heat grid %&amp;gt;&lt;br /&gt;
&amp;lt;% first_teammate_review_appeared = false %&amp;gt;&lt;br /&gt;
&amp;lt;% @vmlist.each do |vm| %&amp;gt;&lt;br /&gt;
     &amp;lt;% if (not @current_role_name.eql?'Student' and&lt;br /&gt;
        not first_teammate_review_appeared and&lt;br /&gt;
        vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; &lt;br /&gt;
      ) %&amp;gt;&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        &amp;lt;select onchange=&amp;quot;teammateSelectOnChange(this)&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;all&amp;quot;&amp;gt;All&amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;% @vmlist.select { |tm_vm| tm_vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; }.each do |tm_vm| %&amp;gt;&lt;br /&gt;
            &amp;lt;option value=&amp;quot;&amp;lt;%= tm_vm.reviewee_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;%= tm_vm.reviewee_name(session[:ip]) %&amp;gt;&lt;br /&gt;
            &amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
        &amp;lt;/select&amp;gt;&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;% first_teammate_review_appeared = true %&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Add conditions which check for the truthiness of ```@assignment.show_teammate_reviews``` and if the current user is a student to decide whether to render the table or not.  Since the existing code checks truthiness for the cases for which NOT to render a table, we have followed the existing style of the code.&lt;br /&gt;
&lt;br /&gt;
1) If type of view model is teammate review questionnaire, and current role is student, and if @assignment.show_teammate_reviews is false, then we don't render anything&lt;br /&gt;
2) If type of view model is teammate review questionnaire, and current role is student, but @assignment.show_teammate_reviews is true, then we don't render anything if the current reviewer_id is different to the currently logged in user.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;% if (vm.questionnaire_display_type == &amp;quot;Metareview&amp;quot; or vm.questionnaire_display_type == &amp;quot;Author Feedback&amp;quot;) and @current_role_name.eql?'Student' %&amp;gt;&lt;br /&gt;
    &amp;lt;% elsif (&lt;br /&gt;
      vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; and&lt;br /&gt;
      @current_role_name.eql?'Student' and&lt;br /&gt;
      !@assignment.show_teammate_reviews&lt;br /&gt;
      ) %&amp;gt;&lt;br /&gt;
    &amp;lt;% elsif (&lt;br /&gt;
      vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; and &lt;br /&gt;
      @current_role_name.eql?'Student' and&lt;br /&gt;
      @assignment.show_teammate_reviews and current_user.id != vm.reviewee_id&lt;br /&gt;
      )%&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Finally, add a CSS class and a `data-reviewee_id` to keep track of the heatgrids when toggling visibility.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
        &amp;lt;% if vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
          &amp;lt;div class=&amp;quot;teammate_table&amp;quot; data-reviewee_id=&amp;quot;&amp;lt;%= vm.reviewee_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
        &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.3  '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't print the teammate who is being reviewed.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
          &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
            &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: If TeammteReviewQuestionnaire is used, then use the `:reviewee_name` method for VmQuestionResponse model to print the name of the student who is being reviewed.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
          &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
            &amp;lt;% elsif vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (For: &amp;lt;%= vm.reviewee_name(session[:ip]) %&amp;gt;)&lt;br /&gt;
            &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.4 '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't inform the partial about the type of review being done&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_reviews.each do |review| %&amp;gt;&lt;br /&gt;
              &amp;lt;!-- instructors (or higher level users) see reviewer name, students see anonymized string --&amp;gt;&lt;br /&gt;
              &amp;lt;% if (['Student'].include? @current_role_name) &amp;amp;&amp;amp; @assignment.is_anonymous%&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i} %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                  &amp;lt;% user_name = User.find(Participant.find(ResponseMap.find(Response.find(review.id).map_id).reviewer_id).user_id).fullname(session[:ip]).to_s %&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i} %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% i += 1 %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
New code: Passes the type of review being done to the partial, so it can decide on how to render the review title. Note: This code seems to use repetition, but since the conditional used here are accessing `Anonymous` assignments and checking for user roles, we have not modified this code, as it is not directly related to our scope.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_reviews.each do |review| %&amp;gt;&lt;br /&gt;
              &amp;lt;!-- instructors (or higher level users) see reviewer name, students see anonymized string --&amp;gt;&lt;br /&gt;
              &amp;lt;% if (['Student'].include? @current_role_name) &amp;amp;&amp;amp; @assignment.is_anonymous%&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i, questionnaire_type: vm.questionnaire_type } %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                &amp;lt;% user_name = User.find(Participant.find(ResponseMap.find(Response.find(review.id).map_id).reviewer_id).user_id).fullname(session[:ip]).to_s %&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i, questionnaire_type: vm.questionnaire_type } %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% i += 1 %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Old code: Contains a `metrics-1` column&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-true&amp;quot; align=&amp;quot;right&amp;quot; &amp;gt;&lt;br /&gt;
            Avg&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;span  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;A count of comments, for the respective question, which have word count &amp;gt; 10. The purpose of this metric is to represent how many comments for the question are of a substantial length to provide quality feedback.&amp;quot;&amp;gt;metric-1&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/thead&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
New code: As per discussion with mentor, this column has been removed in our PR.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-true&amp;quot; align=&amp;quot;right&amp;quot; &amp;gt;&lt;br /&gt;
            Avg&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/thead&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.5 '''&lt;br /&gt;
&lt;br /&gt;
Old code: It creates the ID inline in multiple places, so if we decide to change the ID generation logic, we need to modify it in multiple places. (which happened when we started rendering multiple tables for each teammate).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_rows.each do |row| %&amp;gt;&lt;br /&gt;
            &amp;lt;!-- notice the data-target. because we're toggling via looped code, we need to dynamically generate the identifier. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr data-toggle=&amp;quot;collapse&amp;quot; class=&amp;quot;accordion-toggle&amp;quot; data-target=&amp;quot;#hid&amp;lt;%= row.question_id.to_s + vm.round.to_s %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Generate the unique HTML ID once, in a readable manner once. And conditionally make it more unique, if it is a TeammateReviewQuestionnaire, since jQuery code requires these IDs to be unique amongst different tables. If we don't make it more unique, then clicking on one teammate review table will toggle the table visibility for the first table. To prevent this &amp;quot;clashing&amp;quot;, we need to make these IDs more unique for a TeammateReviewQuestionnaire.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_rows.each do |row| %&amp;gt;&lt;br /&gt;
            &amp;lt;% target_id = &amp;quot;hid__#{row.question_id}__#{vm.round}&amp;quot; %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
              &amp;lt;%# Since we render different heatgrids with the same questions for each&lt;br /&gt;
              teammember, we need to distinguish the ID, based on the user for whom,&lt;br /&gt;
              the reviews have been created. %&amp;gt;&lt;br /&gt;
              &amp;lt;% target_id += &amp;quot;__#{vm.reviewee_id}&amp;quot; %&amp;gt;&lt;br /&gt;
            &amp;lt;% end%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;!-- notice the data-target. because we're toggling via looped code, we need to dynamically generate the identifier. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr data-toggle=&amp;quot;collapse&amp;quot; class=&amp;quot;accordion-toggle&amp;quot; data-target=&amp;quot;&amp;lt;%= &amp;quot;#&amp;quot; + target_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Old code: Written on a single line crossing 80 characters on a single line&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
              &amp;lt;% row.score_row.each do |score| %&amp;gt;&lt;br /&gt;
                  &amp;lt;% score_comment = score.comment.nil? ? '' : score.comment %&amp;gt; &amp;lt;!-- changing nil to null string to avoid Null Pointer Exception --&amp;gt;&lt;br /&gt;
                  &amp;lt;td class=&amp;quot;&amp;lt;%= score.color_code %&amp;gt;&amp;quot; align=&amp;quot;center&amp;quot; data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= strip_tags(score.comment).html_safe%&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;&amp;lt;%=  underlined?(score) %&amp;gt;&amp;quot;&amp;gt;&amp;lt;%= score.score_value.to_s %&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
                  &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
New code: Make code more readable by indenting it and splitting it over multiple lines&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
              &amp;lt;!-- actual cells with scores and colored background. --&amp;gt;&lt;br /&gt;
              &amp;lt;% row.score_row.each do |score| %&amp;gt;&lt;br /&gt;
                  &amp;lt;% score_comment = score.comment.nil? ? '' : score.comment %&amp;gt;&lt;br /&gt;
                  &amp;lt;!-- changing nil to null string to avoid Null Pointer Exception --&amp;gt;&lt;br /&gt;
                  &amp;lt;td class=&amp;quot;&amp;lt;%= score.color_code %&amp;gt;&amp;quot; align=&amp;quot;center&amp;quot; data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= strip_tags(score.comment).html_safe%&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;&amp;lt;%=  underlined?(score) %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                      &amp;lt;%= score.score_value.to_s %&amp;gt;&lt;br /&gt;
                    &amp;lt;/span&amp;gt;&lt;br /&gt;
                  &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.6 '''Removed the following code as it corresponds to the deleted column&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 &amp;lt;td  class = 'cf' align=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;%= row.countofcomments.to_s %&amp;gt;&lt;br /&gt;
              &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.7 '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code just unconditionally prints the text &amp;quot;Review&amp;quot; followed by an index.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                    &amp;lt;% for index in 0 .. row.score_row.length - 1 %&amp;gt;&lt;br /&gt;
                        &amp;lt;tr&amp;gt;&lt;br /&gt;
                          &amp;lt;td&amp;gt;Review &amp;lt;%=index + 1%&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Conditionally change the review text that is displayed based on the type of review and the access level of the user&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                    &amp;lt;% for index in 0 .. row.score_row.length - 1 %&amp;gt;&lt;br /&gt;
                        &amp;lt;tr&amp;gt;&lt;br /&gt;
                          &amp;lt;% if @current_role_name.eql?'Student' or vm.questionnaire_type != &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                            &amp;lt;%# Use Review {{index}} format for student view, and&lt;br /&gt;
                            when questionnaire_type is not teammatereview %&amp;gt;&lt;br /&gt;
                            &amp;lt;td&amp;gt;Review &amp;lt;%=index + 1%&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
                          &amp;lt;% else %&amp;gt;&lt;br /&gt;
                            &amp;lt;td&amp;gt;&lt;br /&gt;
                              &amp;lt;% reviewer_id = row.score_row[index].reviewer_id %&amp;gt;&lt;br /&gt;
                              &amp;lt;% fullname = Participant.find_by(id: reviewer_id).fullname(session[:ip]) %&amp;gt;&lt;br /&gt;
                              Review by &amp;lt;%= fullname %&amp;gt;&lt;br /&gt;
                            &amp;lt;/td&amp;gt;&lt;br /&gt;
                          &amp;lt;% end%&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====G. In spec/controllers/grades_controller_spec.rb:====&lt;br /&gt;
&lt;br /&gt;
'''G.1 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
before(:each) do&lt;br /&gt;
  allow(AssignmentParticipant).to receive(:find).with('1').and_return(participant)&lt;br /&gt;
  allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
  stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
@@ -91,29 +90,106 @@&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
before(:each) do&lt;br /&gt;
  allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
  stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
@@ -91,29 +90,106 @@&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''G.2 '''Remove xdescribe '#view_team' and change describe '#view_team' as follows.&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#view_team' do&lt;br /&gt;
render_views&lt;br /&gt;
context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
  it 'renders grades#view_team page' do&lt;br /&gt;
    allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
    allow(AssignmentQuestionnaire).to receive(:find_by).with(assignment_id: 1, questionnaire_id: 1).and_return(assignment_questionnaire)&lt;br /&gt;
    allow(AssignmentQuestionnaire).to receive(:where).with(any_args).and_return([assignment_questionnaire])&lt;br /&gt;
    allow(assignment).to receive(:late_policy_id).and_return(false)&lt;br /&gt;
    allow(assignment).to receive(:calculate_penalty).and_return(false)&lt;br /&gt;
    allow(assignment).to receive(:compute_total_score).with(any_args).and_return(100)&lt;br /&gt;
    allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
    allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
    params = {id: 1}&lt;br /&gt;
    allow(TaMapping).to receive(:exists?).with(ta_id: 1, course_id: 1).and_return(true)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#view_team' do&lt;br /&gt;
render_views&lt;br /&gt;
&lt;br /&gt;
# All stubs and factories are instantiated within this scope so as to not &lt;br /&gt;
# clash with other broken test.&lt;br /&gt;
# The names of the factories created for testing view_team&lt;br /&gt;
# have `_vt` suffix ```where necessary``` to differentiate them from &lt;br /&gt;
# the above declared factories&lt;br /&gt;
&lt;br /&gt;
let(:student1_vt) { create(:student, name: &amp;quot;barry&amp;quot;, id: 12) }&lt;br /&gt;
let(:student2_vt) { create(:student, name: &amp;quot;iris&amp;quot;, id: 13) }&lt;br /&gt;
&lt;br /&gt;
let(:tm_questionnaire) {&lt;br /&gt;
  build(&lt;br /&gt;
    :teammate_review_questionnaire,&lt;br /&gt;
    id: 12,&lt;br /&gt;
    questions: [question],&lt;br /&gt;
    max_question_score: 5&lt;br /&gt;
  )&lt;br /&gt;
}&lt;br /&gt;
let(:assignment_vt) {&lt;br /&gt;
  create(:assignment, id: 6, max_team_size: 2,&lt;br /&gt;
  questionnaires: [tm_questionnaire])&lt;br /&gt;
}&lt;br /&gt;
let(:assignment_questionnaire_vt) {&lt;br /&gt;
  create(:tm_assignment_questionnaire, id: 12, used_in_round: nil,&lt;br /&gt;
  assignment: assignment_vt, questionnaire: tm_questionnaire) }&lt;br /&gt;
let(:team_vt) { create(:assignment_team, id: 12,&lt;br /&gt;
assignment: assignment_vt) }&lt;br /&gt;
let(:participant_vt) { create(:participant, id: 12,&lt;br /&gt;
  assignment: assignment_vt, user_id: student1_vt.id) }&lt;br /&gt;
let(:participant2_vt) { create(:participant, id: 13,&lt;br /&gt;
  assignment: assignment_vt, user_id: student2_vt.id) }&lt;br /&gt;
&lt;br /&gt;
before(:each) do&lt;br /&gt;
  # Need to stub this method so the factory instance with&lt;br /&gt;
  # the stubbed :team method is returned by :find&lt;br /&gt;
  # instead of a separate instance with the same data&lt;br /&gt;
  allow(AssignmentParticipant)&lt;br /&gt;
    .to receive(:find)&lt;br /&gt;
    .with(participant_vt.id.to_s)&lt;br /&gt;
    .and_return(participant_vt)&lt;br /&gt;
  allow(participant_vt).to receive(:team).and_return(team_vt)&lt;br /&gt;
  allow(team_vt).to receive(:participants).and_return([participant_vt, participant2_vt])&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:find_by)&lt;br /&gt;
    .with(assignment_id: assignment_vt.id, questionnaire_id: tm_questionnaire.id)&lt;br /&gt;
    .and_return(assignment_questionnaire_vt)&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:find_by)&lt;br /&gt;
    .with(assignment_id: assignment.id, questionnaire_id: review_questionnaire.id)&lt;br /&gt;
    .and_return(assignment_questionnaire_vt)&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:where)&lt;br /&gt;
    .with(any_args)&lt;br /&gt;
    .and_return([assignment_questionnaire_vt])&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:late_policy_id)&lt;br /&gt;
    .and_return(false)&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:calculate_penalty)&lt;br /&gt;
    .and_return(false)&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:compute_total_score)&lt;br /&gt;
    .with(any_args)&lt;br /&gt;
    .and_return(100)&lt;br /&gt;
  allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
  allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
 it 'renders grades#view_team page' do&lt;br /&gt;
  params = {id: participant_vt.id}&lt;br /&gt;
  get :view_team, params&lt;br /&gt;
  expect(response).to render_template(:view_team)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is opened by student' do&lt;br /&gt;
  it 'dropdown is not rendered' do&lt;br /&gt;
    session = { user: student1_vt }&lt;br /&gt;
    params = {id: participant_vt.id}&lt;br /&gt;
    stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
    get :view_team, params&lt;br /&gt;
    expect(response.body).to_not have_selector('select')&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is opened by instructor' do&lt;br /&gt;
  it 'dropdown is rendered' do&lt;br /&gt;
    session = { user: instructor }&lt;br /&gt;
    params = {id: participant_vt.id}&lt;br /&gt;
    get :view_team, params&lt;br /&gt;
    expect(response.body).to have_selector('select')&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
  it 'renders grades#view_team page' do&lt;br /&gt;
    params = { id: participant_vt.id }&lt;br /&gt;
    allow(TaMapping).to receive(:exists?).with(ta_id: participant_vt.user_id, course_id: 1).and_return(true)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====H. In spec/factories/factories.rb:====&lt;br /&gt;
&lt;br /&gt;
'''H.1 '''Add the following factory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
factory :teammate_review_questionnaire, class: TeammateReviewQuestionnaire do&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''H.2 '''Add another factory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
factory :tm_assignment_questionnaire, class: AssignmentQuestionnaire do&lt;br /&gt;
  user_id 1&lt;br /&gt;
  questionnaire { association(:teammate_review_questionnaire) }&lt;br /&gt;
  questionnaire_weight 100&lt;br /&gt;
  used_in_round nil&lt;br /&gt;
  topic_id nil&lt;br /&gt;
  dropdown 1&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
The tests written as a part of this project can be run by running the following command on terminal:&lt;br /&gt;
&lt;br /&gt;
1. rspec ./spec/controllers/grades_controller_spec.rb  -e &amp;quot;#view_team&amp;quot;&lt;br /&gt;
&lt;br /&gt;
2. rspec .vm_question_response_score_cell_spec.rb  -e &amp;quot;#reviewer_id&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''OLD STATUS'''&lt;br /&gt;
&lt;br /&gt;
1. Earlier, the tests contained an xdescribe test to check if the view_team page is rendered correctly. However, this test was being skipped as this was an xdescribe segment. There was another test for when the view_team page is accessed by a student who is also a TA for another course. This can be checked [https://github.com/expertiza/expertiza/blob/beta/spec/controllers/grades_controller_spec.rb here].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 xdescribe '#view_team' do&lt;br /&gt;
    it 'renders grades#view_team page' do&lt;br /&gt;
      allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
      params = {id: 1}&lt;br /&gt;
      get :view_team, params&lt;br /&gt;
      expect(response).to render_template(:view_team)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#view_team' do&lt;br /&gt;
    render_views&lt;br /&gt;
    context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
      it 'renders grades#view_team page' do&lt;br /&gt;
        allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
        allow(AssignmentQuestionnaire).to receive(:find_by).with(assignment_id: 1, questionnaire_id: 1).and_return(assignment_questionnaire)&lt;br /&gt;
        allow(AssignmentQuestionnaire).to receive(:where).with(any_args).and_return([assignment_questionnaire])&lt;br /&gt;
        allow(assignment).to receive(:late_policy_id).and_return(false)&lt;br /&gt;
        allow(assignment).to receive(:calculate_penalty).and_return(false)&lt;br /&gt;
        allow(assignment).to receive(:compute_total_score).with(any_args).and_return(100)&lt;br /&gt;
        allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
        allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
        params = {id: 1}&lt;br /&gt;
        allow(TaMapping).to receive(:exists?).with(ta_id: 1, course_id: 1).and_return(true)&lt;br /&gt;
        stub_current_user(ta, ta.role.name, ta.role)&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).not_to have_content &amp;quot;TA&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''NEW STATUS'''&lt;br /&gt;
&lt;br /&gt;
1. The view_team page is rendered correctly for a given student or an instructor. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    it 'renders grades#view_team page' do&lt;br /&gt;
      params = {id: participant_vt.id}&lt;br /&gt;
      get :view_team, params&lt;br /&gt;
      expect(response).to render_template(:view_team)&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. When students access then the view_team page, the dropdown to select a student's teammate reviews is not rendered on the page. The dropdown is rendered if the page is accessed by an instructor. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   context 'dropdown for selecting a teammate review' do&lt;br /&gt;
    render_views&lt;br /&gt;
      it 'is not rendered is not rendered when page is opened by student' do&lt;br /&gt;
        session = { user: student1_vt }&lt;br /&gt;
        params = {id: participant_vt.id}&lt;br /&gt;
        stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to_not have_selector('select')&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      it 'is rendered when page is opened by instructor' do&lt;br /&gt;
        session = { user: instructor }&lt;br /&gt;
        params = {id: participant_vt.id}&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to have_selector('select')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. When a student who is also a TA for another course access the view_team page, that student should be able to a student's view to the page. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
      it 'renders grades#view_team page' do&lt;br /&gt;
        params = { id: participant_vt.id }&lt;br /&gt;
        allow(TaMapping).to receive(:exists?).with(ta_id: participant_vt.user_id, course_id: 1).and_return(true)&lt;br /&gt;
        stub_current_user(ta, ta.role.name, ta.role)&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).not_to have_content &amp;quot;TA&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. If show_teammate_reviews boolean is set to False, then the student should not be able to see the teammate reviews given to him/her. An instructor can still see the teammate reviews. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when assignment(show reviews) value is unchecked' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        allow(assignment_vt).to receive(:show_teammate_reviews).and_return(false) &lt;br /&gt;
      end&lt;br /&gt;
      it 'Student cannot view his score' do&lt;br /&gt;
        session = { user: student1_vt }&lt;br /&gt;
        params = {id: participant_vt.id}&lt;br /&gt;
        stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to_not have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
        expect(response.body).to_not have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant2_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      it 'Instructor can view the student score' do        &lt;br /&gt;
        params = {id: participant_vt.id}        &lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
        expect(response.body).to have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant2_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. If show_teammate_reviews boolean is set to True, then both the student should and instructor should be able to see the teammate reviews. The student should see only the reviews received by him/her. The instructor should be able to see all student's teammate reviews. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    context 'when assignment(show reviews) value is checked' do&lt;br /&gt;
      it 'Student can view his score' do&lt;br /&gt;
        session = { user: student1_vt }&lt;br /&gt;
        params = {id: participant_vt.id}&lt;br /&gt;
        stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
        expect(response.body).to_not have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant2_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      it 'Instructor can view the student score' do        &lt;br /&gt;
        params = {id: participant_vt.id}        &lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
        expect(response.body).to have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant2_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. The reviewer id is tracked correctly to show the correct reviewer name in the teammate reviews table. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/models/vm_question_response_score_cell_spec.rb this] file &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  	describe '#reviewer_id' do&lt;br /&gt;
  		it 'returns reviewer id' do&lt;br /&gt;
			allow(ResponseMap).to receive(:find).with(1).and_return(review_response_map)&lt;br /&gt;
			allow(response).to receive(:populate_new_response).with(:review_response_map, &amp;quot;0&amp;quot;).and_return(response)&lt;br /&gt;
        	expect(response.id).to eq(1)	&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Summary of file changes ==&lt;br /&gt;
&lt;br /&gt;
The following files are modified:&lt;br /&gt;
&lt;br /&gt;
1. app/controllers/grades_controller.rb - Controller file which changed how the view model is populated&lt;br /&gt;
&lt;br /&gt;
2. app/views/grades/view_team.html.erb - View file, which  conditionally rendered the teammate name, for a teammate review heatgrid&lt;br /&gt;
&lt;br /&gt;
3. spec/controllers/grades_controller_spec.rb - For tests verifying the proposed changes&lt;br /&gt;
&lt;br /&gt;
4. app/models/vm_question_response.rb - To modify the view-model so it can tell us the name of the person being reviewed for the current heatgrid&lt;br /&gt;
&lt;br /&gt;
5. app/models/vm_question_response_score_cell.rb - &lt;br /&gt;
&lt;br /&gt;
6. app/assets/stylesheets/grades.scss - &lt;br /&gt;
&lt;br /&gt;
7. app/views/grades/_add_icon_to_name.html.erb - &lt;br /&gt;
&lt;br /&gt;
8. spec/factories/factories.rb -&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Design Patterns ==&lt;br /&gt;
&lt;br /&gt;
Existing code does not use any design patterns, apart from if-else. It uses if-else conditional statements to check what type of questionnaire is present in the viewmodel `VmQuestionResponse`, and based on that, it renders the appropriate content.&lt;br /&gt;
&lt;br /&gt;
We decided to continue with this approach since to change the present coding style, there were required many changes (refactoring) to many files which were out of the scope of the present project. To complete the project in the assigned time, we followed the if-else approach.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;https://expertiza.ncsu.edu/&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Agarg25</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141761</id>
		<title>CSC/ECE 517 Fall 2021 - E2165. Fix teammate-review view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141761"/>
		<updated>2021-11-28T19:25:29Z</updated>

		<summary type="html">&lt;p&gt;Agarg25: /* Use case diagram for the system */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Introduction ==&lt;br /&gt;
&lt;br /&gt;
Dr. Edward Gehringer (instructor), Parimal Mehta (mentor)&lt;br /&gt;
&lt;br /&gt;
1. Anjali Garg (unity ID : agarg25)&lt;br /&gt;
&lt;br /&gt;
2. Arvasu Chikara (unity ID: achikar2)&lt;br /&gt;
&lt;br /&gt;
3. Lalit Bangad (unity ID: llbangad)&lt;br /&gt;
&lt;br /&gt;
4. Vinay Deshmukh (unity ID: vdeshmu)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Problems to be addressed ==&lt;br /&gt;
&lt;br /&gt;
After a project is submitted and reviewed, both the team members (students) and instructors should be able to view the teammate reviews. Students should be able to view the reviews by going to a particular assignment's -&amp;gt; your scores, at the bottom of the page. An instructor can view the teammate reviews by going to assignments -&amp;gt; assignment -&amp;gt; particular team's submission -&amp;gt; view submission -&amp;gt; assign grades -&amp;gt; view scores. &lt;br /&gt;
&lt;br /&gt;
In the case of the instructor, a single heat grid is shown whereas in the case of a team member, we cant view the scores. In the heat grid, it is not clear if the scores visible are for the reviews that the student has *written* for their teammates or the scores that the student has *received* from their teammates. Additionally, for instructors can choose from a list of the students on the team, but they have no way to tell whether the heat grid shows the reviews done *by* that student or done *for* that student.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Methodology Overview ==&lt;br /&gt;
&lt;br /&gt;
We have divided our work in the following tasks to address the above problems:&lt;br /&gt;
&lt;br /&gt;
1. Distinguish reviews done for a student by rendering separates heatgrids for each student&lt;br /&gt;
&lt;br /&gt;
2. For instructors, the table will have sections based on the students&lt;br /&gt;
&lt;br /&gt;
3. Include a checkbox on the edit assignment page that enables/disables visibility of heat grid to students&lt;br /&gt;
&lt;br /&gt;
4. Fix the average column for a table (which breaks for some reviews)&lt;br /&gt;
&lt;br /&gt;
5. Show a composite score derived from all reviews.  Make this code generalized, so other kinds of heat grid views could use it.&lt;br /&gt;
&lt;br /&gt;
6. Changes should work even in an anonymized view&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Motivations ==&lt;br /&gt;
&lt;br /&gt;
1. Enable users to clearly tell which reviews are done by them, and which reviews are done for them.&lt;br /&gt;
&lt;br /&gt;
2. Code should be generic so it can be used for different types of heat grids as well.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Control Flow to access the concerned screens ==&lt;br /&gt;
'''1. For instructor (Log in as an instructor):-'''&lt;br /&gt;
&lt;br /&gt;
Screen after logging in by the instructor&lt;br /&gt;
[[File:ss1.png |border|1000px|center]]&lt;br /&gt;
Got to assignments on the Manage menu &lt;br /&gt;
[[File:ss2.png |border|1000px|center]]&lt;br /&gt;
Go to assignments&lt;br /&gt;
[[File:ss3.png |border|1000px|center]]&lt;br /&gt;
Go to submissions for any assignment&lt;br /&gt;
[[File:ss4a.png |border|1000px|center]]&lt;br /&gt;
Go to Assign Grade&lt;br /&gt;
[[File:ss5a.png |border|1000px|center]]&lt;br /&gt;
You will land on the page where the changes are made and can be reviewed&lt;br /&gt;
[[File:ss7a.png |border|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
'''2. Student:- (Instructor impersonating a student)'''&lt;br /&gt;
&lt;br /&gt;
After landing on the assignments page, select any student from an assignment as shown below&lt;br /&gt;
[[File:ss6a.png |border|1000px|center]]&lt;br /&gt;
Go to/Select any assignment&lt;br /&gt;
[[File:ss9a.png |border|1000px|center]]&lt;br /&gt;
Go to your scores&lt;br /&gt;
[[File:ss10a.png |border|1000px|center]]&lt;br /&gt;
You will land on the page where the changes are made and can be reviewed&lt;br /&gt;
[[File:ss11a.png |border|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
== Old Status of the application ==&lt;br /&gt;
&lt;br /&gt;
'''1. Instructor's view of teammate review''': This is the current screen given to the instructor. Here we see that the instructor can not determine who has given which review to which student in a team.&lt;br /&gt;
&lt;br /&gt;
[[File:Instructor-view-1.png|border| 700px |center|alt=The proposed expanded student display.|The proposed expanded student display.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2. Student's view of teammate review''': Currently, a student is not able to see what grades were given by their teammates. We need to implement that functionality so that the student is able to view those grades.&lt;br /&gt;
&lt;br /&gt;
[[File:Student-view-2.png|border| 700px |center|alt=The current instructor view.|The current review display for instructors.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Error in existing UI for student''': In the existing UI for a student, the highlighted block should not be rendered. This part of the screen is meant for the instructors/TAs. &lt;br /&gt;
&lt;br /&gt;
[[File:Wrong render for student.png|border|700px|center|alt=Existing UI for student|Existing UI for student.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Proposed changes ==&lt;br /&gt;
&lt;br /&gt;
''' 1) Proposed UI for instructor ''': The instructor is able to see the score for all teammates. In the existing code, only one teammate's scores are being shown. But, we are planning to change the way the (VmQuestionResponse array is populated)[https://github.com/expertiza/expertiza/blob/master/app/controllers/grades_controller.rb#L114], so that the scores for all teammates are appended to it so it correctly shows what should have already been shown in this screen for the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Proposed_screen.png|border|700px|center|alt=Proposed UI for instructor|Proposed UI for instructor.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: When a student visits this screen, they will only be shown the reviews received by them, assuming the instructor has allowed visibility of teammate reviews to students.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' 2) Show detailed review for a particular question''': The instructor can see detailed review given to a student by their teammates by clicking on a particular question number in the table.&lt;br /&gt;
&lt;br /&gt;
[[File:ss12a.png|border|700px|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' 3) Show teammate review to student UI ''': The existing code doesn't render a student's teammate review scores at all. We are planning to render the scores to a student (as shown below) when they visit this screen. However, the visibility of this screen is contingent on whether the instructor has allowed visibility of the teammate review screen to students. If the instructor has disabled this feature, then the heatgrid will not be displayed at all.&lt;br /&gt;
&lt;br /&gt;
[[File:UI_for_student.png|border|700px|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== User Stories ==&lt;br /&gt;
&lt;br /&gt;
1. As an instructor, I can view what reviews one teammate has given to other teammates.&lt;br /&gt;
&lt;br /&gt;
2. As a student, I can view what reviews my teammates have given to me.&lt;br /&gt;
&lt;br /&gt;
3. As an instructor, I can choose if I want to see all student's teammates reviews together or one by one.&lt;br /&gt;
&lt;br /&gt;
4. As a student, if I am also a TA for another subject, I should not be able to see an instructor's view to the view_team page.&lt;br /&gt;
&lt;br /&gt;
5. As an instructor, I should be able to see the name of the reviewers for the reviews to a particular student.&lt;br /&gt;
&lt;br /&gt;
== UML diagram for the system ==  &lt;br /&gt;
&lt;br /&gt;
[[File:vie_team_use_case.png|border|center]]&lt;br /&gt;
&lt;br /&gt;
== Models used / Explanation of fixes ==&lt;br /&gt;
&lt;br /&gt;
The below diagram illustrates the proposed code change for showing all team members with the teammate review data to an instructor. The existing code only iterated on the `Participant` whose ID is present in the URL of the page. To fix this, we will iterate over all teammates of the given participant so that all teammate reviews for all team members are shown to the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Logic e2165.png|border|center|alt=Flow diagram of proposed changes for showing team review data to instructor]]&lt;br /&gt;
&lt;br /&gt;
===Changes made to the code are shown below. Every change is shown and explained separately===&lt;br /&gt;
&lt;br /&gt;
====A. Added the following to app/assets/stylesheets/grades.scss:====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    .teammate_table.hidden {&lt;br /&gt;
      display: none;&lt;br /&gt;
      }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====B. In app/controllers/grades_controller.rb: ====&lt;br /&gt;
&lt;br /&gt;
'''B.1:'''&lt;br /&gt;
&lt;br /&gt;
Old code: The existing code does not differentiate when adding a view model for the TeammateReview questionnaire&lt;br /&gt;
  questionnaires.each do |questionnaire|&lt;br /&gt;
     ...&lt;br /&gt;
     @vmlist &amp;lt;&amp;lt; populate_view_model(questionnaire)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
New code: Since the current page URL contains an ID for the participant, from which we get an assignment, which gives us a list of questionnaires, we need to iterate all participants for a `TeammateReveiwQuestionnaire` questionnaire, so that we get the heatgrid view models for all members of a team.&lt;br /&gt;
  questionnaires.each do |questionnaire|&lt;br /&gt;
     ...&lt;br /&gt;
     if questionnaire.type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
        # as teammate review will be different for each participant&lt;br /&gt;
        # we need to create a separate table for each teammate&lt;br /&gt;
        @participant.team.participants.each do |team_participant|&lt;br /&gt;
          @vmlist &amp;lt;&amp;lt; populate_view_model(team_participant, questionnaire, @team)&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        # only one participant needs iterating, as apart from teammatereview&lt;br /&gt;
        # all other reviews are at &amp;quot;team&amp;quot; level&lt;br /&gt;
        @vmlist &amp;lt;&amp;lt; populate_view_model(@participant, questionnaire, @team)&lt;br /&gt;
      end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
'''B.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code: This code uses @participant as an instance variable, but this structure will not work as we need to call this ViewModel with multiple participants when iterating for a teammate review questionnaire.&lt;br /&gt;
    def populate_view_model(questionnaire)&lt;br /&gt;
      vm = VmQuestionResponse.new(questionnaire, @assignment, @round)&lt;br /&gt;
      vmquestions = questionnaire.questions&lt;br /&gt;
      vm.add_questions(vmquestions)&lt;br /&gt;
      vm.add_team_members(@team)&lt;br /&gt;
      vm.add_reviews(@participant, @team, @assignment.vary_by_round)&lt;br /&gt;
      vm.number_of_comments_greater_than_10_words&lt;br /&gt;
      vm &lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
New code: We need to call this function with a separate participant in each invocation due to our change for TeammateReviewQuestionnaire, hence it makes sense to make `participant` as an argument to this function. Similarly, as `team` is a closely related model to `participant`, we are passing it as an argument, to keep this function as &amp;quot;pure&amp;quot; as possible.&lt;br /&gt;
    def populate_view_model(participant, questionnaire, team)&lt;br /&gt;
      ...&lt;br /&gt;
      vm.add_team_members(team)&lt;br /&gt;
      vm.add_reviews(participant, team, @assignment.vary_by_round)&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
====C. In app/models/vm_question_response.rb:====&lt;br /&gt;
&lt;br /&gt;
'''C.1: '''Added the reviewee_id method: Created a helper method within the VmQuestionReponse model to retrieve the `reviewee_id` for a heatgrid&lt;br /&gt;
&lt;br /&gt;
    def reviewee_id&lt;br /&gt;
      @participant_who_is_reviewee.user_id&lt;br /&gt;
    end &lt;br /&gt;
&lt;br /&gt;
'''C.2: '''Added the reviewee_name method: Created a helper method within the VmQuestionReponse model to retrieve the name of the student who is being reviewed for a heatgrid. This method uses the functionality to anonymize the name when we are in anonymized view.&lt;br /&gt;
&lt;br /&gt;
    def reviewee_name(ip_address = nil)&lt;br /&gt;
      part = @participant_who_is_reviewee&lt;br /&gt;
      User.find_by(id: part.user_id).fullname(ip_address)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''C.3: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Does not keep track of the student being reviewed&lt;br /&gt;
    elsif @questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
      reviews = participant.teammate_reviews&lt;br /&gt;
      reviews.each do |review|&lt;br /&gt;
        review_mapping = TeammateReviewResponseMap.find_by(id: review.map_id)&lt;br /&gt;
        participant = Participant.find(review_mapping.reviewer_id)&lt;br /&gt;
&lt;br /&gt;
New code: Add an instance variable to keep track of the student who is being reviewed in this VmQuestionReponse&lt;br /&gt;
    elsif @questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
      reviews = participant.teammate_reviews&lt;br /&gt;
      @participant_who_is_reviewee = participant&lt;br /&gt;
      reviews.each do |review|&lt;br /&gt;
        review_mapping = TeammateReviewResponseMap.find_by(id: review.map_id)&lt;br /&gt;
        participant = Participant.find(review_mapping.reviewer_id)&lt;br /&gt;
&lt;br /&gt;
'''C.4: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing VmQuestionReponseScoreCell keeps no information about the reviewer, as it only stores the answer score&lt;br /&gt;
    row.score_row.push(VmQuestionResponseScoreCell.new(answer.answer, color_code, answer.comments, vm_tag_prompts))&lt;br /&gt;
&lt;br /&gt;
New code: Keep track of the response ID, so that we can retrieve the user ID for the reviewer in the model to use in the view file.&lt;br /&gt;
    &lt;br /&gt;
    row.score_row.push(VmQuestionResponseScoreCell.new(answer.answer, color_code, answer.comments, vm_tag_prompts, answer.response_id))&lt;br /&gt;
&lt;br /&gt;
====D. In app/models/vm_question_response_score_cell.rb:====&lt;br /&gt;
&lt;br /&gt;
'''D.1: '''In the method initialize of class VmQuestionResponseScoreCell&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't keep track of the response id&lt;br /&gt;
    def initialize(score_value, color_code, comments, vmprompts = nil)&lt;br /&gt;
      @score_value = score_value&lt;br /&gt;
      @color_code = color_code&lt;br /&gt;
      @comment = comments&lt;br /&gt;
      @vm_prompts = vmprompts&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
New code: We added an instance variable to keep track of response_id&lt;br /&gt;
&lt;br /&gt;
    def initialize(score_value, color_code, comments, vmprompts = nil, response_id)&lt;br /&gt;
      ...&lt;br /&gt;
      @response_id = response_id&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''D.2: '''Added a method reviewer_id to the class VmQuestionResponseScoreCell: This helper method retrieves the ID for the reviewer who created this response.&lt;br /&gt;
&lt;br /&gt;
    def reviewer_id&lt;br /&gt;
      resp = Response.find(@response_id)&lt;br /&gt;
      map = ResponseMap.find(resp.map_id)&lt;br /&gt;
      map.reviewer_id&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
====E. In app/views/grades/_add_icon_to_name.html.erb:====&lt;br /&gt;
&lt;br /&gt;
'''E.1 '''Added the following code to the file: Write the code to generate the review text only once to reduce WET code&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;%# Determine the content of the reviewed by text %&amp;gt;&lt;br /&gt;
    &amp;lt;% review_text = &amp;quot;&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% if @current_role_name.eql?'Student' or questionnaire_type != &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
      &amp;lt;%# Use Review {{index}} format for student view, and when questionnaire_type is not teammatereview %&amp;gt;&lt;br /&gt;
      &amp;lt;% review_text = &amp;quot;Review #{i + 1}&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;% resp = Response.find(review.id) %&amp;gt;&lt;br /&gt;
      &amp;lt;% map = ResponseMap.find(resp.map_id) %&amp;gt;&lt;br /&gt;
      &amp;lt;% reviewer_id = map.reviewer_id %&amp;gt;&lt;br /&gt;
      &amp;lt;% fullname = Participant.find_by(id: reviewer_id).fullname(session[:ip]) %&amp;gt;&lt;br /&gt;
      &amp;lt;% review_text = &amp;quot;Review by #{fullname}&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% end%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''E.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code is very unreadable as it's not indented, and written in a single line with 359 characters, which breaks the ruby style guide rules&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;% if review.done_by_staff_participant? %&amp;gt;&lt;br /&gt;
      &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt; &amp;lt;img data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Icon indicates this review was done by course staff&amp;quot; class=&amp;quot;img_icon&amp;quot; src=&amp;quot;/assets/staff.png&amp;quot;&amp;gt; &amp;lt;a target=&amp;quot;_blank&amp;quot; href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Click to see details&amp;quot;&amp;gt;&amp;lt;%= &amp;quot;Review &amp;quot; + i.to_s  %&amp;gt;&amp;lt;/a&amp;gt; &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt; &amp;lt;a target=&amp;quot;_blank&amp;quot; href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Click to see details&amp;quot;&amp;gt;&amp;lt;%= &amp;quot;Review &amp;quot; + i.to_s %&amp;gt;&amp;lt;/a&amp;gt;  &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Correctly indented and removes WET repetition of code blocks and makes the resulting code DRYer&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;% if review.done_by_staff_participant? %&amp;gt;&lt;br /&gt;
      &amp;lt;img&lt;br /&gt;
      data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
      data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
      title=&amp;quot;Icon indicates this review was done by course staff&amp;quot; class=&amp;quot;img_icon&amp;quot;&lt;br /&gt;
      src=&amp;quot;/assets/staff.png&amp;quot;&lt;br /&gt;
      &amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;a&lt;br /&gt;
      target=&amp;quot;_blank&amp;quot;&lt;br /&gt;
      href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;&lt;br /&gt;
      data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
      data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
      title=&amp;quot;Click to see details&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;%= review_text %&amp;gt;&lt;br /&gt;
    &amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====F.In app/views/grades/view_team.html.erb:====&lt;br /&gt;
&lt;br /&gt;
'''F.1: '''Added function teammateSelectOnChange: This function toggles the visibility for the teammate heatgrids when the instructor changes the dropdown&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  function teammateSelectOnChange(selectNode) {&lt;br /&gt;
      const revieweeIdToShow= selectNode.value;&lt;br /&gt;
      const tableSelector = &amp;quot;.teammate_table&amp;quot;;&lt;br /&gt;
      if(revieweeIdToShow == &amp;quot;all&amp;quot;) {&lt;br /&gt;
        document.querySelectorAll(tableSelector).forEach((tableNode) =&amp;gt; {&lt;br /&gt;
          tableNode.classList.remove(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
        });&lt;br /&gt;
        return;&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
    document.querySelectorAll(tableSelector).forEach((tableNode) =&amp;gt; {&lt;br /&gt;
      const tableRevieweeId = tableNode.getAttribute('data-reviewee_id');&lt;br /&gt;
      if(tableRevieweeId == revieweeIdToShow) {&lt;br /&gt;
        tableNode.classList.remove(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
      } else {&lt;br /&gt;
        tableNode.classList.add(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
      }&lt;br /&gt;
      });&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't render TeammateReviewQuestionnaire&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;% @vmlist.each do |vm| %&amp;gt;&lt;br /&gt;
        &amp;lt;% if (vm.questionnaire_display_type == &amp;quot;Metareview&amp;quot; or vm.questionnaire_display_type == &amp;quot;Author Feedback&amp;quot; or vm.questionnaire_display_type == &amp;quot;Teammate Review&amp;quot;) and @current_role_name.eql?'Student' %&amp;gt;&lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
        &amp;lt;% if vm.list_of_reviewers.length &amp;gt; 0 %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Use a boolean to render a dropdown (that contains the students' IDs and names) just before the first TeammateReviewQuestionnaire, and unset that boolean so we only render 1 table. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;%# This boolean is used to render a dropdown just before the first teammate review heat grid %&amp;gt;&lt;br /&gt;
&amp;lt;% first_teammate_review_appeared = false %&amp;gt;&lt;br /&gt;
&amp;lt;% @vmlist.each do |vm| %&amp;gt;&lt;br /&gt;
     &amp;lt;% if (not @current_role_name.eql?'Student' and&lt;br /&gt;
        not first_teammate_review_appeared and&lt;br /&gt;
        vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; &lt;br /&gt;
      ) %&amp;gt;&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        &amp;lt;select onchange=&amp;quot;teammateSelectOnChange(this)&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;all&amp;quot;&amp;gt;All&amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;% @vmlist.select { |tm_vm| tm_vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; }.each do |tm_vm| %&amp;gt;&lt;br /&gt;
            &amp;lt;option value=&amp;quot;&amp;lt;%= tm_vm.reviewee_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;%= tm_vm.reviewee_name(session[:ip]) %&amp;gt;&lt;br /&gt;
            &amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
        &amp;lt;/select&amp;gt;&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;% first_teammate_review_appeared = true %&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Add conditions which check for the truthiness of ```@assignment.show_teammate_reviews``` and if the current user is a student to decide whether to render the table or not.  Since the existing code checks truthiness for the cases for which NOT to render a table, we have followed the existing style of the code.&lt;br /&gt;
&lt;br /&gt;
1) If type of view model is teammate review questionnaire, and current role is student, and if @assignment.show_teammate_reviews is false, then we don't render anything&lt;br /&gt;
2) If type of view model is teammate review questionnaire, and current role is student, but @assignment.show_teammate_reviews is true, then we don't render anything if the current reviewer_id is different to the currently logged in user.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;% if (vm.questionnaire_display_type == &amp;quot;Metareview&amp;quot; or vm.questionnaire_display_type == &amp;quot;Author Feedback&amp;quot;) and @current_role_name.eql?'Student' %&amp;gt;&lt;br /&gt;
    &amp;lt;% elsif (&lt;br /&gt;
      vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; and&lt;br /&gt;
      @current_role_name.eql?'Student' and&lt;br /&gt;
      !@assignment.show_teammate_reviews&lt;br /&gt;
      ) %&amp;gt;&lt;br /&gt;
    &amp;lt;% elsif (&lt;br /&gt;
      vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; and &lt;br /&gt;
      @current_role_name.eql?'Student' and&lt;br /&gt;
      @assignment.show_teammate_reviews and current_user.id != vm.reviewee_id&lt;br /&gt;
      )%&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Finally, add a CSS class and a `data-reviewee_id` to keep track of the heatgrids when toggling visibility.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
        &amp;lt;% if vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
          &amp;lt;div class=&amp;quot;teammate_table&amp;quot; data-reviewee_id=&amp;quot;&amp;lt;%= vm.reviewee_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
        &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.3  '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't print the teammate who is being reviewed.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
          &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
            &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: If TeammteReviewQuestionnaire is used, then use the `:reviewee_name` method for VmQuestionResponse model to print the name of the student who is being reviewed.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
          &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
            &amp;lt;% elsif vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (For: &amp;lt;%= vm.reviewee_name(session[:ip]) %&amp;gt;)&lt;br /&gt;
            &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.4 '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't inform the partial about the type of review being done&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_reviews.each do |review| %&amp;gt;&lt;br /&gt;
              &amp;lt;!-- instructors (or higher level users) see reviewer name, students see anonymized string --&amp;gt;&lt;br /&gt;
              &amp;lt;% if (['Student'].include? @current_role_name) &amp;amp;&amp;amp; @assignment.is_anonymous%&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i} %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                  &amp;lt;% user_name = User.find(Participant.find(ResponseMap.find(Response.find(review.id).map_id).reviewer_id).user_id).fullname(session[:ip]).to_s %&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i} %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% i += 1 %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
New code: Passes the type of review being done to the partial, so it can decide on how to render the review title. Note: This code seems to use repetition, but since the conditional used here are accessing `Anonymous` assignments and checking for user roles, we have not modified this code, as it is not directly related to our scope.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_reviews.each do |review| %&amp;gt;&lt;br /&gt;
              &amp;lt;!-- instructors (or higher level users) see reviewer name, students see anonymized string --&amp;gt;&lt;br /&gt;
              &amp;lt;% if (['Student'].include? @current_role_name) &amp;amp;&amp;amp; @assignment.is_anonymous%&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i, questionnaire_type: vm.questionnaire_type } %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                &amp;lt;% user_name = User.find(Participant.find(ResponseMap.find(Response.find(review.id).map_id).reviewer_id).user_id).fullname(session[:ip]).to_s %&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i, questionnaire_type: vm.questionnaire_type } %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% i += 1 %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Old code: Contains a `metrics-1` column&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-true&amp;quot; align=&amp;quot;right&amp;quot; &amp;gt;&lt;br /&gt;
            Avg&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;span  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;A count of comments, for the respective question, which have word count &amp;gt; 10. The purpose of this metric is to represent how many comments for the question are of a substantial length to provide quality feedback.&amp;quot;&amp;gt;metric-1&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/thead&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
New code: As per discussion with mentor, this column has been removed in our PR.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-true&amp;quot; align=&amp;quot;right&amp;quot; &amp;gt;&lt;br /&gt;
            Avg&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/thead&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.5 '''&lt;br /&gt;
&lt;br /&gt;
Old code: It creates the ID inline in multiple places, so if we decide to change the ID generation logic, we need to modify it in multiple places. (which happened when we started rendering multiple tables for each teammate).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_rows.each do |row| %&amp;gt;&lt;br /&gt;
            &amp;lt;!-- notice the data-target. because we're toggling via looped code, we need to dynamically generate the identifier. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr data-toggle=&amp;quot;collapse&amp;quot; class=&amp;quot;accordion-toggle&amp;quot; data-target=&amp;quot;#hid&amp;lt;%= row.question_id.to_s + vm.round.to_s %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Generate the unique HTML ID once, in a readable manner once. And conditionally make it more unique, if it is a TeammateReviewQuestionnaire, since jQuery code requires these IDs to be unique amongst different tables. If we don't make it more unique, then clicking on one teammate review table will toggle the table visibility for the first table. To prevent this &amp;quot;clashing&amp;quot;, we need to make these IDs more unique for a TeammateReviewQuestionnaire.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_rows.each do |row| %&amp;gt;&lt;br /&gt;
            &amp;lt;% target_id = &amp;quot;hid__#{row.question_id}__#{vm.round}&amp;quot; %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
              &amp;lt;%# Since we render different heatgrids with the same questions for each&lt;br /&gt;
              teammember, we need to distinguish the ID, based on the user for whom,&lt;br /&gt;
              the reviews have been created. %&amp;gt;&lt;br /&gt;
              &amp;lt;% target_id += &amp;quot;__#{vm.reviewee_id}&amp;quot; %&amp;gt;&lt;br /&gt;
            &amp;lt;% end%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;!-- notice the data-target. because we're toggling via looped code, we need to dynamically generate the identifier. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr data-toggle=&amp;quot;collapse&amp;quot; class=&amp;quot;accordion-toggle&amp;quot; data-target=&amp;quot;&amp;lt;%= &amp;quot;#&amp;quot; + target_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Old code: Written on a single line crossing 80 characters on a single line&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
              &amp;lt;% row.score_row.each do |score| %&amp;gt;&lt;br /&gt;
                  &amp;lt;% score_comment = score.comment.nil? ? '' : score.comment %&amp;gt; &amp;lt;!-- changing nil to null string to avoid Null Pointer Exception --&amp;gt;&lt;br /&gt;
                  &amp;lt;td class=&amp;quot;&amp;lt;%= score.color_code %&amp;gt;&amp;quot; align=&amp;quot;center&amp;quot; data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= strip_tags(score.comment).html_safe%&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;&amp;lt;%=  underlined?(score) %&amp;gt;&amp;quot;&amp;gt;&amp;lt;%= score.score_value.to_s %&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
                  &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
New code: Make code more readable by indenting it and splitting it over multiple lines&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
              &amp;lt;!-- actual cells with scores and colored background. --&amp;gt;&lt;br /&gt;
              &amp;lt;% row.score_row.each do |score| %&amp;gt;&lt;br /&gt;
                  &amp;lt;% score_comment = score.comment.nil? ? '' : score.comment %&amp;gt;&lt;br /&gt;
                  &amp;lt;!-- changing nil to null string to avoid Null Pointer Exception --&amp;gt;&lt;br /&gt;
                  &amp;lt;td class=&amp;quot;&amp;lt;%= score.color_code %&amp;gt;&amp;quot; align=&amp;quot;center&amp;quot; data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= strip_tags(score.comment).html_safe%&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;&amp;lt;%=  underlined?(score) %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                      &amp;lt;%= score.score_value.to_s %&amp;gt;&lt;br /&gt;
                    &amp;lt;/span&amp;gt;&lt;br /&gt;
                  &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.6 '''Removed the following code as it corresponds to the deleted column&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 &amp;lt;td  class = 'cf' align=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;%= row.countofcomments.to_s %&amp;gt;&lt;br /&gt;
              &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.7 '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code just unconditionally prints the text &amp;quot;Review&amp;quot; followed by an index.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                    &amp;lt;% for index in 0 .. row.score_row.length - 1 %&amp;gt;&lt;br /&gt;
                        &amp;lt;tr&amp;gt;&lt;br /&gt;
                          &amp;lt;td&amp;gt;Review &amp;lt;%=index + 1%&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Conditionally change the review text that is displayed based on the type of review and the access level of the user&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                    &amp;lt;% for index in 0 .. row.score_row.length - 1 %&amp;gt;&lt;br /&gt;
                        &amp;lt;tr&amp;gt;&lt;br /&gt;
                          &amp;lt;% if @current_role_name.eql?'Student' or vm.questionnaire_type != &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                            &amp;lt;%# Use Review {{index}} format for student view, and&lt;br /&gt;
                            when questionnaire_type is not teammatereview %&amp;gt;&lt;br /&gt;
                            &amp;lt;td&amp;gt;Review &amp;lt;%=index + 1%&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
                          &amp;lt;% else %&amp;gt;&lt;br /&gt;
                            &amp;lt;td&amp;gt;&lt;br /&gt;
                              &amp;lt;% reviewer_id = row.score_row[index].reviewer_id %&amp;gt;&lt;br /&gt;
                              &amp;lt;% fullname = Participant.find_by(id: reviewer_id).fullname(session[:ip]) %&amp;gt;&lt;br /&gt;
                              Review by &amp;lt;%= fullname %&amp;gt;&lt;br /&gt;
                            &amp;lt;/td&amp;gt;&lt;br /&gt;
                          &amp;lt;% end%&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====G. In spec/controllers/grades_controller_spec.rb:====&lt;br /&gt;
&lt;br /&gt;
'''G.1 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
before(:each) do&lt;br /&gt;
  allow(AssignmentParticipant).to receive(:find).with('1').and_return(participant)&lt;br /&gt;
  allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
  stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
@@ -91,29 +90,106 @@&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
before(:each) do&lt;br /&gt;
  allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
  stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
@@ -91,29 +90,106 @@&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''G.2 '''Remove xdescribe '#view_team' and change describe '#view_team' as follows.&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#view_team' do&lt;br /&gt;
render_views&lt;br /&gt;
context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
  it 'renders grades#view_team page' do&lt;br /&gt;
    allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
    allow(AssignmentQuestionnaire).to receive(:find_by).with(assignment_id: 1, questionnaire_id: 1).and_return(assignment_questionnaire)&lt;br /&gt;
    allow(AssignmentQuestionnaire).to receive(:where).with(any_args).and_return([assignment_questionnaire])&lt;br /&gt;
    allow(assignment).to receive(:late_policy_id).and_return(false)&lt;br /&gt;
    allow(assignment).to receive(:calculate_penalty).and_return(false)&lt;br /&gt;
    allow(assignment).to receive(:compute_total_score).with(any_args).and_return(100)&lt;br /&gt;
    allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
    allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
    params = {id: 1}&lt;br /&gt;
    allow(TaMapping).to receive(:exists?).with(ta_id: 1, course_id: 1).and_return(true)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#view_team' do&lt;br /&gt;
render_views&lt;br /&gt;
&lt;br /&gt;
# All stubs and factories are instantiated within this scope so as to not &lt;br /&gt;
# clash with other broken test.&lt;br /&gt;
# The names of the factories created for testing view_team&lt;br /&gt;
# have `_vt` suffix ```where necessary``` to differentiate them from &lt;br /&gt;
# the above declared factories&lt;br /&gt;
&lt;br /&gt;
let(:student1_vt) { create(:student, name: &amp;quot;barry&amp;quot;, id: 12) }&lt;br /&gt;
let(:student2_vt) { create(:student, name: &amp;quot;iris&amp;quot;, id: 13) }&lt;br /&gt;
&lt;br /&gt;
let(:tm_questionnaire) {&lt;br /&gt;
  build(&lt;br /&gt;
    :teammate_review_questionnaire,&lt;br /&gt;
    id: 12,&lt;br /&gt;
    questions: [question],&lt;br /&gt;
    max_question_score: 5&lt;br /&gt;
  )&lt;br /&gt;
}&lt;br /&gt;
let(:assignment_vt) {&lt;br /&gt;
  create(:assignment, id: 6, max_team_size: 2,&lt;br /&gt;
  questionnaires: [tm_questionnaire])&lt;br /&gt;
}&lt;br /&gt;
let(:assignment_questionnaire_vt) {&lt;br /&gt;
  create(:tm_assignment_questionnaire, id: 12, used_in_round: nil,&lt;br /&gt;
  assignment: assignment_vt, questionnaire: tm_questionnaire) }&lt;br /&gt;
let(:team_vt) { create(:assignment_team, id: 12,&lt;br /&gt;
assignment: assignment_vt) }&lt;br /&gt;
let(:participant_vt) { create(:participant, id: 12,&lt;br /&gt;
  assignment: assignment_vt, user_id: student1_vt.id) }&lt;br /&gt;
let(:participant2_vt) { create(:participant, id: 13,&lt;br /&gt;
  assignment: assignment_vt, user_id: student2_vt.id) }&lt;br /&gt;
&lt;br /&gt;
before(:each) do&lt;br /&gt;
  # Need to stub this method so the factory instance with&lt;br /&gt;
  # the stubbed :team method is returned by :find&lt;br /&gt;
  # instead of a separate instance with the same data&lt;br /&gt;
  allow(AssignmentParticipant)&lt;br /&gt;
    .to receive(:find)&lt;br /&gt;
    .with(participant_vt.id.to_s)&lt;br /&gt;
    .and_return(participant_vt)&lt;br /&gt;
  allow(participant_vt).to receive(:team).and_return(team_vt)&lt;br /&gt;
  allow(team_vt).to receive(:participants).and_return([participant_vt, participant2_vt])&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:find_by)&lt;br /&gt;
    .with(assignment_id: assignment_vt.id, questionnaire_id: tm_questionnaire.id)&lt;br /&gt;
    .and_return(assignment_questionnaire_vt)&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:find_by)&lt;br /&gt;
    .with(assignment_id: assignment.id, questionnaire_id: review_questionnaire.id)&lt;br /&gt;
    .and_return(assignment_questionnaire_vt)&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:where)&lt;br /&gt;
    .with(any_args)&lt;br /&gt;
    .and_return([assignment_questionnaire_vt])&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:late_policy_id)&lt;br /&gt;
    .and_return(false)&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:calculate_penalty)&lt;br /&gt;
    .and_return(false)&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:compute_total_score)&lt;br /&gt;
    .with(any_args)&lt;br /&gt;
    .and_return(100)&lt;br /&gt;
  allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
  allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
 it 'renders grades#view_team page' do&lt;br /&gt;
  params = {id: participant_vt.id}&lt;br /&gt;
  get :view_team, params&lt;br /&gt;
  expect(response).to render_template(:view_team)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is opened by student' do&lt;br /&gt;
  it 'dropdown is not rendered' do&lt;br /&gt;
    session = { user: student1_vt }&lt;br /&gt;
    params = {id: participant_vt.id}&lt;br /&gt;
    stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
    get :view_team, params&lt;br /&gt;
    expect(response.body).to_not have_selector('select')&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is opened by instructor' do&lt;br /&gt;
  it 'dropdown is rendered' do&lt;br /&gt;
    session = { user: instructor }&lt;br /&gt;
    params = {id: participant_vt.id}&lt;br /&gt;
    get :view_team, params&lt;br /&gt;
    expect(response.body).to have_selector('select')&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
  it 'renders grades#view_team page' do&lt;br /&gt;
    params = { id: participant_vt.id }&lt;br /&gt;
    allow(TaMapping).to receive(:exists?).with(ta_id: participant_vt.user_id, course_id: 1).and_return(true)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====H. In spec/factories/factories.rb:====&lt;br /&gt;
&lt;br /&gt;
'''H.1 '''Add the following factory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
factory :teammate_review_questionnaire, class: TeammateReviewQuestionnaire do&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''H.2 '''Add another factory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
factory :tm_assignment_questionnaire, class: AssignmentQuestionnaire do&lt;br /&gt;
  user_id 1&lt;br /&gt;
  questionnaire { association(:teammate_review_questionnaire) }&lt;br /&gt;
  questionnaire_weight 100&lt;br /&gt;
  used_in_round nil&lt;br /&gt;
  topic_id nil&lt;br /&gt;
  dropdown 1&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
The tests written as a part of this project can be run by running the following command on terminal:&lt;br /&gt;
&lt;br /&gt;
1. rspec ./spec/controllers/grades_controller_spec.rb  -e &amp;quot;#view_team&amp;quot;&lt;br /&gt;
&lt;br /&gt;
2. rspec .vm_question_response_score_cell_spec.rb  -e &amp;quot;#reviewer_id&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''OLD STATUS'''&lt;br /&gt;
&lt;br /&gt;
1. Earlier, the tests contained an xdescribe test to check if the view_team page is rendered correctly. However, this test was being skipped as this was an xdescribe segment. There was another test for when the view_team page is accessed by a student who is also a TA for another course. This can be checked [https://github.com/expertiza/expertiza/blob/beta/spec/controllers/grades_controller_spec.rb here].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 xdescribe '#view_team' do&lt;br /&gt;
    it 'renders grades#view_team page' do&lt;br /&gt;
      allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
      params = {id: 1}&lt;br /&gt;
      get :view_team, params&lt;br /&gt;
      expect(response).to render_template(:view_team)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#view_team' do&lt;br /&gt;
    render_views&lt;br /&gt;
    context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
      it 'renders grades#view_team page' do&lt;br /&gt;
        allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
        allow(AssignmentQuestionnaire).to receive(:find_by).with(assignment_id: 1, questionnaire_id: 1).and_return(assignment_questionnaire)&lt;br /&gt;
        allow(AssignmentQuestionnaire).to receive(:where).with(any_args).and_return([assignment_questionnaire])&lt;br /&gt;
        allow(assignment).to receive(:late_policy_id).and_return(false)&lt;br /&gt;
        allow(assignment).to receive(:calculate_penalty).and_return(false)&lt;br /&gt;
        allow(assignment).to receive(:compute_total_score).with(any_args).and_return(100)&lt;br /&gt;
        allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
        allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
        params = {id: 1}&lt;br /&gt;
        allow(TaMapping).to receive(:exists?).with(ta_id: 1, course_id: 1).and_return(true)&lt;br /&gt;
        stub_current_user(ta, ta.role.name, ta.role)&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).not_to have_content &amp;quot;TA&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''NEW STATUS'''&lt;br /&gt;
&lt;br /&gt;
1. The view_team page is rendered correctly for a given student or an instructor. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    it 'renders grades#view_team page' do&lt;br /&gt;
      params = {id: participant_vt.id}&lt;br /&gt;
      get :view_team, params&lt;br /&gt;
      expect(response).to render_template(:view_team)&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. When students access then the view_team page, the dropdown to select a student's teammate reviews is not rendered on the page. The dropdown is rendered if the page is accessed by an instructor. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   context 'dropdown for selecting a teammate review' do&lt;br /&gt;
    render_views&lt;br /&gt;
      it 'is not rendered is not rendered when page is opened by student' do&lt;br /&gt;
        session = { user: student1_vt }&lt;br /&gt;
        params = {id: participant_vt.id}&lt;br /&gt;
        stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to_not have_selector('select')&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      it 'is rendered when page is opened by instructor' do&lt;br /&gt;
        session = { user: instructor }&lt;br /&gt;
        params = {id: participant_vt.id}&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to have_selector('select')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. When a student who is also a TA for another course access the view_team page, that student should be able to a student's view to the page. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
      it 'renders grades#view_team page' do&lt;br /&gt;
        params = { id: participant_vt.id }&lt;br /&gt;
        allow(TaMapping).to receive(:exists?).with(ta_id: participant_vt.user_id, course_id: 1).and_return(true)&lt;br /&gt;
        stub_current_user(ta, ta.role.name, ta.role)&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).not_to have_content &amp;quot;TA&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. If show_teammate_reviews boolean is set to False, then the student should not be able to see the teammate reviews given to him/her. An instructor can still see the teammate reviews. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when assignment(show reviews) value is unchecked' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        allow(assignment_vt).to receive(:show_teammate_reviews).and_return(false) &lt;br /&gt;
      end&lt;br /&gt;
      it 'Student cannot view his score' do&lt;br /&gt;
        session = { user: student1_vt }&lt;br /&gt;
        params = {id: participant_vt.id}&lt;br /&gt;
        stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to_not have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
        expect(response.body).to_not have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant2_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      it 'Instructor can view the student score' do        &lt;br /&gt;
        params = {id: participant_vt.id}        &lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
        expect(response.body).to have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant2_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. If show_teammate_reviews boolean is set to True, then both the student should and instructor should be able to see the teammate reviews. The student should see only the reviews received by him/her. The instructor should be able to see all student's teammate reviews. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    context 'when assignment(show reviews) value is checked' do&lt;br /&gt;
      it 'Student can view his score' do&lt;br /&gt;
        session = { user: student1_vt }&lt;br /&gt;
        params = {id: participant_vt.id}&lt;br /&gt;
        stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
        expect(response.body).to_not have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant2_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      it 'Instructor can view the student score' do        &lt;br /&gt;
        params = {id: participant_vt.id}        &lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
        expect(response.body).to have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant2_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. The reviewer id is tracked correctly to show the correct reviewer name in the teammate reviews table. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/models/vm_question_response_score_cell_spec.rb this] file &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  	describe '#reviewer_id' do&lt;br /&gt;
  		it 'returns reviewer id' do&lt;br /&gt;
			allow(ResponseMap).to receive(:find).with(1).and_return(review_response_map)&lt;br /&gt;
			allow(response).to receive(:populate_new_response).with(:review_response_map, &amp;quot;0&amp;quot;).and_return(response)&lt;br /&gt;
        	expect(response.id).to eq(1)	&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Summary of file changes ==&lt;br /&gt;
&lt;br /&gt;
The following files are modified:&lt;br /&gt;
&lt;br /&gt;
1. app/controllers/grades_controller.rb - Controller file which changed how the view model is populated&lt;br /&gt;
&lt;br /&gt;
2. app/views/grades/view_team.html.erb - View file, which  conditionally rendered the teammate name, for a teammate review heatgrid&lt;br /&gt;
&lt;br /&gt;
3. spec/controllers/grades_controller_spec.rb - For tests verifying the proposed changes&lt;br /&gt;
&lt;br /&gt;
4. app/models/vm_question_response.rb - To modify the view-model so it can tell us the name of the person being reviewed for the current heatgrid&lt;br /&gt;
&lt;br /&gt;
5. app/models/vm_question_response_score_cell.rb - &lt;br /&gt;
&lt;br /&gt;
6. app/assets/stylesheets/grades.scss - &lt;br /&gt;
&lt;br /&gt;
7. app/views/grades/_add_icon_to_name.html.erb - &lt;br /&gt;
&lt;br /&gt;
8. spec/factories/factories.rb -&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Design Patterns ==&lt;br /&gt;
&lt;br /&gt;
Existing code does not use any design patterns, apart from if-else. It uses if-else conditional statements to check what type of questionnaire is present in the viewmodel `VmQuestionResponse`, and based on that, it renders the appropriate content.&lt;br /&gt;
&lt;br /&gt;
We decided to continue with this approach since to change the present coding style, there were required many changes (refactoring) to many files which were out of the scope of the present project. To complete the project in the assigned time, we followed the if-else approach.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;https://expertiza.ncsu.edu/&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Agarg25</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141759</id>
		<title>CSC/ECE 517 Fall 2021 - E2165. Fix teammate-review view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141759"/>
		<updated>2021-11-28T19:23:58Z</updated>

		<summary type="html">&lt;p&gt;Agarg25: /* Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Introduction ==&lt;br /&gt;
&lt;br /&gt;
Dr. Edward Gehringer (instructor), Parimal Mehta (mentor)&lt;br /&gt;
&lt;br /&gt;
1. Anjali Garg (unity ID : agarg25)&lt;br /&gt;
&lt;br /&gt;
2. Arvasu Chikara (unity ID: achikar2)&lt;br /&gt;
&lt;br /&gt;
3. Lalit Bangad (unity ID: llbangad)&lt;br /&gt;
&lt;br /&gt;
4. Vinay Deshmukh (unity ID: vdeshmu)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Problems to be addressed ==&lt;br /&gt;
&lt;br /&gt;
After a project is submitted and reviewed, both the team members (students) and instructors should be able to view the teammate reviews. Students should be able to view the reviews by going to a particular assignment's -&amp;gt; your scores, at the bottom of the page. An instructor can view the teammate reviews by going to assignments -&amp;gt; assignment -&amp;gt; particular team's submission -&amp;gt; view submission -&amp;gt; assign grades -&amp;gt; view scores. &lt;br /&gt;
&lt;br /&gt;
In the case of the instructor, a single heat grid is shown whereas in the case of a team member, we cant view the scores. In the heat grid, it is not clear if the scores visible are for the reviews that the student has *written* for their teammates or the scores that the student has *received* from their teammates. Additionally, for instructors can choose from a list of the students on the team, but they have no way to tell whether the heat grid shows the reviews done *by* that student or done *for* that student.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Methodology Overview ==&lt;br /&gt;
&lt;br /&gt;
We have divided our work in the following tasks to address the above problems:&lt;br /&gt;
&lt;br /&gt;
1. Distinguish reviews done for a student by rendering separates heatgrids for each student&lt;br /&gt;
&lt;br /&gt;
2. For instructors, the table will have sections based on the students&lt;br /&gt;
&lt;br /&gt;
3. Include a checkbox on the edit assignment page that enables/disables visibility of heat grid to students&lt;br /&gt;
&lt;br /&gt;
4. Fix the average column for a table (which breaks for some reviews)&lt;br /&gt;
&lt;br /&gt;
5. Show a composite score derived from all reviews.  Make this code generalized, so other kinds of heat grid views could use it.&lt;br /&gt;
&lt;br /&gt;
6. Changes should work even in an anonymized view&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Motivations ==&lt;br /&gt;
&lt;br /&gt;
1. Enable users to clearly tell which reviews are done by them, and which reviews are done for them.&lt;br /&gt;
&lt;br /&gt;
2. Code should be generic so it can be used for different types of heat grids as well.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Control Flow to access the concerned screens ==&lt;br /&gt;
'''1. For instructor (Log in as an instructor):-'''&lt;br /&gt;
&lt;br /&gt;
Screen after logging in by the instructor&lt;br /&gt;
[[File:ss1.png |border|1000px|center]]&lt;br /&gt;
Got to assignments on the Manage menu &lt;br /&gt;
[[File:ss2.png |border|1000px|center]]&lt;br /&gt;
Go to assignments&lt;br /&gt;
[[File:ss3.png |border|1000px|center]]&lt;br /&gt;
Go to submissions for any assignment&lt;br /&gt;
[[File:ss4a.png |border|1000px|center]]&lt;br /&gt;
Go to Assign Grade&lt;br /&gt;
[[File:ss5a.png |border|1000px|center]]&lt;br /&gt;
You will land on the page where the changes are made and can be reviewed&lt;br /&gt;
[[File:ss7a.png |border|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
'''2. Student:- (Instructor impersonating a student)'''&lt;br /&gt;
&lt;br /&gt;
After landing on the assignments page, select any student from an assignment as shown below&lt;br /&gt;
[[File:ss6a.png |border|1000px|center]]&lt;br /&gt;
Go to/Select any assignment&lt;br /&gt;
[[File:ss9a.png |border|1000px|center]]&lt;br /&gt;
Go to your scores&lt;br /&gt;
[[File:ss10a.png |border|1000px|center]]&lt;br /&gt;
You will land on the page where the changes are made and can be reviewed&lt;br /&gt;
[[File:ss11a.png |border|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
== Old Status of the application ==&lt;br /&gt;
&lt;br /&gt;
'''1. Instructor's view of teammate review''': This is the current screen given to the instructor. Here we see that the instructor can not determine who has given which review to which student in a team.&lt;br /&gt;
&lt;br /&gt;
[[File:Instructor-view-1.png|border| 700px |center|alt=The proposed expanded student display.|The proposed expanded student display.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2. Student's view of teammate review''': Currently, a student is not able to see what grades were given by their teammates. We need to implement that functionality so that the student is able to view those grades.&lt;br /&gt;
&lt;br /&gt;
[[File:Student-view-2.png|border| 700px |center|alt=The current instructor view.|The current review display for instructors.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Error in existing UI for student''': In the existing UI for a student, the highlighted block should not be rendered. This part of the screen is meant for the instructors/TAs. &lt;br /&gt;
&lt;br /&gt;
[[File:Wrong render for student.png|border|700px|center|alt=Existing UI for student|Existing UI for student.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Proposed changes ==&lt;br /&gt;
&lt;br /&gt;
''' 1) Proposed UI for instructor ''': The instructor is able to see the score for all teammates. In the existing code, only one teammate's scores are being shown. But, we are planning to change the way the (VmQuestionResponse array is populated)[https://github.com/expertiza/expertiza/blob/master/app/controllers/grades_controller.rb#L114], so that the scores for all teammates are appended to it so it correctly shows what should have already been shown in this screen for the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Proposed_screen.png|border|700px|center|alt=Proposed UI for instructor|Proposed UI for instructor.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: When a student visits this screen, they will only be shown the reviews received by them, assuming the instructor has allowed visibility of teammate reviews to students.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' 2) Show detailed review for a particular question''': The instructor can see detailed review given to a student by their teammates by clicking on a particular question number in the table.&lt;br /&gt;
&lt;br /&gt;
[[File:ss12a.png|border|700px|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' 3) Show teammate review to student UI ''': The existing code doesn't render a student's teammate review scores at all. We are planning to render the scores to a student (as shown below) when they visit this screen. However, the visibility of this screen is contingent on whether the instructor has allowed visibility of the teammate review screen to students. If the instructor has disabled this feature, then the heatgrid will not be displayed at all.&lt;br /&gt;
&lt;br /&gt;
[[File:UI_for_student.png|border|700px|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== User Stories ==&lt;br /&gt;
&lt;br /&gt;
1. As an instructor, I can view what reviews one teammate has given to other teammates.&lt;br /&gt;
&lt;br /&gt;
2. As a student, I can view what reviews my teammates have given to me.&lt;br /&gt;
&lt;br /&gt;
3. As an instructor, I can choose if I want to see all student's teammates reviews together or one by one.&lt;br /&gt;
&lt;br /&gt;
4. As a student, if I am also a TA for another subject, I should not be able to see an instructor's view to the view_team page.&lt;br /&gt;
&lt;br /&gt;
5. As an instructor, I should be able to see the name of the reviewers for the reviews to a particular student.&lt;br /&gt;
&lt;br /&gt;
== Use case diagram for the system ==  &lt;br /&gt;
&lt;br /&gt;
[[File:vie_team_use_case.png|border|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Models used / Explanation of fixes ==&lt;br /&gt;
&lt;br /&gt;
The below diagram illustrates the proposed code change for showing all team members with the teammate review data to an instructor. The existing code only iterated on the `Participant` whose ID is present in the URL of the page. To fix this, we will iterate over all teammates of the given participant so that all teammate reviews for all team members are shown to the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Logic e2165.png|border|center|alt=Flow diagram of proposed changes for showing team review data to instructor]]&lt;br /&gt;
&lt;br /&gt;
===Changes made to the code are shown below. Every change is shown and explained separately===&lt;br /&gt;
&lt;br /&gt;
====A. Added the following to app/assets/stylesheets/grades.scss:====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    .teammate_table.hidden {&lt;br /&gt;
      display: none;&lt;br /&gt;
      }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====B. In app/controllers/grades_controller.rb: ====&lt;br /&gt;
&lt;br /&gt;
'''B.1:'''&lt;br /&gt;
&lt;br /&gt;
Old code: The existing code does not differentiate when adding a view model for the TeammateReview questionnaire&lt;br /&gt;
  questionnaires.each do |questionnaire|&lt;br /&gt;
     ...&lt;br /&gt;
     @vmlist &amp;lt;&amp;lt; populate_view_model(questionnaire)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
New code: Since the current page URL contains an ID for the participant, from which we get an assignment, which gives us a list of questionnaires, we need to iterate all participants for a `TeammateReveiwQuestionnaire` questionnaire, so that we get the heatgrid view models for all members of a team.&lt;br /&gt;
  questionnaires.each do |questionnaire|&lt;br /&gt;
     ...&lt;br /&gt;
     if questionnaire.type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
        # as teammate review will be different for each participant&lt;br /&gt;
        # we need to create a separate table for each teammate&lt;br /&gt;
        @participant.team.participants.each do |team_participant|&lt;br /&gt;
          @vmlist &amp;lt;&amp;lt; populate_view_model(team_participant, questionnaire, @team)&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        # only one participant needs iterating, as apart from teammatereview&lt;br /&gt;
        # all other reviews are at &amp;quot;team&amp;quot; level&lt;br /&gt;
        @vmlist &amp;lt;&amp;lt; populate_view_model(@participant, questionnaire, @team)&lt;br /&gt;
      end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
'''B.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code: This code uses @participant as an instance variable, but this structure will not work as we need to call this ViewModel with multiple participants when iterating for a teammate review questionnaire.&lt;br /&gt;
    def populate_view_model(questionnaire)&lt;br /&gt;
      vm = VmQuestionResponse.new(questionnaire, @assignment, @round)&lt;br /&gt;
      vmquestions = questionnaire.questions&lt;br /&gt;
      vm.add_questions(vmquestions)&lt;br /&gt;
      vm.add_team_members(@team)&lt;br /&gt;
      vm.add_reviews(@participant, @team, @assignment.vary_by_round)&lt;br /&gt;
      vm.number_of_comments_greater_than_10_words&lt;br /&gt;
      vm &lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
New code: We need to call this function with a separate participant in each invocation due to our change for TeammateReviewQuestionnaire, hence it makes sense to make `participant` as an argument to this function. Similarly, as `team` is a closely related model to `participant`, we are passing it as an argument, to keep this function as &amp;quot;pure&amp;quot; as possible.&lt;br /&gt;
    def populate_view_model(participant, questionnaire, team)&lt;br /&gt;
      ...&lt;br /&gt;
      vm.add_team_members(team)&lt;br /&gt;
      vm.add_reviews(participant, team, @assignment.vary_by_round)&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
====C. In app/models/vm_question_response.rb:====&lt;br /&gt;
&lt;br /&gt;
'''C.1: '''Added the reviewee_id method: Created a helper method within the VmQuestionReponse model to retrieve the `reviewee_id` for a heatgrid&lt;br /&gt;
&lt;br /&gt;
    def reviewee_id&lt;br /&gt;
      @participant_who_is_reviewee.user_id&lt;br /&gt;
    end &lt;br /&gt;
&lt;br /&gt;
'''C.2: '''Added the reviewee_name method: Created a helper method within the VmQuestionReponse model to retrieve the name of the student who is being reviewed for a heatgrid. This method uses the functionality to anonymize the name when we are in anonymized view.&lt;br /&gt;
&lt;br /&gt;
    def reviewee_name(ip_address = nil)&lt;br /&gt;
      part = @participant_who_is_reviewee&lt;br /&gt;
      User.find_by(id: part.user_id).fullname(ip_address)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''C.3: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Does not keep track of the student being reviewed&lt;br /&gt;
    elsif @questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
      reviews = participant.teammate_reviews&lt;br /&gt;
      reviews.each do |review|&lt;br /&gt;
        review_mapping = TeammateReviewResponseMap.find_by(id: review.map_id)&lt;br /&gt;
        participant = Participant.find(review_mapping.reviewer_id)&lt;br /&gt;
&lt;br /&gt;
New code: Add an instance variable to keep track of the student who is being reviewed in this VmQuestionReponse&lt;br /&gt;
    elsif @questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
      reviews = participant.teammate_reviews&lt;br /&gt;
      @participant_who_is_reviewee = participant&lt;br /&gt;
      reviews.each do |review|&lt;br /&gt;
        review_mapping = TeammateReviewResponseMap.find_by(id: review.map_id)&lt;br /&gt;
        participant = Participant.find(review_mapping.reviewer_id)&lt;br /&gt;
&lt;br /&gt;
'''C.4: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing VmQuestionReponseScoreCell keeps no information about the reviewer, as it only stores the answer score&lt;br /&gt;
    row.score_row.push(VmQuestionResponseScoreCell.new(answer.answer, color_code, answer.comments, vm_tag_prompts))&lt;br /&gt;
&lt;br /&gt;
New code: Keep track of the response ID, so that we can retrieve the user ID for the reviewer in the model to use in the view file.&lt;br /&gt;
    &lt;br /&gt;
    row.score_row.push(VmQuestionResponseScoreCell.new(answer.answer, color_code, answer.comments, vm_tag_prompts, answer.response_id))&lt;br /&gt;
&lt;br /&gt;
====D. In app/models/vm_question_response_score_cell.rb:====&lt;br /&gt;
&lt;br /&gt;
'''D.1: '''In the method initialize of class VmQuestionResponseScoreCell&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't keep track of the response id&lt;br /&gt;
    def initialize(score_value, color_code, comments, vmprompts = nil)&lt;br /&gt;
      @score_value = score_value&lt;br /&gt;
      @color_code = color_code&lt;br /&gt;
      @comment = comments&lt;br /&gt;
      @vm_prompts = vmprompts&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
New code: We added an instance variable to keep track of response_id&lt;br /&gt;
&lt;br /&gt;
    def initialize(score_value, color_code, comments, vmprompts = nil, response_id)&lt;br /&gt;
      ...&lt;br /&gt;
      @response_id = response_id&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''D.2: '''Added a method reviewer_id to the class VmQuestionResponseScoreCell: This helper method retrieves the ID for the reviewer who created this response.&lt;br /&gt;
&lt;br /&gt;
    def reviewer_id&lt;br /&gt;
      resp = Response.find(@response_id)&lt;br /&gt;
      map = ResponseMap.find(resp.map_id)&lt;br /&gt;
      map.reviewer_id&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
====E. In app/views/grades/_add_icon_to_name.html.erb:====&lt;br /&gt;
&lt;br /&gt;
'''E.1 '''Added the following code to the file: Write the code to generate the review text only once to reduce WET code&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;%# Determine the content of the reviewed by text %&amp;gt;&lt;br /&gt;
    &amp;lt;% review_text = &amp;quot;&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% if @current_role_name.eql?'Student' or questionnaire_type != &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
      &amp;lt;%# Use Review {{index}} format for student view, and when questionnaire_type is not teammatereview %&amp;gt;&lt;br /&gt;
      &amp;lt;% review_text = &amp;quot;Review #{i + 1}&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;% resp = Response.find(review.id) %&amp;gt;&lt;br /&gt;
      &amp;lt;% map = ResponseMap.find(resp.map_id) %&amp;gt;&lt;br /&gt;
      &amp;lt;% reviewer_id = map.reviewer_id %&amp;gt;&lt;br /&gt;
      &amp;lt;% fullname = Participant.find_by(id: reviewer_id).fullname(session[:ip]) %&amp;gt;&lt;br /&gt;
      &amp;lt;% review_text = &amp;quot;Review by #{fullname}&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% end%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''E.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code is very unreadable as it's not indented, and written in a single line with 359 characters, which breaks the ruby style guide rules&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;% if review.done_by_staff_participant? %&amp;gt;&lt;br /&gt;
      &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt; &amp;lt;img data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Icon indicates this review was done by course staff&amp;quot; class=&amp;quot;img_icon&amp;quot; src=&amp;quot;/assets/staff.png&amp;quot;&amp;gt; &amp;lt;a target=&amp;quot;_blank&amp;quot; href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Click to see details&amp;quot;&amp;gt;&amp;lt;%= &amp;quot;Review &amp;quot; + i.to_s  %&amp;gt;&amp;lt;/a&amp;gt; &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt; &amp;lt;a target=&amp;quot;_blank&amp;quot; href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Click to see details&amp;quot;&amp;gt;&amp;lt;%= &amp;quot;Review &amp;quot; + i.to_s %&amp;gt;&amp;lt;/a&amp;gt;  &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Correctly indented and removes WET repetition of code blocks and makes the resulting code DRYer&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;% if review.done_by_staff_participant? %&amp;gt;&lt;br /&gt;
      &amp;lt;img&lt;br /&gt;
      data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
      data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
      title=&amp;quot;Icon indicates this review was done by course staff&amp;quot; class=&amp;quot;img_icon&amp;quot;&lt;br /&gt;
      src=&amp;quot;/assets/staff.png&amp;quot;&lt;br /&gt;
      &amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;a&lt;br /&gt;
      target=&amp;quot;_blank&amp;quot;&lt;br /&gt;
      href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;&lt;br /&gt;
      data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
      data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
      title=&amp;quot;Click to see details&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;%= review_text %&amp;gt;&lt;br /&gt;
    &amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====F.In app/views/grades/view_team.html.erb:====&lt;br /&gt;
&lt;br /&gt;
'''F.1: '''Added function teammateSelectOnChange: This function toggles the visibility for the teammate heatgrids when the instructor changes the dropdown&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  function teammateSelectOnChange(selectNode) {&lt;br /&gt;
      const revieweeIdToShow= selectNode.value;&lt;br /&gt;
      const tableSelector = &amp;quot;.teammate_table&amp;quot;;&lt;br /&gt;
      if(revieweeIdToShow == &amp;quot;all&amp;quot;) {&lt;br /&gt;
        document.querySelectorAll(tableSelector).forEach((tableNode) =&amp;gt; {&lt;br /&gt;
          tableNode.classList.remove(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
        });&lt;br /&gt;
        return;&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
    document.querySelectorAll(tableSelector).forEach((tableNode) =&amp;gt; {&lt;br /&gt;
      const tableRevieweeId = tableNode.getAttribute('data-reviewee_id');&lt;br /&gt;
      if(tableRevieweeId == revieweeIdToShow) {&lt;br /&gt;
        tableNode.classList.remove(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
      } else {&lt;br /&gt;
        tableNode.classList.add(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
      }&lt;br /&gt;
      });&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't render TeammateReviewQuestionnaire&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;% @vmlist.each do |vm| %&amp;gt;&lt;br /&gt;
        &amp;lt;% if (vm.questionnaire_display_type == &amp;quot;Metareview&amp;quot; or vm.questionnaire_display_type == &amp;quot;Author Feedback&amp;quot; or vm.questionnaire_display_type == &amp;quot;Teammate Review&amp;quot;) and @current_role_name.eql?'Student' %&amp;gt;&lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
        &amp;lt;% if vm.list_of_reviewers.length &amp;gt; 0 %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Use a boolean to render a dropdown (that contains the students' IDs and names) just before the first TeammateReviewQuestionnaire, and unset that boolean so we only render 1 table. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;%# This boolean is used to render a dropdown just before the first teammate review heat grid %&amp;gt;&lt;br /&gt;
&amp;lt;% first_teammate_review_appeared = false %&amp;gt;&lt;br /&gt;
&amp;lt;% @vmlist.each do |vm| %&amp;gt;&lt;br /&gt;
     &amp;lt;% if (not @current_role_name.eql?'Student' and&lt;br /&gt;
        not first_teammate_review_appeared and&lt;br /&gt;
        vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; &lt;br /&gt;
      ) %&amp;gt;&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        &amp;lt;select onchange=&amp;quot;teammateSelectOnChange(this)&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;all&amp;quot;&amp;gt;All&amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;% @vmlist.select { |tm_vm| tm_vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; }.each do |tm_vm| %&amp;gt;&lt;br /&gt;
            &amp;lt;option value=&amp;quot;&amp;lt;%= tm_vm.reviewee_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;%= tm_vm.reviewee_name(session[:ip]) %&amp;gt;&lt;br /&gt;
            &amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
        &amp;lt;/select&amp;gt;&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;% first_teammate_review_appeared = true %&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Add conditions which check for the truthiness of ```@assignment.show_teammate_reviews``` and if the current user is a student to decide whether to render the table or not.  Since the existing code checks truthiness for the cases for which NOT to render a table, we have followed the existing style of the code.&lt;br /&gt;
&lt;br /&gt;
1) If type of view model is teammate review questionnaire, and current role is student, and if @assignment.show_teammate_reviews is false, then we don't render anything&lt;br /&gt;
2) If type of view model is teammate review questionnaire, and current role is student, but @assignment.show_teammate_reviews is true, then we don't render anything if the current reviewer_id is different to the currently logged in user.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;% if (vm.questionnaire_display_type == &amp;quot;Metareview&amp;quot; or vm.questionnaire_display_type == &amp;quot;Author Feedback&amp;quot;) and @current_role_name.eql?'Student' %&amp;gt;&lt;br /&gt;
    &amp;lt;% elsif (&lt;br /&gt;
      vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; and&lt;br /&gt;
      @current_role_name.eql?'Student' and&lt;br /&gt;
      !@assignment.show_teammate_reviews&lt;br /&gt;
      ) %&amp;gt;&lt;br /&gt;
    &amp;lt;% elsif (&lt;br /&gt;
      vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; and &lt;br /&gt;
      @current_role_name.eql?'Student' and&lt;br /&gt;
      @assignment.show_teammate_reviews and current_user.id != vm.reviewee_id&lt;br /&gt;
      )%&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Finally, add a CSS class and a `data-reviewee_id` to keep track of the heatgrids when toggling visibility.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
        &amp;lt;% if vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
          &amp;lt;div class=&amp;quot;teammate_table&amp;quot; data-reviewee_id=&amp;quot;&amp;lt;%= vm.reviewee_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
        &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.3  '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't print the teammate who is being reviewed.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
          &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
            &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: If TeammteReviewQuestionnaire is used, then use the `:reviewee_name` method for VmQuestionResponse model to print the name of the student who is being reviewed.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
          &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
            &amp;lt;% elsif vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (For: &amp;lt;%= vm.reviewee_name(session[:ip]) %&amp;gt;)&lt;br /&gt;
            &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.4 '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't inform the partial about the type of review being done&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_reviews.each do |review| %&amp;gt;&lt;br /&gt;
              &amp;lt;!-- instructors (or higher level users) see reviewer name, students see anonymized string --&amp;gt;&lt;br /&gt;
              &amp;lt;% if (['Student'].include? @current_role_name) &amp;amp;&amp;amp; @assignment.is_anonymous%&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i} %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                  &amp;lt;% user_name = User.find(Participant.find(ResponseMap.find(Response.find(review.id).map_id).reviewer_id).user_id).fullname(session[:ip]).to_s %&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i} %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% i += 1 %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
New code: Passes the type of review being done to the partial, so it can decide on how to render the review title. Note: This code seems to use repetition, but since the conditional used here are accessing `Anonymous` assignments and checking for user roles, we have not modified this code, as it is not directly related to our scope.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_reviews.each do |review| %&amp;gt;&lt;br /&gt;
              &amp;lt;!-- instructors (or higher level users) see reviewer name, students see anonymized string --&amp;gt;&lt;br /&gt;
              &amp;lt;% if (['Student'].include? @current_role_name) &amp;amp;&amp;amp; @assignment.is_anonymous%&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i, questionnaire_type: vm.questionnaire_type } %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                &amp;lt;% user_name = User.find(Participant.find(ResponseMap.find(Response.find(review.id).map_id).reviewer_id).user_id).fullname(session[:ip]).to_s %&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i, questionnaire_type: vm.questionnaire_type } %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% i += 1 %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Old code: Contains a `metrics-1` column&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-true&amp;quot; align=&amp;quot;right&amp;quot; &amp;gt;&lt;br /&gt;
            Avg&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;span  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;A count of comments, for the respective question, which have word count &amp;gt; 10. The purpose of this metric is to represent how many comments for the question are of a substantial length to provide quality feedback.&amp;quot;&amp;gt;metric-1&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/thead&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
New code: As per discussion with mentor, this column has been removed in our PR.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-true&amp;quot; align=&amp;quot;right&amp;quot; &amp;gt;&lt;br /&gt;
            Avg&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/thead&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.5 '''&lt;br /&gt;
&lt;br /&gt;
Old code: It creates the ID inline in multiple places, so if we decide to change the ID generation logic, we need to modify it in multiple places. (which happened when we started rendering multiple tables for each teammate).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_rows.each do |row| %&amp;gt;&lt;br /&gt;
            &amp;lt;!-- notice the data-target. because we're toggling via looped code, we need to dynamically generate the identifier. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr data-toggle=&amp;quot;collapse&amp;quot; class=&amp;quot;accordion-toggle&amp;quot; data-target=&amp;quot;#hid&amp;lt;%= row.question_id.to_s + vm.round.to_s %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Generate the unique HTML ID once, in a readable manner once. And conditionally make it more unique, if it is a TeammateReviewQuestionnaire, since jQuery code requires these IDs to be unique amongst different tables. If we don't make it more unique, then clicking on one teammate review table will toggle the table visibility for the first table. To prevent this &amp;quot;clashing&amp;quot;, we need to make these IDs more unique for a TeammateReviewQuestionnaire.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_rows.each do |row| %&amp;gt;&lt;br /&gt;
            &amp;lt;% target_id = &amp;quot;hid__#{row.question_id}__#{vm.round}&amp;quot; %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
              &amp;lt;%# Since we render different heatgrids with the same questions for each&lt;br /&gt;
              teammember, we need to distinguish the ID, based on the user for whom,&lt;br /&gt;
              the reviews have been created. %&amp;gt;&lt;br /&gt;
              &amp;lt;% target_id += &amp;quot;__#{vm.reviewee_id}&amp;quot; %&amp;gt;&lt;br /&gt;
            &amp;lt;% end%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;!-- notice the data-target. because we're toggling via looped code, we need to dynamically generate the identifier. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr data-toggle=&amp;quot;collapse&amp;quot; class=&amp;quot;accordion-toggle&amp;quot; data-target=&amp;quot;&amp;lt;%= &amp;quot;#&amp;quot; + target_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Old code: Written on a single line crossing 80 characters on a single line&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
              &amp;lt;% row.score_row.each do |score| %&amp;gt;&lt;br /&gt;
                  &amp;lt;% score_comment = score.comment.nil? ? '' : score.comment %&amp;gt; &amp;lt;!-- changing nil to null string to avoid Null Pointer Exception --&amp;gt;&lt;br /&gt;
                  &amp;lt;td class=&amp;quot;&amp;lt;%= score.color_code %&amp;gt;&amp;quot; align=&amp;quot;center&amp;quot; data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= strip_tags(score.comment).html_safe%&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;&amp;lt;%=  underlined?(score) %&amp;gt;&amp;quot;&amp;gt;&amp;lt;%= score.score_value.to_s %&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
                  &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
New code: Make code more readable by indenting it and splitting it over multiple lines&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
              &amp;lt;!-- actual cells with scores and colored background. --&amp;gt;&lt;br /&gt;
              &amp;lt;% row.score_row.each do |score| %&amp;gt;&lt;br /&gt;
                  &amp;lt;% score_comment = score.comment.nil? ? '' : score.comment %&amp;gt;&lt;br /&gt;
                  &amp;lt;!-- changing nil to null string to avoid Null Pointer Exception --&amp;gt;&lt;br /&gt;
                  &amp;lt;td class=&amp;quot;&amp;lt;%= score.color_code %&amp;gt;&amp;quot; align=&amp;quot;center&amp;quot; data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= strip_tags(score.comment).html_safe%&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;&amp;lt;%=  underlined?(score) %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                      &amp;lt;%= score.score_value.to_s %&amp;gt;&lt;br /&gt;
                    &amp;lt;/span&amp;gt;&lt;br /&gt;
                  &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.6 '''Removed the following code as it corresponds to the deleted column&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 &amp;lt;td  class = 'cf' align=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;%= row.countofcomments.to_s %&amp;gt;&lt;br /&gt;
              &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.7 '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code just unconditionally prints the text &amp;quot;Review&amp;quot; followed by an index.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                    &amp;lt;% for index in 0 .. row.score_row.length - 1 %&amp;gt;&lt;br /&gt;
                        &amp;lt;tr&amp;gt;&lt;br /&gt;
                          &amp;lt;td&amp;gt;Review &amp;lt;%=index + 1%&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Conditionally change the review text that is displayed based on the type of review and the access level of the user&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                    &amp;lt;% for index in 0 .. row.score_row.length - 1 %&amp;gt;&lt;br /&gt;
                        &amp;lt;tr&amp;gt;&lt;br /&gt;
                          &amp;lt;% if @current_role_name.eql?'Student' or vm.questionnaire_type != &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                            &amp;lt;%# Use Review {{index}} format for student view, and&lt;br /&gt;
                            when questionnaire_type is not teammatereview %&amp;gt;&lt;br /&gt;
                            &amp;lt;td&amp;gt;Review &amp;lt;%=index + 1%&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
                          &amp;lt;% else %&amp;gt;&lt;br /&gt;
                            &amp;lt;td&amp;gt;&lt;br /&gt;
                              &amp;lt;% reviewer_id = row.score_row[index].reviewer_id %&amp;gt;&lt;br /&gt;
                              &amp;lt;% fullname = Participant.find_by(id: reviewer_id).fullname(session[:ip]) %&amp;gt;&lt;br /&gt;
                              Review by &amp;lt;%= fullname %&amp;gt;&lt;br /&gt;
                            &amp;lt;/td&amp;gt;&lt;br /&gt;
                          &amp;lt;% end%&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====G. In spec/controllers/grades_controller_spec.rb:====&lt;br /&gt;
&lt;br /&gt;
'''G.1 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
before(:each) do&lt;br /&gt;
  allow(AssignmentParticipant).to receive(:find).with('1').and_return(participant)&lt;br /&gt;
  allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
  stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
@@ -91,29 +90,106 @@&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
before(:each) do&lt;br /&gt;
  allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
  stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
@@ -91,29 +90,106 @@&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''G.2 '''Remove xdescribe '#view_team' and change describe '#view_team' as follows.&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#view_team' do&lt;br /&gt;
render_views&lt;br /&gt;
context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
  it 'renders grades#view_team page' do&lt;br /&gt;
    allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
    allow(AssignmentQuestionnaire).to receive(:find_by).with(assignment_id: 1, questionnaire_id: 1).and_return(assignment_questionnaire)&lt;br /&gt;
    allow(AssignmentQuestionnaire).to receive(:where).with(any_args).and_return([assignment_questionnaire])&lt;br /&gt;
    allow(assignment).to receive(:late_policy_id).and_return(false)&lt;br /&gt;
    allow(assignment).to receive(:calculate_penalty).and_return(false)&lt;br /&gt;
    allow(assignment).to receive(:compute_total_score).with(any_args).and_return(100)&lt;br /&gt;
    allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
    allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
    params = {id: 1}&lt;br /&gt;
    allow(TaMapping).to receive(:exists?).with(ta_id: 1, course_id: 1).and_return(true)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#view_team' do&lt;br /&gt;
render_views&lt;br /&gt;
&lt;br /&gt;
# All stubs and factories are instantiated within this scope so as to not &lt;br /&gt;
# clash with other broken test.&lt;br /&gt;
# The names of the factories created for testing view_team&lt;br /&gt;
# have `_vt` suffix ```where necessary``` to differentiate them from &lt;br /&gt;
# the above declared factories&lt;br /&gt;
&lt;br /&gt;
let(:student1_vt) { create(:student, name: &amp;quot;barry&amp;quot;, id: 12) }&lt;br /&gt;
let(:student2_vt) { create(:student, name: &amp;quot;iris&amp;quot;, id: 13) }&lt;br /&gt;
&lt;br /&gt;
let(:tm_questionnaire) {&lt;br /&gt;
  build(&lt;br /&gt;
    :teammate_review_questionnaire,&lt;br /&gt;
    id: 12,&lt;br /&gt;
    questions: [question],&lt;br /&gt;
    max_question_score: 5&lt;br /&gt;
  )&lt;br /&gt;
}&lt;br /&gt;
let(:assignment_vt) {&lt;br /&gt;
  create(:assignment, id: 6, max_team_size: 2,&lt;br /&gt;
  questionnaires: [tm_questionnaire])&lt;br /&gt;
}&lt;br /&gt;
let(:assignment_questionnaire_vt) {&lt;br /&gt;
  create(:tm_assignment_questionnaire, id: 12, used_in_round: nil,&lt;br /&gt;
  assignment: assignment_vt, questionnaire: tm_questionnaire) }&lt;br /&gt;
let(:team_vt) { create(:assignment_team, id: 12,&lt;br /&gt;
assignment: assignment_vt) }&lt;br /&gt;
let(:participant_vt) { create(:participant, id: 12,&lt;br /&gt;
  assignment: assignment_vt, user_id: student1_vt.id) }&lt;br /&gt;
let(:participant2_vt) { create(:participant, id: 13,&lt;br /&gt;
  assignment: assignment_vt, user_id: student2_vt.id) }&lt;br /&gt;
&lt;br /&gt;
before(:each) do&lt;br /&gt;
  # Need to stub this method so the factory instance with&lt;br /&gt;
  # the stubbed :team method is returned by :find&lt;br /&gt;
  # instead of a separate instance with the same data&lt;br /&gt;
  allow(AssignmentParticipant)&lt;br /&gt;
    .to receive(:find)&lt;br /&gt;
    .with(participant_vt.id.to_s)&lt;br /&gt;
    .and_return(participant_vt)&lt;br /&gt;
  allow(participant_vt).to receive(:team).and_return(team_vt)&lt;br /&gt;
  allow(team_vt).to receive(:participants).and_return([participant_vt, participant2_vt])&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:find_by)&lt;br /&gt;
    .with(assignment_id: assignment_vt.id, questionnaire_id: tm_questionnaire.id)&lt;br /&gt;
    .and_return(assignment_questionnaire_vt)&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:find_by)&lt;br /&gt;
    .with(assignment_id: assignment.id, questionnaire_id: review_questionnaire.id)&lt;br /&gt;
    .and_return(assignment_questionnaire_vt)&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:where)&lt;br /&gt;
    .with(any_args)&lt;br /&gt;
    .and_return([assignment_questionnaire_vt])&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:late_policy_id)&lt;br /&gt;
    .and_return(false)&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:calculate_penalty)&lt;br /&gt;
    .and_return(false)&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:compute_total_score)&lt;br /&gt;
    .with(any_args)&lt;br /&gt;
    .and_return(100)&lt;br /&gt;
  allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
  allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
 it 'renders grades#view_team page' do&lt;br /&gt;
  params = {id: participant_vt.id}&lt;br /&gt;
  get :view_team, params&lt;br /&gt;
  expect(response).to render_template(:view_team)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is opened by student' do&lt;br /&gt;
  it 'dropdown is not rendered' do&lt;br /&gt;
    session = { user: student1_vt }&lt;br /&gt;
    params = {id: participant_vt.id}&lt;br /&gt;
    stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
    get :view_team, params&lt;br /&gt;
    expect(response.body).to_not have_selector('select')&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is opened by instructor' do&lt;br /&gt;
  it 'dropdown is rendered' do&lt;br /&gt;
    session = { user: instructor }&lt;br /&gt;
    params = {id: participant_vt.id}&lt;br /&gt;
    get :view_team, params&lt;br /&gt;
    expect(response.body).to have_selector('select')&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
  it 'renders grades#view_team page' do&lt;br /&gt;
    params = { id: participant_vt.id }&lt;br /&gt;
    allow(TaMapping).to receive(:exists?).with(ta_id: participant_vt.user_id, course_id: 1).and_return(true)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====H. In spec/factories/factories.rb:====&lt;br /&gt;
&lt;br /&gt;
'''H.1 '''Add the following factory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
factory :teammate_review_questionnaire, class: TeammateReviewQuestionnaire do&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''H.2 '''Add another factory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
factory :tm_assignment_questionnaire, class: AssignmentQuestionnaire do&lt;br /&gt;
  user_id 1&lt;br /&gt;
  questionnaire { association(:teammate_review_questionnaire) }&lt;br /&gt;
  questionnaire_weight 100&lt;br /&gt;
  used_in_round nil&lt;br /&gt;
  topic_id nil&lt;br /&gt;
  dropdown 1&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
The tests written as a part of this project can be run by running the following command on terminal:&lt;br /&gt;
&lt;br /&gt;
1. rspec ./spec/controllers/grades_controller_spec.rb  -e &amp;quot;#view_team&amp;quot;&lt;br /&gt;
&lt;br /&gt;
2. rspec .vm_question_response_score_cell_spec.rb  -e &amp;quot;#reviewer_id&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''OLD STATUS'''&lt;br /&gt;
&lt;br /&gt;
1. Earlier, the tests contained an xdescribe test to check if the view_team page is rendered correctly. However, this test was being skipped as this was an xdescribe segment. There was another test for when the view_team page is accessed by a student who is also a TA for another course. This can be checked [https://github.com/expertiza/expertiza/blob/beta/spec/controllers/grades_controller_spec.rb here].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 xdescribe '#view_team' do&lt;br /&gt;
    it 'renders grades#view_team page' do&lt;br /&gt;
      allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
      params = {id: 1}&lt;br /&gt;
      get :view_team, params&lt;br /&gt;
      expect(response).to render_template(:view_team)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#view_team' do&lt;br /&gt;
    render_views&lt;br /&gt;
    context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
      it 'renders grades#view_team page' do&lt;br /&gt;
        allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
        allow(AssignmentQuestionnaire).to receive(:find_by).with(assignment_id: 1, questionnaire_id: 1).and_return(assignment_questionnaire)&lt;br /&gt;
        allow(AssignmentQuestionnaire).to receive(:where).with(any_args).and_return([assignment_questionnaire])&lt;br /&gt;
        allow(assignment).to receive(:late_policy_id).and_return(false)&lt;br /&gt;
        allow(assignment).to receive(:calculate_penalty).and_return(false)&lt;br /&gt;
        allow(assignment).to receive(:compute_total_score).with(any_args).and_return(100)&lt;br /&gt;
        allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
        allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
        params = {id: 1}&lt;br /&gt;
        allow(TaMapping).to receive(:exists?).with(ta_id: 1, course_id: 1).and_return(true)&lt;br /&gt;
        stub_current_user(ta, ta.role.name, ta.role)&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).not_to have_content &amp;quot;TA&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''NEW STATUS'''&lt;br /&gt;
&lt;br /&gt;
1. The view_team page is rendered correctly for a given student or an instructor. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    it 'renders grades#view_team page' do&lt;br /&gt;
      params = {id: participant_vt.id}&lt;br /&gt;
      get :view_team, params&lt;br /&gt;
      expect(response).to render_template(:view_team)&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. When students access then the view_team page, the dropdown to select a student's teammate reviews is not rendered on the page. The dropdown is rendered if the page is accessed by an instructor. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   context 'dropdown for selecting a teammate review' do&lt;br /&gt;
    render_views&lt;br /&gt;
      it 'is not rendered is not rendered when page is opened by student' do&lt;br /&gt;
        session = { user: student1_vt }&lt;br /&gt;
        params = {id: participant_vt.id}&lt;br /&gt;
        stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to_not have_selector('select')&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      it 'is rendered when page is opened by instructor' do&lt;br /&gt;
        session = { user: instructor }&lt;br /&gt;
        params = {id: participant_vt.id}&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to have_selector('select')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. When a student who is also a TA for another course access the view_team page, that student should be able to a student's view to the page. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
      it 'renders grades#view_team page' do&lt;br /&gt;
        params = { id: participant_vt.id }&lt;br /&gt;
        allow(TaMapping).to receive(:exists?).with(ta_id: participant_vt.user_id, course_id: 1).and_return(true)&lt;br /&gt;
        stub_current_user(ta, ta.role.name, ta.role)&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).not_to have_content &amp;quot;TA&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. If show_teammate_reviews boolean is set to False, then the student should not be able to see the teammate reviews given to him/her. An instructor can still see the teammate reviews. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when assignment(show reviews) value is unchecked' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        allow(assignment_vt).to receive(:show_teammate_reviews).and_return(false) &lt;br /&gt;
      end&lt;br /&gt;
      it 'Student cannot view his score' do&lt;br /&gt;
        session = { user: student1_vt }&lt;br /&gt;
        params = {id: participant_vt.id}&lt;br /&gt;
        stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to_not have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
        expect(response.body).to_not have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant2_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      it 'Instructor can view the student score' do        &lt;br /&gt;
        params = {id: participant_vt.id}        &lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
        expect(response.body).to have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant2_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. If show_teammate_reviews boolean is set to True, then both the student should and instructor should be able to see the teammate reviews. The student should see only the reviews received by him/her. The instructor should be able to see all student's teammate reviews. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    context 'when assignment(show reviews) value is checked' do&lt;br /&gt;
      it 'Student can view his score' do&lt;br /&gt;
        session = { user: student1_vt }&lt;br /&gt;
        params = {id: participant_vt.id}&lt;br /&gt;
        stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
        expect(response.body).to_not have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant2_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      it 'Instructor can view the student score' do        &lt;br /&gt;
        params = {id: participant_vt.id}        &lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
        expect(response.body).to have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant2_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. The reviewer id is tracked correctly to show the correct reviewer name in the teammate reviews table. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/models/vm_question_response_score_cell_spec.rb this] file &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  	describe '#reviewer_id' do&lt;br /&gt;
  		it 'returns reviewer id' do&lt;br /&gt;
			allow(ResponseMap).to receive(:find).with(1).and_return(review_response_map)&lt;br /&gt;
			allow(response).to receive(:populate_new_response).with(:review_response_map, &amp;quot;0&amp;quot;).and_return(response)&lt;br /&gt;
        	expect(response.id).to eq(1)	&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Summary of file changes ==&lt;br /&gt;
&lt;br /&gt;
The following files are modified:&lt;br /&gt;
&lt;br /&gt;
1. app/controllers/grades_controller.rb - Controller file which changed how the view model is populated&lt;br /&gt;
&lt;br /&gt;
2. app/views/grades/view_team.html.erb - View file, which  conditionally rendered the teammate name, for a teammate review heatgrid&lt;br /&gt;
&lt;br /&gt;
3. spec/controllers/grades_controller_spec.rb - For tests verifying the proposed changes&lt;br /&gt;
&lt;br /&gt;
4. app/models/vm_question_response.rb - To modify the view-model so it can tell us the name of the person being reviewed for the current heatgrid&lt;br /&gt;
&lt;br /&gt;
5. app/models/vm_question_response_score_cell.rb - &lt;br /&gt;
&lt;br /&gt;
6. app/assets/stylesheets/grades.scss - &lt;br /&gt;
&lt;br /&gt;
7. app/views/grades/_add_icon_to_name.html.erb - &lt;br /&gt;
&lt;br /&gt;
8. spec/factories/factories.rb -&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Design Patterns ==&lt;br /&gt;
&lt;br /&gt;
Existing code does not use any design patterns, apart from if-else. It uses if-else conditional statements to check what type of questionnaire is present in the viewmodel `VmQuestionResponse`, and based on that, it renders the appropriate content.&lt;br /&gt;
&lt;br /&gt;
We decided to continue with this approach since to change the present coding style, there were required many changes (refactoring) to many files which were out of the scope of the present project. To complete the project in the assigned time, we followed the if-else approach.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;https://expertiza.ncsu.edu/&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Agarg25</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141757</id>
		<title>CSC/ECE 517 Fall 2021 - E2165. Fix teammate-review view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141757"/>
		<updated>2021-11-28T19:21:15Z</updated>

		<summary type="html">&lt;p&gt;Agarg25: /* Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Introduction ==&lt;br /&gt;
&lt;br /&gt;
Dr. Edward Gehringer (instructor), Parimal Mehta (mentor)&lt;br /&gt;
&lt;br /&gt;
1. Anjali Garg (unity ID : agarg25)&lt;br /&gt;
&lt;br /&gt;
2. Arvasu Chikara (unity ID: achikar2)&lt;br /&gt;
&lt;br /&gt;
3. Lalit Bangad (unity ID: llbangad)&lt;br /&gt;
&lt;br /&gt;
4. Vinay Deshmukh (unity ID: vdeshmu)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Problems to be addressed ==&lt;br /&gt;
&lt;br /&gt;
After a project is submitted and reviewed, both the team members (students) and instructors should be able to view the teammate reviews. Students should be able to view the reviews by going to a particular assignment's -&amp;gt; your scores, at the bottom of the page. An instructor can view the teammate reviews by going to assignments -&amp;gt; assignment -&amp;gt; particular team's submission -&amp;gt; view submission -&amp;gt; assign grades -&amp;gt; view scores. &lt;br /&gt;
&lt;br /&gt;
In the case of the instructor, a single heat grid is shown whereas in the case of a team member, we cant view the scores. In the heat grid, it is not clear if the scores visible are for the reviews that the student has *written* for their teammates or the scores that the student has *received* from their teammates. Additionally, for instructors can choose from a list of the students on the team, but they have no way to tell whether the heat grid shows the reviews done *by* that student or done *for* that student.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Methodology Overview ==&lt;br /&gt;
&lt;br /&gt;
We have divided our work in the following tasks to address the above problems:&lt;br /&gt;
&lt;br /&gt;
1. Distinguish reviews done for a student by rendering separates heatgrids for each student&lt;br /&gt;
&lt;br /&gt;
2. For instructors, the table will have sections based on the students&lt;br /&gt;
&lt;br /&gt;
3. Include a checkbox on the edit assignment page that enables/disables visibility of heat grid to students&lt;br /&gt;
&lt;br /&gt;
4. Fix the average column for a table (which breaks for some reviews)&lt;br /&gt;
&lt;br /&gt;
5. Show a composite score derived from all reviews.  Make this code generalized, so other kinds of heat grid views could use it.&lt;br /&gt;
&lt;br /&gt;
6. Changes should work even in an anonymized view&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Motivations ==&lt;br /&gt;
&lt;br /&gt;
1. Enable users to clearly tell which reviews are done by them, and which reviews are done for them.&lt;br /&gt;
&lt;br /&gt;
2. Code should be generic so it can be used for different types of heat grids as well.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Control Flow to access the concerned screens ==&lt;br /&gt;
'''1. For instructor (Log in as an instructor):-'''&lt;br /&gt;
&lt;br /&gt;
Screen after logging in by the instructor&lt;br /&gt;
[[File:ss1.png |border|1000px|center]]&lt;br /&gt;
Got to assignments on the Manage menu &lt;br /&gt;
[[File:ss2.png |border|1000px|center]]&lt;br /&gt;
Go to assignments&lt;br /&gt;
[[File:ss3.png |border|1000px|center]]&lt;br /&gt;
Go to submissions for any assignment&lt;br /&gt;
[[File:ss4a.png |border|1000px|center]]&lt;br /&gt;
Go to Assign Grade&lt;br /&gt;
[[File:ss5a.png |border|1000px|center]]&lt;br /&gt;
You will land on the page where the changes are made and can be reviewed&lt;br /&gt;
[[File:ss7a.png |border|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
'''2. Student:- (Instructor impersonating a student)'''&lt;br /&gt;
&lt;br /&gt;
After landing on the assignments page, select any student from an assignment as shown below&lt;br /&gt;
[[File:ss6a.png |border|1000px|center]]&lt;br /&gt;
Go to/Select any assignment&lt;br /&gt;
[[File:ss9a.png |border|1000px|center]]&lt;br /&gt;
Go to your scores&lt;br /&gt;
[[File:ss10a.png |border|1000px|center]]&lt;br /&gt;
You will land on the page where the changes are made and can be reviewed&lt;br /&gt;
[[File:ss11a.png |border|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
== Old Status of the application ==&lt;br /&gt;
&lt;br /&gt;
'''1. Instructor's view of teammate review''': This is the current screen given to the instructor. Here we see that the instructor can not determine who has given which review to which student in a team.&lt;br /&gt;
&lt;br /&gt;
[[File:Instructor-view-1.png|border| 700px |center|alt=The proposed expanded student display.|The proposed expanded student display.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2. Student's view of teammate review''': Currently, a student is not able to see what grades were given by their teammates. We need to implement that functionality so that the student is able to view those grades.&lt;br /&gt;
&lt;br /&gt;
[[File:Student-view-2.png|border| 700px |center|alt=The current instructor view.|The current review display for instructors.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Error in existing UI for student''': In the existing UI for a student, the highlighted block should not be rendered. This part of the screen is meant for the instructors/TAs. &lt;br /&gt;
&lt;br /&gt;
[[File:Wrong render for student.png|border|700px|center|alt=Existing UI for student|Existing UI for student.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Proposed changes ==&lt;br /&gt;
&lt;br /&gt;
''' 1) Proposed UI for instructor ''': The instructor is able to see the score for all teammates. In the existing code, only one teammate's scores are being shown. But, we are planning to change the way the (VmQuestionResponse array is populated)[https://github.com/expertiza/expertiza/blob/master/app/controllers/grades_controller.rb#L114], so that the scores for all teammates are appended to it so it correctly shows what should have already been shown in this screen for the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Proposed_screen.png|border|700px|center|alt=Proposed UI for instructor|Proposed UI for instructor.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: When a student visits this screen, they will only be shown the reviews received by them, assuming the instructor has allowed visibility of teammate reviews to students.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' 2) Show detailed review for a particular question''': The instructor can see detailed review given to a student by their teammates by clicking on a particular question number in the table.&lt;br /&gt;
&lt;br /&gt;
[[File:ss12a.png|border|700px|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' 3) Show teammate review to student UI ''': The existing code doesn't render a student's teammate review scores at all. We are planning to render the scores to a student (as shown below) when they visit this screen. However, the visibility of this screen is contingent on whether the instructor has allowed visibility of the teammate review screen to students. If the instructor has disabled this feature, then the heatgrid will not be displayed at all.&lt;br /&gt;
&lt;br /&gt;
[[File:UI_for_student.png|border|700px|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== User Stories ==&lt;br /&gt;
&lt;br /&gt;
1. As an instructor, I can view what reviews one teammate has given to other teammates.&lt;br /&gt;
&lt;br /&gt;
2. As a student, I can view what reviews my teammates have given to me.&lt;br /&gt;
&lt;br /&gt;
3. As an instructor, I can choose if I want to see all student's teammates reviews together or one by one.&lt;br /&gt;
&lt;br /&gt;
4. As a student, if I am also a TA for another subject, I should not be able to see an instructor's view to the view_team page.&lt;br /&gt;
&lt;br /&gt;
5. As an instructor, I should be able to see the name of the reviewers for the reviews to a particular student.&lt;br /&gt;
&lt;br /&gt;
== Use case diagram for the system ==  &lt;br /&gt;
&lt;br /&gt;
[[File:vie_team_use_case.png|border|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Models used / Explanation of fixes ==&lt;br /&gt;
&lt;br /&gt;
The below diagram illustrates the proposed code change for showing all team members with the teammate review data to an instructor. The existing code only iterated on the `Participant` whose ID is present in the URL of the page. To fix this, we will iterate over all teammates of the given participant so that all teammate reviews for all team members are shown to the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Logic e2165.png|border|center|alt=Flow diagram of proposed changes for showing team review data to instructor]]&lt;br /&gt;
&lt;br /&gt;
===Changes made to the code are shown below. Every change is shown and explained separately===&lt;br /&gt;
&lt;br /&gt;
====A. Added the following to app/assets/stylesheets/grades.scss:====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    .teammate_table.hidden {&lt;br /&gt;
      display: none;&lt;br /&gt;
      }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====B. In app/controllers/grades_controller.rb: ====&lt;br /&gt;
&lt;br /&gt;
'''B.1:'''&lt;br /&gt;
&lt;br /&gt;
Old code: The existing code does not differentiate when adding a view model for the TeammateReview questionnaire&lt;br /&gt;
  questionnaires.each do |questionnaire|&lt;br /&gt;
     ...&lt;br /&gt;
     @vmlist &amp;lt;&amp;lt; populate_view_model(questionnaire)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
New code: Since the current page URL contains an ID for the participant, from which we get an assignment, which gives us a list of questionnaires, we need to iterate all participants for a `TeammateReveiwQuestionnaire` questionnaire, so that we get the heatgrid view models for all members of a team.&lt;br /&gt;
  questionnaires.each do |questionnaire|&lt;br /&gt;
     ...&lt;br /&gt;
     if questionnaire.type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
        # as teammate review will be different for each participant&lt;br /&gt;
        # we need to create a separate table for each teammate&lt;br /&gt;
        @participant.team.participants.each do |team_participant|&lt;br /&gt;
          @vmlist &amp;lt;&amp;lt; populate_view_model(team_participant, questionnaire, @team)&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        # only one participant needs iterating, as apart from teammatereview&lt;br /&gt;
        # all other reviews are at &amp;quot;team&amp;quot; level&lt;br /&gt;
        @vmlist &amp;lt;&amp;lt; populate_view_model(@participant, questionnaire, @team)&lt;br /&gt;
      end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
'''B.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code: This code uses @participant as an instance variable, but this structure will not work as we need to call this ViewModel with multiple participants when iterating for a teammate review questionnaire.&lt;br /&gt;
    def populate_view_model(questionnaire)&lt;br /&gt;
      vm = VmQuestionResponse.new(questionnaire, @assignment, @round)&lt;br /&gt;
      vmquestions = questionnaire.questions&lt;br /&gt;
      vm.add_questions(vmquestions)&lt;br /&gt;
      vm.add_team_members(@team)&lt;br /&gt;
      vm.add_reviews(@participant, @team, @assignment.vary_by_round)&lt;br /&gt;
      vm.number_of_comments_greater_than_10_words&lt;br /&gt;
      vm &lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
New code: We need to call this function with a separate participant in each invocation due to our change for TeammateReviewQuestionnaire, hence it makes sense to make `participant` as an argument to this function. Similarly, as `team` is a closely related model to `participant`, we are passing it as an argument, to keep this function as &amp;quot;pure&amp;quot; as possible.&lt;br /&gt;
    def populate_view_model(participant, questionnaire, team)&lt;br /&gt;
      ...&lt;br /&gt;
      vm.add_team_members(team)&lt;br /&gt;
      vm.add_reviews(participant, team, @assignment.vary_by_round)&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
====C. In app/models/vm_question_response.rb:====&lt;br /&gt;
&lt;br /&gt;
'''C.1: '''Added the reviewee_id method: Created a helper method within the VmQuestionReponse model to retrieve the `reviewee_id` for a heatgrid&lt;br /&gt;
&lt;br /&gt;
    def reviewee_id&lt;br /&gt;
      @participant_who_is_reviewee.user_id&lt;br /&gt;
    end &lt;br /&gt;
&lt;br /&gt;
'''C.2: '''Added the reviewee_name method: Created a helper method within the VmQuestionReponse model to retrieve the name of the student who is being reviewed for a heatgrid. This method uses the functionality to anonymize the name when we are in anonymized view.&lt;br /&gt;
&lt;br /&gt;
    def reviewee_name(ip_address = nil)&lt;br /&gt;
      part = @participant_who_is_reviewee&lt;br /&gt;
      User.find_by(id: part.user_id).fullname(ip_address)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''C.3: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Does not keep track of the student being reviewed&lt;br /&gt;
    elsif @questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
      reviews = participant.teammate_reviews&lt;br /&gt;
      reviews.each do |review|&lt;br /&gt;
        review_mapping = TeammateReviewResponseMap.find_by(id: review.map_id)&lt;br /&gt;
        participant = Participant.find(review_mapping.reviewer_id)&lt;br /&gt;
&lt;br /&gt;
New code: Add an instance variable to keep track of the student who is being reviewed in this VmQuestionReponse&lt;br /&gt;
    elsif @questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
      reviews = participant.teammate_reviews&lt;br /&gt;
      @participant_who_is_reviewee = participant&lt;br /&gt;
      reviews.each do |review|&lt;br /&gt;
        review_mapping = TeammateReviewResponseMap.find_by(id: review.map_id)&lt;br /&gt;
        participant = Participant.find(review_mapping.reviewer_id)&lt;br /&gt;
&lt;br /&gt;
'''C.4: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing VmQuestionReponseScoreCell keeps no information about the reviewer, as it only stores the answer score&lt;br /&gt;
    row.score_row.push(VmQuestionResponseScoreCell.new(answer.answer, color_code, answer.comments, vm_tag_prompts))&lt;br /&gt;
&lt;br /&gt;
New code: Keep track of the response ID, so that we can retrieve the user ID for the reviewer in the model to use in the view file.&lt;br /&gt;
    &lt;br /&gt;
    row.score_row.push(VmQuestionResponseScoreCell.new(answer.answer, color_code, answer.comments, vm_tag_prompts, answer.response_id))&lt;br /&gt;
&lt;br /&gt;
====D. In app/models/vm_question_response_score_cell.rb:====&lt;br /&gt;
&lt;br /&gt;
'''D.1: '''In the method initialize of class VmQuestionResponseScoreCell&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't keep track of the response id&lt;br /&gt;
    def initialize(score_value, color_code, comments, vmprompts = nil)&lt;br /&gt;
      @score_value = score_value&lt;br /&gt;
      @color_code = color_code&lt;br /&gt;
      @comment = comments&lt;br /&gt;
      @vm_prompts = vmprompts&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
New code: We added an instance variable to keep track of response_id&lt;br /&gt;
&lt;br /&gt;
    def initialize(score_value, color_code, comments, vmprompts = nil, response_id)&lt;br /&gt;
      ...&lt;br /&gt;
      @response_id = response_id&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''D.2: '''Added a method reviewer_id to the class VmQuestionResponseScoreCell: This helper method retrieves the ID for the reviewer who created this response.&lt;br /&gt;
&lt;br /&gt;
    def reviewer_id&lt;br /&gt;
      resp = Response.find(@response_id)&lt;br /&gt;
      map = ResponseMap.find(resp.map_id)&lt;br /&gt;
      map.reviewer_id&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
====E. In app/views/grades/_add_icon_to_name.html.erb:====&lt;br /&gt;
&lt;br /&gt;
'''E.1 '''Added the following code to the file: Write the code to generate the review text only once to reduce WET code&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;%# Determine the content of the reviewed by text %&amp;gt;&lt;br /&gt;
    &amp;lt;% review_text = &amp;quot;&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% if @current_role_name.eql?'Student' or questionnaire_type != &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
      &amp;lt;%# Use Review {{index}} format for student view, and when questionnaire_type is not teammatereview %&amp;gt;&lt;br /&gt;
      &amp;lt;% review_text = &amp;quot;Review #{i + 1}&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;% resp = Response.find(review.id) %&amp;gt;&lt;br /&gt;
      &amp;lt;% map = ResponseMap.find(resp.map_id) %&amp;gt;&lt;br /&gt;
      &amp;lt;% reviewer_id = map.reviewer_id %&amp;gt;&lt;br /&gt;
      &amp;lt;% fullname = Participant.find_by(id: reviewer_id).fullname(session[:ip]) %&amp;gt;&lt;br /&gt;
      &amp;lt;% review_text = &amp;quot;Review by #{fullname}&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% end%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''E.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code is very unreadable as it's not indented, and written in a single line with 359 characters, which breaks the ruby style guide rules&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;% if review.done_by_staff_participant? %&amp;gt;&lt;br /&gt;
      &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt; &amp;lt;img data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Icon indicates this review was done by course staff&amp;quot; class=&amp;quot;img_icon&amp;quot; src=&amp;quot;/assets/staff.png&amp;quot;&amp;gt; &amp;lt;a target=&amp;quot;_blank&amp;quot; href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Click to see details&amp;quot;&amp;gt;&amp;lt;%= &amp;quot;Review &amp;quot; + i.to_s  %&amp;gt;&amp;lt;/a&amp;gt; &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt; &amp;lt;a target=&amp;quot;_blank&amp;quot; href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Click to see details&amp;quot;&amp;gt;&amp;lt;%= &amp;quot;Review &amp;quot; + i.to_s %&amp;gt;&amp;lt;/a&amp;gt;  &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Correctly indented and removes WET repetition of code blocks and makes the resulting code DRYer&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;% if review.done_by_staff_participant? %&amp;gt;&lt;br /&gt;
      &amp;lt;img&lt;br /&gt;
      data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
      data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
      title=&amp;quot;Icon indicates this review was done by course staff&amp;quot; class=&amp;quot;img_icon&amp;quot;&lt;br /&gt;
      src=&amp;quot;/assets/staff.png&amp;quot;&lt;br /&gt;
      &amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;a&lt;br /&gt;
      target=&amp;quot;_blank&amp;quot;&lt;br /&gt;
      href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;&lt;br /&gt;
      data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
      data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
      title=&amp;quot;Click to see details&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;%= review_text %&amp;gt;&lt;br /&gt;
    &amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====F.In app/views/grades/view_team.html.erb:====&lt;br /&gt;
&lt;br /&gt;
'''F.1: '''Added function teammateSelectOnChange: This function toggles the visibility for the teammate heatgrids when the instructor changes the dropdown&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  function teammateSelectOnChange(selectNode) {&lt;br /&gt;
      const revieweeIdToShow= selectNode.value;&lt;br /&gt;
      const tableSelector = &amp;quot;.teammate_table&amp;quot;;&lt;br /&gt;
      if(revieweeIdToShow == &amp;quot;all&amp;quot;) {&lt;br /&gt;
        document.querySelectorAll(tableSelector).forEach((tableNode) =&amp;gt; {&lt;br /&gt;
          tableNode.classList.remove(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
        });&lt;br /&gt;
        return;&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
    document.querySelectorAll(tableSelector).forEach((tableNode) =&amp;gt; {&lt;br /&gt;
      const tableRevieweeId = tableNode.getAttribute('data-reviewee_id');&lt;br /&gt;
      if(tableRevieweeId == revieweeIdToShow) {&lt;br /&gt;
        tableNode.classList.remove(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
      } else {&lt;br /&gt;
        tableNode.classList.add(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
      }&lt;br /&gt;
      });&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't render TeammateReviewQuestionnaire&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;% @vmlist.each do |vm| %&amp;gt;&lt;br /&gt;
        &amp;lt;% if (vm.questionnaire_display_type == &amp;quot;Metareview&amp;quot; or vm.questionnaire_display_type == &amp;quot;Author Feedback&amp;quot; or vm.questionnaire_display_type == &amp;quot;Teammate Review&amp;quot;) and @current_role_name.eql?'Student' %&amp;gt;&lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
        &amp;lt;% if vm.list_of_reviewers.length &amp;gt; 0 %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Use a boolean to render a dropdown (that contains the students' IDs and names) just before the first TeammateReviewQuestionnaire, and unset that boolean so we only render 1 table. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;%# This boolean is used to render a dropdown just before the first teammate review heat grid %&amp;gt;&lt;br /&gt;
&amp;lt;% first_teammate_review_appeared = false %&amp;gt;&lt;br /&gt;
&amp;lt;% @vmlist.each do |vm| %&amp;gt;&lt;br /&gt;
     &amp;lt;% if (not @current_role_name.eql?'Student' and&lt;br /&gt;
        not first_teammate_review_appeared and&lt;br /&gt;
        vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; &lt;br /&gt;
      ) %&amp;gt;&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        &amp;lt;select onchange=&amp;quot;teammateSelectOnChange(this)&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;all&amp;quot;&amp;gt;All&amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;% @vmlist.select { |tm_vm| tm_vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; }.each do |tm_vm| %&amp;gt;&lt;br /&gt;
            &amp;lt;option value=&amp;quot;&amp;lt;%= tm_vm.reviewee_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;%= tm_vm.reviewee_name(session[:ip]) %&amp;gt;&lt;br /&gt;
            &amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
        &amp;lt;/select&amp;gt;&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;% first_teammate_review_appeared = true %&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Add conditions which check for the truthiness of ```@assignment.show_teammate_reviews``` and if the current user is a student to decide whether to render the table or not.  Since the existing code checks truthiness for the cases for which NOT to render a table, we have followed the existing style of the code.&lt;br /&gt;
&lt;br /&gt;
1) If type of view model is teammate review questionnaire, and current role is student, and if @assignment.show_teammate_reviews is false, then we don't render anything&lt;br /&gt;
2) If type of view model is teammate review questionnaire, and current role is student, but @assignment.show_teammate_reviews is true, then we don't render anything if the current reviewer_id is different to the currently logged in user.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;% if (vm.questionnaire_display_type == &amp;quot;Metareview&amp;quot; or vm.questionnaire_display_type == &amp;quot;Author Feedback&amp;quot;) and @current_role_name.eql?'Student' %&amp;gt;&lt;br /&gt;
    &amp;lt;% elsif (&lt;br /&gt;
      vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; and&lt;br /&gt;
      @current_role_name.eql?'Student' and&lt;br /&gt;
      !@assignment.show_teammate_reviews&lt;br /&gt;
      ) %&amp;gt;&lt;br /&gt;
    &amp;lt;% elsif (&lt;br /&gt;
      vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; and &lt;br /&gt;
      @current_role_name.eql?'Student' and&lt;br /&gt;
      @assignment.show_teammate_reviews and current_user.id != vm.reviewee_id&lt;br /&gt;
      )%&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Finally, add a CSS class and a `data-reviewee_id` to keep track of the heatgrids when toggling visibility.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
        &amp;lt;% if vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
          &amp;lt;div class=&amp;quot;teammate_table&amp;quot; data-reviewee_id=&amp;quot;&amp;lt;%= vm.reviewee_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
        &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.3  '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't print the teammate who is being reviewed.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
          &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
            &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: If TeammteReviewQuestionnaire is used, then use the `:reviewee_name` method for VmQuestionResponse model to print the name of the student who is being reviewed.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
          &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
            &amp;lt;% elsif vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (For: &amp;lt;%= vm.reviewee_name(session[:ip]) %&amp;gt;)&lt;br /&gt;
            &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.4 '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't inform the partial about the type of review being done&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_reviews.each do |review| %&amp;gt;&lt;br /&gt;
              &amp;lt;!-- instructors (or higher level users) see reviewer name, students see anonymized string --&amp;gt;&lt;br /&gt;
              &amp;lt;% if (['Student'].include? @current_role_name) &amp;amp;&amp;amp; @assignment.is_anonymous%&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i} %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                  &amp;lt;% user_name = User.find(Participant.find(ResponseMap.find(Response.find(review.id).map_id).reviewer_id).user_id).fullname(session[:ip]).to_s %&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i} %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% i += 1 %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
New code: Passes the type of review being done to the partial, so it can decide on how to render the review title. Note: This code seems to use repetition, but since the conditional used here are accessing `Anonymous` assignments and checking for user roles, we have not modified this code, as it is not directly related to our scope.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_reviews.each do |review| %&amp;gt;&lt;br /&gt;
              &amp;lt;!-- instructors (or higher level users) see reviewer name, students see anonymized string --&amp;gt;&lt;br /&gt;
              &amp;lt;% if (['Student'].include? @current_role_name) &amp;amp;&amp;amp; @assignment.is_anonymous%&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i, questionnaire_type: vm.questionnaire_type } %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                &amp;lt;% user_name = User.find(Participant.find(ResponseMap.find(Response.find(review.id).map_id).reviewer_id).user_id).fullname(session[:ip]).to_s %&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i, questionnaire_type: vm.questionnaire_type } %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% i += 1 %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Old code: Contains a `metrics-1` column&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-true&amp;quot; align=&amp;quot;right&amp;quot; &amp;gt;&lt;br /&gt;
            Avg&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;span  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;A count of comments, for the respective question, which have word count &amp;gt; 10. The purpose of this metric is to represent how many comments for the question are of a substantial length to provide quality feedback.&amp;quot;&amp;gt;metric-1&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/thead&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
New code: As per discussion with mentor, this column has been removed in our PR.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-true&amp;quot; align=&amp;quot;right&amp;quot; &amp;gt;&lt;br /&gt;
            Avg&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/thead&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.5 '''&lt;br /&gt;
&lt;br /&gt;
Old code: It creates the ID inline in multiple places, so if we decide to change the ID generation logic, we need to modify it in multiple places. (which happened when we started rendering multiple tables for each teammate).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_rows.each do |row| %&amp;gt;&lt;br /&gt;
            &amp;lt;!-- notice the data-target. because we're toggling via looped code, we need to dynamically generate the identifier. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr data-toggle=&amp;quot;collapse&amp;quot; class=&amp;quot;accordion-toggle&amp;quot; data-target=&amp;quot;#hid&amp;lt;%= row.question_id.to_s + vm.round.to_s %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Generate the unique HTML ID once, in a readable manner once. And conditionally make it more unique, if it is a TeammateReviewQuestionnaire, since jQuery code requires these IDs to be unique amongst different tables. If we don't make it more unique, then clicking on one teammate review table will toggle the table visibility for the first table. To prevent this &amp;quot;clashing&amp;quot;, we need to make these IDs more unique for a TeammateReviewQuestionnaire.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_rows.each do |row| %&amp;gt;&lt;br /&gt;
            &amp;lt;% target_id = &amp;quot;hid__#{row.question_id}__#{vm.round}&amp;quot; %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
              &amp;lt;%# Since we render different heatgrids with the same questions for each&lt;br /&gt;
              teammember, we need to distinguish the ID, based on the user for whom,&lt;br /&gt;
              the reviews have been created. %&amp;gt;&lt;br /&gt;
              &amp;lt;% target_id += &amp;quot;__#{vm.reviewee_id}&amp;quot; %&amp;gt;&lt;br /&gt;
            &amp;lt;% end%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;!-- notice the data-target. because we're toggling via looped code, we need to dynamically generate the identifier. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr data-toggle=&amp;quot;collapse&amp;quot; class=&amp;quot;accordion-toggle&amp;quot; data-target=&amp;quot;&amp;lt;%= &amp;quot;#&amp;quot; + target_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Old code: Written on a single line crossing 80 characters on a single line&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
              &amp;lt;% row.score_row.each do |score| %&amp;gt;&lt;br /&gt;
                  &amp;lt;% score_comment = score.comment.nil? ? '' : score.comment %&amp;gt; &amp;lt;!-- changing nil to null string to avoid Null Pointer Exception --&amp;gt;&lt;br /&gt;
                  &amp;lt;td class=&amp;quot;&amp;lt;%= score.color_code %&amp;gt;&amp;quot; align=&amp;quot;center&amp;quot; data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= strip_tags(score.comment).html_safe%&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;&amp;lt;%=  underlined?(score) %&amp;gt;&amp;quot;&amp;gt;&amp;lt;%= score.score_value.to_s %&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
                  &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
New code: Make code more readable by indenting it and splitting it over multiple lines&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
              &amp;lt;!-- actual cells with scores and colored background. --&amp;gt;&lt;br /&gt;
              &amp;lt;% row.score_row.each do |score| %&amp;gt;&lt;br /&gt;
                  &amp;lt;% score_comment = score.comment.nil? ? '' : score.comment %&amp;gt;&lt;br /&gt;
                  &amp;lt;!-- changing nil to null string to avoid Null Pointer Exception --&amp;gt;&lt;br /&gt;
                  &amp;lt;td class=&amp;quot;&amp;lt;%= score.color_code %&amp;gt;&amp;quot; align=&amp;quot;center&amp;quot; data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= strip_tags(score.comment).html_safe%&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;&amp;lt;%=  underlined?(score) %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                      &amp;lt;%= score.score_value.to_s %&amp;gt;&lt;br /&gt;
                    &amp;lt;/span&amp;gt;&lt;br /&gt;
                  &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.6 '''Removed the following code as it corresponds to the deleted column&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 &amp;lt;td  class = 'cf' align=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;%= row.countofcomments.to_s %&amp;gt;&lt;br /&gt;
              &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.7 '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code just unconditionally prints the text &amp;quot;Review&amp;quot; followed by an index.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                    &amp;lt;% for index in 0 .. row.score_row.length - 1 %&amp;gt;&lt;br /&gt;
                        &amp;lt;tr&amp;gt;&lt;br /&gt;
                          &amp;lt;td&amp;gt;Review &amp;lt;%=index + 1%&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Conditionally change the review text that is displayed based on the type of review and the access level of the user&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                    &amp;lt;% for index in 0 .. row.score_row.length - 1 %&amp;gt;&lt;br /&gt;
                        &amp;lt;tr&amp;gt;&lt;br /&gt;
                          &amp;lt;% if @current_role_name.eql?'Student' or vm.questionnaire_type != &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                            &amp;lt;%# Use Review {{index}} format for student view, and&lt;br /&gt;
                            when questionnaire_type is not teammatereview %&amp;gt;&lt;br /&gt;
                            &amp;lt;td&amp;gt;Review &amp;lt;%=index + 1%&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
                          &amp;lt;% else %&amp;gt;&lt;br /&gt;
                            &amp;lt;td&amp;gt;&lt;br /&gt;
                              &amp;lt;% reviewer_id = row.score_row[index].reviewer_id %&amp;gt;&lt;br /&gt;
                              &amp;lt;% fullname = Participant.find_by(id: reviewer_id).fullname(session[:ip]) %&amp;gt;&lt;br /&gt;
                              Review by &amp;lt;%= fullname %&amp;gt;&lt;br /&gt;
                            &amp;lt;/td&amp;gt;&lt;br /&gt;
                          &amp;lt;% end%&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====G. In spec/controllers/grades_controller_spec.rb:====&lt;br /&gt;
&lt;br /&gt;
'''G.1 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
before(:each) do&lt;br /&gt;
  allow(AssignmentParticipant).to receive(:find).with('1').and_return(participant)&lt;br /&gt;
  allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
  stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
@@ -91,29 +90,106 @@&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
before(:each) do&lt;br /&gt;
  allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
  stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
@@ -91,29 +90,106 @@&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''G.2 '''Remove xdescribe '#view_team' and change describe '#view_team' as follows.&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#view_team' do&lt;br /&gt;
render_views&lt;br /&gt;
context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
  it 'renders grades#view_team page' do&lt;br /&gt;
    allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
    allow(AssignmentQuestionnaire).to receive(:find_by).with(assignment_id: 1, questionnaire_id: 1).and_return(assignment_questionnaire)&lt;br /&gt;
    allow(AssignmentQuestionnaire).to receive(:where).with(any_args).and_return([assignment_questionnaire])&lt;br /&gt;
    allow(assignment).to receive(:late_policy_id).and_return(false)&lt;br /&gt;
    allow(assignment).to receive(:calculate_penalty).and_return(false)&lt;br /&gt;
    allow(assignment).to receive(:compute_total_score).with(any_args).and_return(100)&lt;br /&gt;
    allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
    allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
    params = {id: 1}&lt;br /&gt;
    allow(TaMapping).to receive(:exists?).with(ta_id: 1, course_id: 1).and_return(true)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#view_team' do&lt;br /&gt;
render_views&lt;br /&gt;
&lt;br /&gt;
# All stubs and factories are instantiated within this scope so as to not &lt;br /&gt;
# clash with other broken test.&lt;br /&gt;
# The names of the factories created for testing view_team&lt;br /&gt;
# have `_vt` suffix ```where necessary``` to differentiate them from &lt;br /&gt;
# the above declared factories&lt;br /&gt;
&lt;br /&gt;
let(:student1_vt) { create(:student, name: &amp;quot;barry&amp;quot;, id: 12) }&lt;br /&gt;
let(:student2_vt) { create(:student, name: &amp;quot;iris&amp;quot;, id: 13) }&lt;br /&gt;
&lt;br /&gt;
let(:tm_questionnaire) {&lt;br /&gt;
  build(&lt;br /&gt;
    :teammate_review_questionnaire,&lt;br /&gt;
    id: 12,&lt;br /&gt;
    questions: [question],&lt;br /&gt;
    max_question_score: 5&lt;br /&gt;
  )&lt;br /&gt;
}&lt;br /&gt;
let(:assignment_vt) {&lt;br /&gt;
  create(:assignment, id: 6, max_team_size: 2,&lt;br /&gt;
  questionnaires: [tm_questionnaire])&lt;br /&gt;
}&lt;br /&gt;
let(:assignment_questionnaire_vt) {&lt;br /&gt;
  create(:tm_assignment_questionnaire, id: 12, used_in_round: nil,&lt;br /&gt;
  assignment: assignment_vt, questionnaire: tm_questionnaire) }&lt;br /&gt;
let(:team_vt) { create(:assignment_team, id: 12,&lt;br /&gt;
assignment: assignment_vt) }&lt;br /&gt;
let(:participant_vt) { create(:participant, id: 12,&lt;br /&gt;
  assignment: assignment_vt, user_id: student1_vt.id) }&lt;br /&gt;
let(:participant2_vt) { create(:participant, id: 13,&lt;br /&gt;
  assignment: assignment_vt, user_id: student2_vt.id) }&lt;br /&gt;
&lt;br /&gt;
before(:each) do&lt;br /&gt;
  # Need to stub this method so the factory instance with&lt;br /&gt;
  # the stubbed :team method is returned by :find&lt;br /&gt;
  # instead of a separate instance with the same data&lt;br /&gt;
  allow(AssignmentParticipant)&lt;br /&gt;
    .to receive(:find)&lt;br /&gt;
    .with(participant_vt.id.to_s)&lt;br /&gt;
    .and_return(participant_vt)&lt;br /&gt;
  allow(participant_vt).to receive(:team).and_return(team_vt)&lt;br /&gt;
  allow(team_vt).to receive(:participants).and_return([participant_vt, participant2_vt])&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:find_by)&lt;br /&gt;
    .with(assignment_id: assignment_vt.id, questionnaire_id: tm_questionnaire.id)&lt;br /&gt;
    .and_return(assignment_questionnaire_vt)&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:find_by)&lt;br /&gt;
    .with(assignment_id: assignment.id, questionnaire_id: review_questionnaire.id)&lt;br /&gt;
    .and_return(assignment_questionnaire_vt)&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:where)&lt;br /&gt;
    .with(any_args)&lt;br /&gt;
    .and_return([assignment_questionnaire_vt])&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:late_policy_id)&lt;br /&gt;
    .and_return(false)&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:calculate_penalty)&lt;br /&gt;
    .and_return(false)&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:compute_total_score)&lt;br /&gt;
    .with(any_args)&lt;br /&gt;
    .and_return(100)&lt;br /&gt;
  allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
  allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
 it 'renders grades#view_team page' do&lt;br /&gt;
  params = {id: participant_vt.id}&lt;br /&gt;
  get :view_team, params&lt;br /&gt;
  expect(response).to render_template(:view_team)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is opened by student' do&lt;br /&gt;
  it 'dropdown is not rendered' do&lt;br /&gt;
    session = { user: student1_vt }&lt;br /&gt;
    params = {id: participant_vt.id}&lt;br /&gt;
    stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
    get :view_team, params&lt;br /&gt;
    expect(response.body).to_not have_selector('select')&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is opened by instructor' do&lt;br /&gt;
  it 'dropdown is rendered' do&lt;br /&gt;
    session = { user: instructor }&lt;br /&gt;
    params = {id: participant_vt.id}&lt;br /&gt;
    get :view_team, params&lt;br /&gt;
    expect(response.body).to have_selector('select')&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
  it 'renders grades#view_team page' do&lt;br /&gt;
    params = { id: participant_vt.id }&lt;br /&gt;
    allow(TaMapping).to receive(:exists?).with(ta_id: participant_vt.user_id, course_id: 1).and_return(true)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====H. In spec/factories/factories.rb:====&lt;br /&gt;
&lt;br /&gt;
'''H.1 '''Add the following factory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
factory :teammate_review_questionnaire, class: TeammateReviewQuestionnaire do&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''H.2 '''Add another factory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
factory :tm_assignment_questionnaire, class: AssignmentQuestionnaire do&lt;br /&gt;
  user_id 1&lt;br /&gt;
  questionnaire { association(:teammate_review_questionnaire) }&lt;br /&gt;
  questionnaire_weight 100&lt;br /&gt;
  used_in_round nil&lt;br /&gt;
  topic_id nil&lt;br /&gt;
  dropdown 1&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
The tests written as a part of this project can be run by running the following command on terminal:&lt;br /&gt;
&lt;br /&gt;
1. rspec ./spec/controllers/grades_controller_spec.rb  -e &amp;quot;#view_team&amp;quot;&lt;br /&gt;
&lt;br /&gt;
2. rspec .vm_question_response_score_cell_spec.rb  -e &amp;quot;#reviewer_id&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''OLD STATUS'''&lt;br /&gt;
&lt;br /&gt;
1. Earlier, the tests contained an xdescribe test to check if the view_team page is rendered correctly. However, this test was being skipped as this was an xdescribe segment. There was another test for when the view_team page is accessed by a student who is also a TA for another course. This can be checked [https://github.com/expertiza/expertiza/blob/beta/spec/controllers/grades_controller_spec.rb here].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 xdescribe '#view_team' do&lt;br /&gt;
    it 'renders grades#view_team page' do&lt;br /&gt;
      allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
      params = {id: 1}&lt;br /&gt;
      get :view_team, params&lt;br /&gt;
      expect(response).to render_template(:view_team)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#view_team' do&lt;br /&gt;
    render_views&lt;br /&gt;
    context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
      it 'renders grades#view_team page' do&lt;br /&gt;
        allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
        allow(AssignmentQuestionnaire).to receive(:find_by).with(assignment_id: 1, questionnaire_id: 1).and_return(assignment_questionnaire)&lt;br /&gt;
        allow(AssignmentQuestionnaire).to receive(:where).with(any_args).and_return([assignment_questionnaire])&lt;br /&gt;
        allow(assignment).to receive(:late_policy_id).and_return(false)&lt;br /&gt;
        allow(assignment).to receive(:calculate_penalty).and_return(false)&lt;br /&gt;
        allow(assignment).to receive(:compute_total_score).with(any_args).and_return(100)&lt;br /&gt;
        allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
        allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
        params = {id: 1}&lt;br /&gt;
        allow(TaMapping).to receive(:exists?).with(ta_id: 1, course_id: 1).and_return(true)&lt;br /&gt;
        stub_current_user(ta, ta.role.name, ta.role)&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).not_to have_content &amp;quot;TA&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''NEW STATUS'''&lt;br /&gt;
&lt;br /&gt;
1. The view_team page is rendered correctly for a given student or an instructor. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    it 'renders grades#view_team page' do&lt;br /&gt;
      params = {id: participant_vt.id}&lt;br /&gt;
      get :view_team, params&lt;br /&gt;
      expect(response).to render_template(:view_team)&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. When students access then the view_team page, the dropdown to select a student's teammate reviews is not rendered on the page. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when view_team page is opened by student' do&lt;br /&gt;
      it 'dropdown is not rendered' do&lt;br /&gt;
        session = { user: student1_vt }&lt;br /&gt;
        params = {id: participant_vt.id}&lt;br /&gt;
        stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to_not have_selector('select')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. When an instructor access then the view_team page, the dropdown to select a student's teammate reviews is rendered on the page. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when view_team page is opened by instructor' do&lt;br /&gt;
      it 'dropdown is rendered' do&lt;br /&gt;
        session = { user: instructor }&lt;br /&gt;
        params = {id: participant_vt.id}&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to have_selector('select')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. When a student who is also a TA for another course access the view_team page, that student should be able to a student's view to the page. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
      it 'renders grades#view_team page' do&lt;br /&gt;
        params = { id: participant_vt.id }&lt;br /&gt;
        allow(TaMapping).to receive(:exists?).with(ta_id: participant_vt.user_id, course_id: 1).and_return(true)&lt;br /&gt;
        stub_current_user(ta, ta.role.name, ta.role)&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).not_to have_content &amp;quot;TA&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. If show_teammate_reviews boolean is set to False, then the student should not be able to see the teammate reviews given to him/her. An instructor can still see the teammate reviews. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when assignment(show reviews) value is unchecked' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        allow(assignment_vt).to receive(:show_teammate_reviews).and_return(false) &lt;br /&gt;
      end&lt;br /&gt;
      it 'Student cannot view his score' do&lt;br /&gt;
        session = { user: student1_vt }&lt;br /&gt;
        params = {id: participant_vt.id}&lt;br /&gt;
        stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to_not have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
        expect(response.body).to_not have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant2_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      it 'Instructor can view the student score' do        &lt;br /&gt;
        params = {id: participant_vt.id}        &lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
        expect(response.body).to have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant2_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. If show_teammate_reviews boolean is set to True, then both the student should and instructor should be able to see the teammate reviews. The student should see only the reviews received by him/her. The instructor should be able to see all student's teammate reviews. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    context 'when assignment(show reviews) value is checked' do&lt;br /&gt;
      it 'Student can view his score' do&lt;br /&gt;
        session = { user: student1_vt }&lt;br /&gt;
        params = {id: participant_vt.id}&lt;br /&gt;
        stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
        expect(response.body).to_not have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant2_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      it 'Instructor can view the student score' do        &lt;br /&gt;
        params = {id: participant_vt.id}        &lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
        expect(response.body).to have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant2_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. The reviewer id is tracked correctly to show the correct reviewer name in the teammate reviews table. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/models/vm_question_response_score_cell_spec.rb this] file &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  	describe '#reviewer_id' do&lt;br /&gt;
  		it 'returns reviewer id' do&lt;br /&gt;
			allow(ResponseMap).to receive(:find).with(1).and_return(review_response_map)&lt;br /&gt;
			allow(response).to receive(:populate_new_response).with(:review_response_map, &amp;quot;0&amp;quot;).and_return(response)&lt;br /&gt;
        	expect(response.id).to eq(1)	&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Summary of file changes ==&lt;br /&gt;
&lt;br /&gt;
The following files are modified:&lt;br /&gt;
&lt;br /&gt;
1. app/controllers/grades_controller.rb - Controller file which changed how the view model is populated&lt;br /&gt;
&lt;br /&gt;
2. app/views/grades/view_team.html.erb - View file, which  conditionally rendered the teammate name, for a teammate review heatgrid&lt;br /&gt;
&lt;br /&gt;
3. spec/controllers/grades_controller_spec.rb - For tests verifying the proposed changes&lt;br /&gt;
&lt;br /&gt;
4. app/models/vm_question_response.rb - To modify the view-model so it can tell us the name of the person being reviewed for the current heatgrid&lt;br /&gt;
&lt;br /&gt;
5. app/models/vm_question_response_score_cell.rb - &lt;br /&gt;
&lt;br /&gt;
6. app/assets/stylesheets/grades.scss - &lt;br /&gt;
&lt;br /&gt;
7. app/views/grades/_add_icon_to_name.html.erb - &lt;br /&gt;
&lt;br /&gt;
8. spec/factories/factories.rb -&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Design Patterns ==&lt;br /&gt;
&lt;br /&gt;
Existing code does not use any design patterns, apart from if-else. It uses if-else conditional statements to check what type of questionnaire is present in the viewmodel `VmQuestionResponse`, and based on that, it renders the appropriate content.&lt;br /&gt;
&lt;br /&gt;
We decided to continue with this approach since to change the present coding style, there were required many changes (refactoring) to many files which were out of the scope of the present project. To complete the project in the assigned time, we followed the if-else approach.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;https://expertiza.ncsu.edu/&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Agarg25</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141755</id>
		<title>CSC/ECE 517 Fall 2021 - E2165. Fix teammate-review view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141755"/>
		<updated>2021-11-28T19:17:02Z</updated>

		<summary type="html">&lt;p&gt;Agarg25: /* Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Introduction ==&lt;br /&gt;
&lt;br /&gt;
Dr. Edward Gehringer (instructor), Parimal Mehta (mentor)&lt;br /&gt;
&lt;br /&gt;
1. Anjali Garg (unity ID : agarg25)&lt;br /&gt;
&lt;br /&gt;
2. Arvasu Chikara (unity ID: achikar2)&lt;br /&gt;
&lt;br /&gt;
3. Lalit Bangad (unity ID: llbangad)&lt;br /&gt;
&lt;br /&gt;
4. Vinay Deshmukh (unity ID: vdeshmu)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Problems to be addressed ==&lt;br /&gt;
&lt;br /&gt;
After a project is submitted and reviewed, both the team members (students) and instructors should be able to view the teammate reviews. Students should be able to view the reviews by going to a particular assignment's -&amp;gt; your scores, at the bottom of the page. An instructor can view the teammate reviews by going to assignments -&amp;gt; assignment -&amp;gt; particular team's submission -&amp;gt; view submission -&amp;gt; assign grades -&amp;gt; view scores. &lt;br /&gt;
&lt;br /&gt;
In the case of the instructor, a single heat grid is shown whereas in the case of a team member, we cant view the scores. In the heat grid, it is not clear if the scores visible are for the reviews that the student has *written* for their teammates or the scores that the student has *received* from their teammates. Additionally, for instructors can choose from a list of the students on the team, but they have no way to tell whether the heat grid shows the reviews done *by* that student or done *for* that student.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Methodology Overview ==&lt;br /&gt;
&lt;br /&gt;
We have divided our work in the following tasks to address the above problems:&lt;br /&gt;
&lt;br /&gt;
1. Distinguish reviews done for a student by rendering separates heatgrids for each student&lt;br /&gt;
&lt;br /&gt;
2. For instructors, the table will have sections based on the students&lt;br /&gt;
&lt;br /&gt;
3. Include a checkbox on the edit assignment page that enables/disables visibility of heat grid to students&lt;br /&gt;
&lt;br /&gt;
4. Fix the average column for a table (which breaks for some reviews)&lt;br /&gt;
&lt;br /&gt;
5. Show a composite score derived from all reviews.  Make this code generalized, so other kinds of heat grid views could use it.&lt;br /&gt;
&lt;br /&gt;
6. Changes should work even in an anonymized view&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Motivations ==&lt;br /&gt;
&lt;br /&gt;
1. Enable users to clearly tell which reviews are done by them, and which reviews are done for them.&lt;br /&gt;
&lt;br /&gt;
2. Code should be generic so it can be used for different types of heat grids as well.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Control Flow to access the concerned screens ==&lt;br /&gt;
'''1. For instructor (Log in as an instructor):-'''&lt;br /&gt;
&lt;br /&gt;
Screen after logging in by the instructor&lt;br /&gt;
[[File:ss1.png |border|1000px|center]]&lt;br /&gt;
Got to assignments on the Manage menu &lt;br /&gt;
[[File:ss2.png |border|1000px|center]]&lt;br /&gt;
Go to assignments&lt;br /&gt;
[[File:ss3.png |border|1000px|center]]&lt;br /&gt;
Go to submissions for any assignment&lt;br /&gt;
[[File:ss4a.png |border|1000px|center]]&lt;br /&gt;
Go to Assign Grade&lt;br /&gt;
[[File:ss5a.png |border|1000px|center]]&lt;br /&gt;
You will land on the page where the changes are made and can be reviewed&lt;br /&gt;
[[File:ss7a.png |border|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
'''2. Student:- (Instructor impersonating a student)'''&lt;br /&gt;
&lt;br /&gt;
After landing on the assignments page, select any student from an assignment as shown below&lt;br /&gt;
[[File:ss6a.png |border|1000px|center]]&lt;br /&gt;
Go to/Select any assignment&lt;br /&gt;
[[File:ss9a.png |border|1000px|center]]&lt;br /&gt;
Go to your scores&lt;br /&gt;
[[File:ss10a.png |border|1000px|center]]&lt;br /&gt;
You will land on the page where the changes are made and can be reviewed&lt;br /&gt;
[[File:ss11a.png |border|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
== Old Status of the application ==&lt;br /&gt;
&lt;br /&gt;
'''1. Instructor's view of teammate review''': This is the current screen given to the instructor. Here we see that the instructor can not determine who has given which review to which student in a team.&lt;br /&gt;
&lt;br /&gt;
[[File:Instructor-view-1.png|border| 700px |center|alt=The proposed expanded student display.|The proposed expanded student display.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2. Student's view of teammate review''': Currently, a student is not able to see what grades were given by their teammates. We need to implement that functionality so that the student is able to view those grades.&lt;br /&gt;
&lt;br /&gt;
[[File:Student-view-2.png|border| 700px |center|alt=The current instructor view.|The current review display for instructors.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Error in existing UI for student''': In the existing UI for a student, the highlighted block should not be rendered. This part of the screen is meant for the instructors/TAs. &lt;br /&gt;
&lt;br /&gt;
[[File:Wrong render for student.png|border|700px|center|alt=Existing UI for student|Existing UI for student.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Proposed changes ==&lt;br /&gt;
&lt;br /&gt;
''' 1) Proposed UI for instructor ''': The instructor is able to see the score for all teammates. In the existing code, only one teammate's scores are being shown. But, we are planning to change the way the (VmQuestionResponse array is populated)[https://github.com/expertiza/expertiza/blob/master/app/controllers/grades_controller.rb#L114], so that the scores for all teammates are appended to it so it correctly shows what should have already been shown in this screen for the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Proposed_screen.png|border|700px|center|alt=Proposed UI for instructor|Proposed UI for instructor.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: When a student visits this screen, they will only be shown the reviews received by them, assuming the instructor has allowed visibility of teammate reviews to students.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' 2) Show detailed review for a particular question''': The instructor can see detailed review given to a student by their teammates by clicking on a particular question number in the table.&lt;br /&gt;
&lt;br /&gt;
[[File:ss12a.png|border|700px|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' 3) Show teammate review to student UI ''': The existing code doesn't render a student's teammate review scores at all. We are planning to render the scores to a student (as shown below) when they visit this screen. However, the visibility of this screen is contingent on whether the instructor has allowed visibility of the teammate review screen to students. If the instructor has disabled this feature, then the heatgrid will not be displayed at all.&lt;br /&gt;
&lt;br /&gt;
[[File:UI_for_student.png|border|700px|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== User Stories ==&lt;br /&gt;
&lt;br /&gt;
1. As an instructor, I can view what reviews one teammate has given to other teammates.&lt;br /&gt;
&lt;br /&gt;
2. As a student, I can view what reviews my teammates have given to me.&lt;br /&gt;
&lt;br /&gt;
3. As an instructor, I can choose if I want to see all student's teammates reviews together or one by one.&lt;br /&gt;
&lt;br /&gt;
4. As a student, if I am also a TA for another subject, I should not be able to see an instructor's view to the view_team page.&lt;br /&gt;
&lt;br /&gt;
5. As an instructor, I should be able to see the name of the reviewers for the reviews to a particular student.&lt;br /&gt;
&lt;br /&gt;
== Use case diagram for the system ==  &lt;br /&gt;
&lt;br /&gt;
[[File:vie_team_use_case.png|border|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Models used / Explanation of fixes ==&lt;br /&gt;
&lt;br /&gt;
The below diagram illustrates the proposed code change for showing all team members with the teammate review data to an instructor. The existing code only iterated on the `Participant` whose ID is present in the URL of the page. To fix this, we will iterate over all teammates of the given participant so that all teammate reviews for all team members are shown to the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Logic e2165.png|border|center|alt=Flow diagram of proposed changes for showing team review data to instructor]]&lt;br /&gt;
&lt;br /&gt;
===Changes made to the code are shown below. Every change is shown and explained separately===&lt;br /&gt;
&lt;br /&gt;
====A. Added the following to app/assets/stylesheets/grades.scss:====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    .teammate_table.hidden {&lt;br /&gt;
      display: none;&lt;br /&gt;
      }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====B. In app/controllers/grades_controller.rb: ====&lt;br /&gt;
&lt;br /&gt;
'''B.1:'''&lt;br /&gt;
&lt;br /&gt;
Old code: The existing code does not differentiate when adding a view model for the TeammateReview questionnaire&lt;br /&gt;
  questionnaires.each do |questionnaire|&lt;br /&gt;
     ...&lt;br /&gt;
     @vmlist &amp;lt;&amp;lt; populate_view_model(questionnaire)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
New code: Since the current page URL contains an ID for the participant, from which we get an assignment, which gives us a list of questionnaires, we need to iterate all participants for a `TeammateReveiwQuestionnaire` questionnaire, so that we get the heatgrid view models for all members of a team.&lt;br /&gt;
  questionnaires.each do |questionnaire|&lt;br /&gt;
     ...&lt;br /&gt;
     if questionnaire.type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
        # as teammate review will be different for each participant&lt;br /&gt;
        # we need to create a separate table for each teammate&lt;br /&gt;
        @participant.team.participants.each do |team_participant|&lt;br /&gt;
          @vmlist &amp;lt;&amp;lt; populate_view_model(team_participant, questionnaire, @team)&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        # only one participant needs iterating, as apart from teammatereview&lt;br /&gt;
        # all other reviews are at &amp;quot;team&amp;quot; level&lt;br /&gt;
        @vmlist &amp;lt;&amp;lt; populate_view_model(@participant, questionnaire, @team)&lt;br /&gt;
      end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
'''B.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code: This code uses @participant as an instance variable, but this structure will not work as we need to call this ViewModel with multiple participants when iterating for a teammate review questionnaire.&lt;br /&gt;
    def populate_view_model(questionnaire)&lt;br /&gt;
      vm = VmQuestionResponse.new(questionnaire, @assignment, @round)&lt;br /&gt;
      vmquestions = questionnaire.questions&lt;br /&gt;
      vm.add_questions(vmquestions)&lt;br /&gt;
      vm.add_team_members(@team)&lt;br /&gt;
      vm.add_reviews(@participant, @team, @assignment.vary_by_round)&lt;br /&gt;
      vm.number_of_comments_greater_than_10_words&lt;br /&gt;
      vm &lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
New code: We need to call this function with a separate participant in each invocation due to our change for TeammateReviewQuestionnaire, hence it makes sense to make `participant` as an argument to this function. Similarly, as `team` is a closely related model to `participant`, we are passing it as an argument, to keep this function as &amp;quot;pure&amp;quot; as possible.&lt;br /&gt;
    def populate_view_model(participant, questionnaire, team)&lt;br /&gt;
      ...&lt;br /&gt;
      vm.add_team_members(team)&lt;br /&gt;
      vm.add_reviews(participant, team, @assignment.vary_by_round)&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
====C. In app/models/vm_question_response.rb:====&lt;br /&gt;
&lt;br /&gt;
'''C.1: '''Added the reviewee_id method: Created a helper method within the VmQuestionReponse model to retrieve the `reviewee_id` for a heatgrid&lt;br /&gt;
&lt;br /&gt;
    def reviewee_id&lt;br /&gt;
      @participant_who_is_reviewee.user_id&lt;br /&gt;
    end &lt;br /&gt;
&lt;br /&gt;
'''C.2: '''Added the reviewee_name method: Created a helper method within the VmQuestionReponse model to retrieve the name of the student who is being reviewed for a heatgrid. This method uses the functionality to anonymize the name when we are in anonymized view.&lt;br /&gt;
&lt;br /&gt;
    def reviewee_name(ip_address = nil)&lt;br /&gt;
      part = @participant_who_is_reviewee&lt;br /&gt;
      User.find_by(id: part.user_id).fullname(ip_address)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''C.3: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Does not keep track of the student being reviewed&lt;br /&gt;
    elsif @questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
      reviews = participant.teammate_reviews&lt;br /&gt;
      reviews.each do |review|&lt;br /&gt;
        review_mapping = TeammateReviewResponseMap.find_by(id: review.map_id)&lt;br /&gt;
        participant = Participant.find(review_mapping.reviewer_id)&lt;br /&gt;
&lt;br /&gt;
New code: Add an instance variable to keep track of the student who is being reviewed in this VmQuestionReponse&lt;br /&gt;
    elsif @questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
      reviews = participant.teammate_reviews&lt;br /&gt;
      @participant_who_is_reviewee = participant&lt;br /&gt;
      reviews.each do |review|&lt;br /&gt;
        review_mapping = TeammateReviewResponseMap.find_by(id: review.map_id)&lt;br /&gt;
        participant = Participant.find(review_mapping.reviewer_id)&lt;br /&gt;
&lt;br /&gt;
'''C.4: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing VmQuestionReponseScoreCell keeps no information about the reviewer, as it only stores the answer score&lt;br /&gt;
    row.score_row.push(VmQuestionResponseScoreCell.new(answer.answer, color_code, answer.comments, vm_tag_prompts))&lt;br /&gt;
&lt;br /&gt;
New code: Keep track of the response ID, so that we can retrieve the user ID for the reviewer in the model to use in the view file.&lt;br /&gt;
    &lt;br /&gt;
    row.score_row.push(VmQuestionResponseScoreCell.new(answer.answer, color_code, answer.comments, vm_tag_prompts, answer.response_id))&lt;br /&gt;
&lt;br /&gt;
====D. In app/models/vm_question_response_score_cell.rb:====&lt;br /&gt;
&lt;br /&gt;
'''D.1: '''In the method initialize of class VmQuestionResponseScoreCell&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't keep track of the response id&lt;br /&gt;
    def initialize(score_value, color_code, comments, vmprompts = nil)&lt;br /&gt;
      @score_value = score_value&lt;br /&gt;
      @color_code = color_code&lt;br /&gt;
      @comment = comments&lt;br /&gt;
      @vm_prompts = vmprompts&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
New code: We added an instance variable to keep track of response_id&lt;br /&gt;
&lt;br /&gt;
    def initialize(score_value, color_code, comments, vmprompts = nil, response_id)&lt;br /&gt;
      ...&lt;br /&gt;
      @response_id = response_id&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''D.2: '''Added a method reviewer_id to the class VmQuestionResponseScoreCell: This helper method retrieves the ID for the reviewer who created this response.&lt;br /&gt;
&lt;br /&gt;
    def reviewer_id&lt;br /&gt;
      resp = Response.find(@response_id)&lt;br /&gt;
      map = ResponseMap.find(resp.map_id)&lt;br /&gt;
      map.reviewer_id&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
====E. In app/views/grades/_add_icon_to_name.html.erb:====&lt;br /&gt;
&lt;br /&gt;
'''E.1 '''Added the following code to the file: Write the code to generate the review text only once to reduce WET code&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;%# Determine the content of the reviewed by text %&amp;gt;&lt;br /&gt;
    &amp;lt;% review_text = &amp;quot;&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% if @current_role_name.eql?'Student' or questionnaire_type != &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
      &amp;lt;%# Use Review {{index}} format for student view, and when questionnaire_type is not teammatereview %&amp;gt;&lt;br /&gt;
      &amp;lt;% review_text = &amp;quot;Review #{i + 1}&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;% resp = Response.find(review.id) %&amp;gt;&lt;br /&gt;
      &amp;lt;% map = ResponseMap.find(resp.map_id) %&amp;gt;&lt;br /&gt;
      &amp;lt;% reviewer_id = map.reviewer_id %&amp;gt;&lt;br /&gt;
      &amp;lt;% fullname = Participant.find_by(id: reviewer_id).fullname(session[:ip]) %&amp;gt;&lt;br /&gt;
      &amp;lt;% review_text = &amp;quot;Review by #{fullname}&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% end%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''E.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code is very unreadable as it's not indented, and written in a single line with 359 characters, which breaks the ruby style guide rules&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;% if review.done_by_staff_participant? %&amp;gt;&lt;br /&gt;
      &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt; &amp;lt;img data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Icon indicates this review was done by course staff&amp;quot; class=&amp;quot;img_icon&amp;quot; src=&amp;quot;/assets/staff.png&amp;quot;&amp;gt; &amp;lt;a target=&amp;quot;_blank&amp;quot; href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Click to see details&amp;quot;&amp;gt;&amp;lt;%= &amp;quot;Review &amp;quot; + i.to_s  %&amp;gt;&amp;lt;/a&amp;gt; &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt; &amp;lt;a target=&amp;quot;_blank&amp;quot; href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Click to see details&amp;quot;&amp;gt;&amp;lt;%= &amp;quot;Review &amp;quot; + i.to_s %&amp;gt;&amp;lt;/a&amp;gt;  &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Correctly indented and removes WET repetition of code blocks and makes the resulting code DRYer&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;% if review.done_by_staff_participant? %&amp;gt;&lt;br /&gt;
      &amp;lt;img&lt;br /&gt;
      data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
      data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
      title=&amp;quot;Icon indicates this review was done by course staff&amp;quot; class=&amp;quot;img_icon&amp;quot;&lt;br /&gt;
      src=&amp;quot;/assets/staff.png&amp;quot;&lt;br /&gt;
      &amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;a&lt;br /&gt;
      target=&amp;quot;_blank&amp;quot;&lt;br /&gt;
      href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;&lt;br /&gt;
      data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
      data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
      title=&amp;quot;Click to see details&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;%= review_text %&amp;gt;&lt;br /&gt;
    &amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====F.In app/views/grades/view_team.html.erb:====&lt;br /&gt;
&lt;br /&gt;
'''F.1: '''Added function teammateSelectOnChange: This function toggles the visibility for the teammate heatgrids when the instructor changes the dropdown&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  function teammateSelectOnChange(selectNode) {&lt;br /&gt;
      const revieweeIdToShow= selectNode.value;&lt;br /&gt;
      const tableSelector = &amp;quot;.teammate_table&amp;quot;;&lt;br /&gt;
      if(revieweeIdToShow == &amp;quot;all&amp;quot;) {&lt;br /&gt;
        document.querySelectorAll(tableSelector).forEach((tableNode) =&amp;gt; {&lt;br /&gt;
          tableNode.classList.remove(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
        });&lt;br /&gt;
        return;&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
    document.querySelectorAll(tableSelector).forEach((tableNode) =&amp;gt; {&lt;br /&gt;
      const tableRevieweeId = tableNode.getAttribute('data-reviewee_id');&lt;br /&gt;
      if(tableRevieweeId == revieweeIdToShow) {&lt;br /&gt;
        tableNode.classList.remove(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
      } else {&lt;br /&gt;
        tableNode.classList.add(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
      }&lt;br /&gt;
      });&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't render TeammateReviewQuestionnaire&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;% @vmlist.each do |vm| %&amp;gt;&lt;br /&gt;
        &amp;lt;% if (vm.questionnaire_display_type == &amp;quot;Metareview&amp;quot; or vm.questionnaire_display_type == &amp;quot;Author Feedback&amp;quot; or vm.questionnaire_display_type == &amp;quot;Teammate Review&amp;quot;) and @current_role_name.eql?'Student' %&amp;gt;&lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
        &amp;lt;% if vm.list_of_reviewers.length &amp;gt; 0 %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Use a boolean to render a dropdown (that contains the students' IDs and names) just before the first TeammateReviewQuestionnaire, and unset that boolean so we only render 1 table. Add conditions which check for the truthiness of ```@assignment.show_teammate_reviews``` and if the current user is a student to decide whether to render the table or not. Finally, add a CSS class and a `data-reviewee_id` to keep track of the heatgrids when toggling visibility&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;%# This boolean is used to render a dropdown just before the first teammate review heat grid %&amp;gt;&lt;br /&gt;
&amp;lt;% first_teammate_review_appeared = false %&amp;gt;&lt;br /&gt;
&amp;lt;% @vmlist.each do |vm| %&amp;gt;&lt;br /&gt;
    &amp;lt;% if not @current_role_name.eql?'Student' and not first_teammate_review_appeared and vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        &amp;lt;select onchange=&amp;quot;teammateSelectOnChange(this)&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;all&amp;quot;&amp;gt;All&amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;% @vmlist.select { |tm_vm| tm_vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; }.each do |tm_vm| %&amp;gt;&lt;br /&gt;
            &amp;lt;option value=&amp;quot;&amp;lt;%= tm_vm.reviewee_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;%= tm_vm.reviewee_name(session[:ip]) %&amp;gt;&lt;br /&gt;
            &amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
        &amp;lt;/select&amp;gt;&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;% first_teammate_review_appeared = true %&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;% if (vm.questionnaire_display_type == &amp;quot;Metareview&amp;quot; or vm.questionnaire_display_type == &amp;quot;Author Feedback&amp;quot;) and @current_role_name.eql?'Student' %&amp;gt;&lt;br /&gt;
    &amp;lt;% elsif (vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; and @current_role_name.eql?'Student' and !@assignment.show_teammate_reviews)%&amp;gt;&lt;br /&gt;
    &amp;lt;% elsif (vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; and @current_role_name.eql?'Student' and @assignment.show_teammate_reviews and current_user.id != vm.reviewee_id )%&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
        &amp;lt;% if vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
          &amp;lt;div class=&amp;quot;teammate_table&amp;quot; data-reviewee_id=&amp;quot;&amp;lt;%= vm.reviewee_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
        &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.3  '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't print the teammate who is being reviewed.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
          &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
            &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: If TeammteReviewQuestionnaire is used, then use the `:reviewee_name` method for VmQuestionResponse model to print the name of the student who is being reviewed.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
          &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
            &amp;lt;% elsif vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (For: &amp;lt;%= vm.reviewee_name(session[:ip]) %&amp;gt;)&lt;br /&gt;
            &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.4 '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't inform the partial about the type of review being done&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_reviews.each do |review| %&amp;gt;&lt;br /&gt;
              &amp;lt;!-- instructors (or higher level users) see reviewer name, students see anonymized string --&amp;gt;&lt;br /&gt;
              &amp;lt;% if (['Student'].include? @current_role_name) &amp;amp;&amp;amp; @assignment.is_anonymous%&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i} %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                  &amp;lt;% user_name = User.find(Participant.find(ResponseMap.find(Response.find(review.id).map_id).reviewer_id).user_id).fullname(session[:ip]).to_s %&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i} %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% i += 1 %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
New code: Passes the type of review being done to the partial, so it can decide on how to render the review title. Note: This code seems to use repetition, but since the conditional used here are accessing `Anonymous` assignments and checking for user roles, we have not modified this code, as it is not directly related to our scope.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_reviews.each do |review| %&amp;gt;&lt;br /&gt;
              &amp;lt;!-- instructors (or higher level users) see reviewer name, students see anonymized string --&amp;gt;&lt;br /&gt;
              &amp;lt;% if (['Student'].include? @current_role_name) &amp;amp;&amp;amp; @assignment.is_anonymous%&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i, questionnaire_type: vm.questionnaire_type } %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                &amp;lt;% user_name = User.find(Participant.find(ResponseMap.find(Response.find(review.id).map_id).reviewer_id).user_id).fullname(session[:ip]).to_s %&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i, questionnaire_type: vm.questionnaire_type } %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% i += 1 %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Old code: Contains a `metrics-1` column&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-true&amp;quot; align=&amp;quot;right&amp;quot; &amp;gt;&lt;br /&gt;
            Avg&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;span  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;A count of comments, for the respective question, which have word count &amp;gt; 10. The purpose of this metric is to represent how many comments for the question are of a substantial length to provide quality feedback.&amp;quot;&amp;gt;metric-1&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/thead&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
New code: As per discussion with mentor, this column has been removed in our PR.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-true&amp;quot; align=&amp;quot;right&amp;quot; &amp;gt;&lt;br /&gt;
            Avg&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/thead&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.5 '''&lt;br /&gt;
&lt;br /&gt;
Old code: It creates the ID inline in multiple places, so if we decide to change the ID generation logic, we need to modify it in multiple places. (which happened when we started rendering multiple tables for each teammate).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_rows.each do |row| %&amp;gt;&lt;br /&gt;
            &amp;lt;!-- notice the data-target. because we're toggling via looped code, we need to dynamically generate the identifier. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr data-toggle=&amp;quot;collapse&amp;quot; class=&amp;quot;accordion-toggle&amp;quot; data-target=&amp;quot;#hid&amp;lt;%= row.question_id.to_s + vm.round.to_s %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Generate the unique HTML ID once, in a readable manner once. And conditionally make it more unique, if it is a TeammateReviewQuestionnaire, since jQuery code requires these IDs to be unique amongst different tables. If we don't make it more unique, then clicking on one teammate review table will toggle the table visibility for the first table. To prevent this &amp;quot;clashing&amp;quot;, we need to make these IDs more unique for a TeammateReviewQuestionnaire.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_rows.each do |row| %&amp;gt;&lt;br /&gt;
            &amp;lt;% target_id = &amp;quot;hid__#{row.question_id}__#{vm.round}&amp;quot; %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
              &amp;lt;%# Since we render different heatgrids with the same questions for each&lt;br /&gt;
              teammember, we need to distinguish the ID, based on the user for whom,&lt;br /&gt;
              the reviews have been created. %&amp;gt;&lt;br /&gt;
              &amp;lt;% target_id += &amp;quot;__#{vm.reviewee_id}&amp;quot; %&amp;gt;&lt;br /&gt;
            &amp;lt;% end%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;!-- notice the data-target. because we're toggling via looped code, we need to dynamically generate the identifier. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr data-toggle=&amp;quot;collapse&amp;quot; class=&amp;quot;accordion-toggle&amp;quot; data-target=&amp;quot;&amp;lt;%= &amp;quot;#&amp;quot; + target_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Old code: Written on a single line crossing 80 characters on a single line&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
              &amp;lt;% row.score_row.each do |score| %&amp;gt;&lt;br /&gt;
                  &amp;lt;% score_comment = score.comment.nil? ? '' : score.comment %&amp;gt; &amp;lt;!-- changing nil to null string to avoid Null Pointer Exception --&amp;gt;&lt;br /&gt;
                  &amp;lt;td class=&amp;quot;&amp;lt;%= score.color_code %&amp;gt;&amp;quot; align=&amp;quot;center&amp;quot; data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= strip_tags(score.comment).html_safe%&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;&amp;lt;%=  underlined?(score) %&amp;gt;&amp;quot;&amp;gt;&amp;lt;%= score.score_value.to_s %&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
                  &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
New code: Make code more readable by indenting it and splitting it over multiple lines&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
              &amp;lt;!-- actual cells with scores and colored background. --&amp;gt;&lt;br /&gt;
              &amp;lt;% row.score_row.each do |score| %&amp;gt;&lt;br /&gt;
                  &amp;lt;% score_comment = score.comment.nil? ? '' : score.comment %&amp;gt;&lt;br /&gt;
                  &amp;lt;!-- changing nil to null string to avoid Null Pointer Exception --&amp;gt;&lt;br /&gt;
                  &amp;lt;td class=&amp;quot;&amp;lt;%= score.color_code %&amp;gt;&amp;quot; align=&amp;quot;center&amp;quot; data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= strip_tags(score.comment).html_safe%&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;&amp;lt;%=  underlined?(score) %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                      &amp;lt;%= score.score_value.to_s %&amp;gt;&lt;br /&gt;
                    &amp;lt;/span&amp;gt;&lt;br /&gt;
                  &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.6 '''Removed the following code as it corresponds to the deleted column&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 &amp;lt;td  class = 'cf' align=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;%= row.countofcomments.to_s %&amp;gt;&lt;br /&gt;
              &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.7 '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code just unconditionally prints the text &amp;quot;Review&amp;quot; followed by an index.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                    &amp;lt;% for index in 0 .. row.score_row.length - 1 %&amp;gt;&lt;br /&gt;
                        &amp;lt;tr&amp;gt;&lt;br /&gt;
                          &amp;lt;td&amp;gt;Review &amp;lt;%=index + 1%&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Conditionally change the review text that is displayed based on the type of review and the access level of the user&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                    &amp;lt;% for index in 0 .. row.score_row.length - 1 %&amp;gt;&lt;br /&gt;
                        &amp;lt;tr&amp;gt;&lt;br /&gt;
                          &amp;lt;% if @current_role_name.eql?'Student' or vm.questionnaire_type != &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                            &amp;lt;%# Use Review {{index}} format for student view, and&lt;br /&gt;
                            when questionnaire_type is not teammatereview %&amp;gt;&lt;br /&gt;
                            &amp;lt;td&amp;gt;Review &amp;lt;%=index + 1%&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
                          &amp;lt;% else %&amp;gt;&lt;br /&gt;
                            &amp;lt;td&amp;gt;&lt;br /&gt;
                              &amp;lt;% reviewer_id = row.score_row[index].reviewer_id %&amp;gt;&lt;br /&gt;
                              &amp;lt;% fullname = Participant.find_by(id: reviewer_id).fullname(session[:ip]) %&amp;gt;&lt;br /&gt;
                              Review by &amp;lt;%= fullname %&amp;gt;&lt;br /&gt;
                            &amp;lt;/td&amp;gt;&lt;br /&gt;
                          &amp;lt;% end%&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====G. In spec/controllers/grades_controller_spec.rb:====&lt;br /&gt;
&lt;br /&gt;
'''G.1 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
before(:each) do&lt;br /&gt;
  allow(AssignmentParticipant).to receive(:find).with('1').and_return(participant)&lt;br /&gt;
  allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
  stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
@@ -91,29 +90,106 @@&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
before(:each) do&lt;br /&gt;
  allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
  stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
@@ -91,29 +90,106 @@&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''G.2 '''Remove xdescribe '#view_team' and change describe '#view_team' as follows.&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#view_team' do&lt;br /&gt;
render_views&lt;br /&gt;
context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
  it 'renders grades#view_team page' do&lt;br /&gt;
    allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
    allow(AssignmentQuestionnaire).to receive(:find_by).with(assignment_id: 1, questionnaire_id: 1).and_return(assignment_questionnaire)&lt;br /&gt;
    allow(AssignmentQuestionnaire).to receive(:where).with(any_args).and_return([assignment_questionnaire])&lt;br /&gt;
    allow(assignment).to receive(:late_policy_id).and_return(false)&lt;br /&gt;
    allow(assignment).to receive(:calculate_penalty).and_return(false)&lt;br /&gt;
    allow(assignment).to receive(:compute_total_score).with(any_args).and_return(100)&lt;br /&gt;
    allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
    allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
    params = {id: 1}&lt;br /&gt;
    allow(TaMapping).to receive(:exists?).with(ta_id: 1, course_id: 1).and_return(true)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#view_team' do&lt;br /&gt;
render_views&lt;br /&gt;
&lt;br /&gt;
# All stubs and factories are instantiated within this scope so as to not &lt;br /&gt;
# clash with other broken test.&lt;br /&gt;
# The names of the factories created for testing view_team&lt;br /&gt;
# have `_vt` suffix ```where necessary``` to differentiate them from &lt;br /&gt;
# the above declared factories&lt;br /&gt;
&lt;br /&gt;
let(:student1_vt) { create(:student, name: &amp;quot;barry&amp;quot;, id: 12) }&lt;br /&gt;
let(:student2_vt) { create(:student, name: &amp;quot;iris&amp;quot;, id: 13) }&lt;br /&gt;
&lt;br /&gt;
let(:tm_questionnaire) {&lt;br /&gt;
  build(&lt;br /&gt;
    :teammate_review_questionnaire,&lt;br /&gt;
    id: 12,&lt;br /&gt;
    questions: [question],&lt;br /&gt;
    max_question_score: 5&lt;br /&gt;
  )&lt;br /&gt;
}&lt;br /&gt;
let(:assignment_vt) {&lt;br /&gt;
  create(:assignment, id: 6, max_team_size: 2,&lt;br /&gt;
  questionnaires: [tm_questionnaire])&lt;br /&gt;
}&lt;br /&gt;
let(:assignment_questionnaire_vt) {&lt;br /&gt;
  create(:tm_assignment_questionnaire, id: 12, used_in_round: nil,&lt;br /&gt;
  assignment: assignment_vt, questionnaire: tm_questionnaire) }&lt;br /&gt;
let(:team_vt) { create(:assignment_team, id: 12,&lt;br /&gt;
assignment: assignment_vt) }&lt;br /&gt;
let(:participant_vt) { create(:participant, id: 12,&lt;br /&gt;
  assignment: assignment_vt, user_id: student1_vt.id) }&lt;br /&gt;
let(:participant2_vt) { create(:participant, id: 13,&lt;br /&gt;
  assignment: assignment_vt, user_id: student2_vt.id) }&lt;br /&gt;
&lt;br /&gt;
before(:each) do&lt;br /&gt;
  # Need to stub this method so the factory instance with&lt;br /&gt;
  # the stubbed :team method is returned by :find&lt;br /&gt;
  # instead of a separate instance with the same data&lt;br /&gt;
  allow(AssignmentParticipant)&lt;br /&gt;
    .to receive(:find)&lt;br /&gt;
    .with(participant_vt.id.to_s)&lt;br /&gt;
    .and_return(participant_vt)&lt;br /&gt;
  allow(participant_vt).to receive(:team).and_return(team_vt)&lt;br /&gt;
  allow(team_vt).to receive(:participants).and_return([participant_vt, participant2_vt])&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:find_by)&lt;br /&gt;
    .with(assignment_id: assignment_vt.id, questionnaire_id: tm_questionnaire.id)&lt;br /&gt;
    .and_return(assignment_questionnaire_vt)&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:find_by)&lt;br /&gt;
    .with(assignment_id: assignment.id, questionnaire_id: review_questionnaire.id)&lt;br /&gt;
    .and_return(assignment_questionnaire_vt)&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:where)&lt;br /&gt;
    .with(any_args)&lt;br /&gt;
    .and_return([assignment_questionnaire_vt])&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:late_policy_id)&lt;br /&gt;
    .and_return(false)&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:calculate_penalty)&lt;br /&gt;
    .and_return(false)&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:compute_total_score)&lt;br /&gt;
    .with(any_args)&lt;br /&gt;
    .and_return(100)&lt;br /&gt;
  allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
  allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
 it 'renders grades#view_team page' do&lt;br /&gt;
  params = {id: participant_vt.id}&lt;br /&gt;
  get :view_team, params&lt;br /&gt;
  expect(response).to render_template(:view_team)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is opened by student' do&lt;br /&gt;
  it 'dropdown is not rendered' do&lt;br /&gt;
    session = { user: student1_vt }&lt;br /&gt;
    params = {id: participant_vt.id}&lt;br /&gt;
    stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
    get :view_team, params&lt;br /&gt;
    expect(response.body).to_not have_selector('select')&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is opened by instructor' do&lt;br /&gt;
  it 'dropdown is rendered' do&lt;br /&gt;
    session = { user: instructor }&lt;br /&gt;
    params = {id: participant_vt.id}&lt;br /&gt;
    get :view_team, params&lt;br /&gt;
    expect(response.body).to have_selector('select')&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
  it 'renders grades#view_team page' do&lt;br /&gt;
    params = { id: participant_vt.id }&lt;br /&gt;
    allow(TaMapping).to receive(:exists?).with(ta_id: participant_vt.user_id, course_id: 1).and_return(true)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====H. In spec/factories/factories.rb:====&lt;br /&gt;
&lt;br /&gt;
'''H.1 '''Add the following factory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
factory :teammate_review_questionnaire, class: TeammateReviewQuestionnaire do&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''H.2 '''Add another factory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
factory :tm_assignment_questionnaire, class: AssignmentQuestionnaire do&lt;br /&gt;
  user_id 1&lt;br /&gt;
  questionnaire { association(:teammate_review_questionnaire) }&lt;br /&gt;
  questionnaire_weight 100&lt;br /&gt;
  used_in_round nil&lt;br /&gt;
  topic_id nil&lt;br /&gt;
  dropdown 1&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
'''OLD STATUS'''&lt;br /&gt;
&lt;br /&gt;
1. Earlier, the tests contained an xdescribe test to check if the view_team page is rendered correctly. However, this test was being skipped as this was an xdescribe segment. There was another test for when the view_team page is accessed by a student who is also a TA for another course. This can be checked [https://github.com/expertiza/expertiza/blob/beta/spec/controllers/grades_controller_spec.rb here].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 xdescribe '#view_team' do&lt;br /&gt;
    it 'renders grades#view_team page' do&lt;br /&gt;
      allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
      params = {id: 1}&lt;br /&gt;
      get :view_team, params&lt;br /&gt;
      expect(response).to render_template(:view_team)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#view_team' do&lt;br /&gt;
    render_views&lt;br /&gt;
    context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
      it 'renders grades#view_team page' do&lt;br /&gt;
        allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
        allow(AssignmentQuestionnaire).to receive(:find_by).with(assignment_id: 1, questionnaire_id: 1).and_return(assignment_questionnaire)&lt;br /&gt;
        allow(AssignmentQuestionnaire).to receive(:where).with(any_args).and_return([assignment_questionnaire])&lt;br /&gt;
        allow(assignment).to receive(:late_policy_id).and_return(false)&lt;br /&gt;
        allow(assignment).to receive(:calculate_penalty).and_return(false)&lt;br /&gt;
        allow(assignment).to receive(:compute_total_score).with(any_args).and_return(100)&lt;br /&gt;
        allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
        allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
        params = {id: 1}&lt;br /&gt;
        allow(TaMapping).to receive(:exists?).with(ta_id: 1, course_id: 1).and_return(true)&lt;br /&gt;
        stub_current_user(ta, ta.role.name, ta.role)&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).not_to have_content &amp;quot;TA&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''NEW STATUS'''&lt;br /&gt;
&lt;br /&gt;
1. The view_team page is rendered correctly for a given student or an instructor. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    it 'renders grades#view_team page' do&lt;br /&gt;
      params = {id: participant_vt.id}&lt;br /&gt;
      get :view_team, params&lt;br /&gt;
      expect(response).to render_template(:view_team)&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. When students access then the view_team page, the dropdown to select a student's teammate reviews is not rendered on the page. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when view_team page is opened by student' do&lt;br /&gt;
      it 'dropdown is not rendered' do&lt;br /&gt;
        session = { user: student1_vt }&lt;br /&gt;
        params = {id: participant_vt.id}&lt;br /&gt;
        stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to_not have_selector('select')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. When an instructor access then the view_team page, the dropdown to select a student's teammate reviews is rendered on the page. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when view_team page is opened by instructor' do&lt;br /&gt;
      it 'dropdown is rendered' do&lt;br /&gt;
        session = { user: instructor }&lt;br /&gt;
        params = {id: participant_vt.id}&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to have_selector('select')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. When a student who is also a TA for another course access the view_team page, that student should be able to a student's view to the page. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
      it 'renders grades#view_team page' do&lt;br /&gt;
        params = { id: participant_vt.id }&lt;br /&gt;
        allow(TaMapping).to receive(:exists?).with(ta_id: participant_vt.user_id, course_id: 1).and_return(true)&lt;br /&gt;
        stub_current_user(ta, ta.role.name, ta.role)&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).not_to have_content &amp;quot;TA&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. If show_teammate_reviews boolean is set to False, then the student should not be able to see the teammate reviews given to him/her. An instructor can still see the teammate reviews. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when assignment(show reviews) value is unchecked' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        allow(assignment_vt).to receive(:show_teammate_reviews).and_return(false) &lt;br /&gt;
      end&lt;br /&gt;
      it 'Student cannot view his score' do&lt;br /&gt;
        session = { user: student1_vt }&lt;br /&gt;
        params = {id: participant_vt.id}&lt;br /&gt;
        stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to_not have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
        expect(response.body).to_not have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant2_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      it 'Instructor can view the student score' do        &lt;br /&gt;
        params = {id: participant_vt.id}        &lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
        expect(response.body).to have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant2_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. If show_teammate_reviews boolean is set to True, then both the student should and instructor should be able to see the teammate reviews. The student should see only the reviews received by him/her. The instructor should be able to see all student's teammate reviews. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    context 'when assignment(show reviews) value is checked' do&lt;br /&gt;
      it 'Student can view his score' do&lt;br /&gt;
        session = { user: student1_vt }&lt;br /&gt;
        params = {id: participant_vt.id}&lt;br /&gt;
        stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
        expect(response.body).to_not have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant2_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      it 'Instructor can view the student score' do        &lt;br /&gt;
        params = {id: participant_vt.id}        &lt;br /&gt;
        get :view_team, params&lt;br /&gt;
        expect(response.body).to have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
        expect(response.body).to have_selector(&amp;quot;.teammate_table[data-reviewee_id=\&amp;quot;#{participant2_vt.id}\&amp;quot;]&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. The reviewer id is tracked correctly to show the correct reviewer name in the teammate reviews table. This can be checked in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/models/vm_question_response_score_cell_spec.rb this] file &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  	describe '#reviewer_id' do&lt;br /&gt;
  		it 'returns reviewer id' do&lt;br /&gt;
			allow(ResponseMap).to receive(:find).with(1).and_return(review_response_map)&lt;br /&gt;
			allow(response).to receive(:populate_new_response).with(:review_response_map, &amp;quot;0&amp;quot;).and_return(response)&lt;br /&gt;
        	expect(response.id).to eq(1)	&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Summary of file changes ==&lt;br /&gt;
&lt;br /&gt;
The following files are modified:&lt;br /&gt;
&lt;br /&gt;
1. app/controllers/grades_controller.rb - Controller file which changed how the view model is populated&lt;br /&gt;
&lt;br /&gt;
2. app/views/grades/view_team.html.erb - View file, which  conditionally rendered the teammate name, for a teammate review heatgrid&lt;br /&gt;
&lt;br /&gt;
3. spec/controllers/grades_controller_spec.rb - For tests verifying the proposed changes&lt;br /&gt;
&lt;br /&gt;
4. app/models/vm_question_response.rb - To modify the view-model so it can tell us the name of the person being reviewed for the current heatgrid&lt;br /&gt;
&lt;br /&gt;
5. app/models/vm_question_response_score_cell.rb - &lt;br /&gt;
&lt;br /&gt;
6. app/assets/stylesheets/grades.scss - &lt;br /&gt;
&lt;br /&gt;
7. app/views/grades/_add_icon_to_name.html.erb - &lt;br /&gt;
&lt;br /&gt;
8. spec/factories/factories.rb -&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Design Patterns ==&lt;br /&gt;
&lt;br /&gt;
Existing code does not use any design patterns, apart from if-else. It uses if-else conditional statements to check what type of questionnaire is present in the viewmodel `VmQuestionResponse`, and based on that, it renders the appropriate content.&lt;br /&gt;
&lt;br /&gt;
We decided to continue with this approach since to change the present coding style, there were required many changes (refactoring) to many files which were out of the scope of the present project. To complete the project in the assigned time, we followed the if-else approach.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;https://expertiza.ncsu.edu/&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Agarg25</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141749</id>
		<title>CSC/ECE 517 Fall 2021 - E2165. Fix teammate-review view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141749"/>
		<updated>2021-11-28T18:57:05Z</updated>

		<summary type="html">&lt;p&gt;Agarg25: /* Control Flow to access the concerned screens */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Introduction ==&lt;br /&gt;
&lt;br /&gt;
Dr. Edward Gehringer (instructor), Parimal Mehta (mentor)&lt;br /&gt;
&lt;br /&gt;
1. Anjali Garg (unity ID : agarg25)&lt;br /&gt;
&lt;br /&gt;
2. Arvasu Chikara (unity ID: achikar2)&lt;br /&gt;
&lt;br /&gt;
3. Lalit Bangad (unity ID: llbangad)&lt;br /&gt;
&lt;br /&gt;
4. Vinay Deshmukh (unity ID: vdeshmu)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Problems to be addressed ==&lt;br /&gt;
&lt;br /&gt;
After a project is submitted and reviewed, both the team members (students) and instructors should be able to view the teammate reviews. Students should be able to view the reviews by going to a particular assignment's -&amp;gt; your scores, at the bottom of the page. An instructor can view the teammate reviews by going to assignments -&amp;gt; assignment -&amp;gt; particular team's submission -&amp;gt; view submission -&amp;gt; assign grades -&amp;gt; view scores. &lt;br /&gt;
&lt;br /&gt;
In the case of the instructor, a single heat grid is shown whereas in the case of a team member, we cant view the scores. In the heat grid, it is not clear if the scores visible are for the reviews that the student has *written* for their teammates or the scores that the student has *received* from their teammates. Additionally, for instructors can choose from a list of the students on the team, but they have no way to tell whether the heat grid shows the reviews done *by* that student or done *for* that student.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Methodology Overview ==&lt;br /&gt;
&lt;br /&gt;
We have divided our work in the following tasks to address the above problems:&lt;br /&gt;
&lt;br /&gt;
1. Distinguish reviews done for a student by rendering separates heatgrids for each student&lt;br /&gt;
&lt;br /&gt;
2. For instructors, the table will have sections based on the students&lt;br /&gt;
&lt;br /&gt;
3. Include a checkbox on the edit assignment page that enables/disables visibility of heat grid to students&lt;br /&gt;
&lt;br /&gt;
4. Fix the average column for a table (which breaks for some reviews)&lt;br /&gt;
&lt;br /&gt;
5. Show a composite score derived from all reviews.  Make this code generalized, so other kinds of heat grid views could use it.&lt;br /&gt;
&lt;br /&gt;
6. Changes should work even in an anonymized view&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Motivations ==&lt;br /&gt;
&lt;br /&gt;
1. Enable users to clearly tell which reviews are done by them, and which reviews are done for them.&lt;br /&gt;
&lt;br /&gt;
2. Code should be generic so it can be used for different types of heat grids as well.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Control Flow to access the concerned screens ==&lt;br /&gt;
'''1. For instructor (Log in as an instructor):-'''&lt;br /&gt;
&lt;br /&gt;
Screen after logging in by the instructor&lt;br /&gt;
[[File:ss1.png |border|1000px|center]]&lt;br /&gt;
Got to assignments on the Manage menu &lt;br /&gt;
[[File:ss2.png |border|1000px|center]]&lt;br /&gt;
Go to assignments&lt;br /&gt;
[[File:ss3.png |border|1000px|center]]&lt;br /&gt;
Go to submissions for any assignment&lt;br /&gt;
[[File:ss4a.png |border|1000px|center]]&lt;br /&gt;
Go to Assign Grade&lt;br /&gt;
[[File:ss5a.png |border|1000px|center]]&lt;br /&gt;
You will land on the page where the changes are made and can be reviewed&lt;br /&gt;
[[File:ss7a.png |border|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
'''2. Student:- (Instructor impersonating a student)'''&lt;br /&gt;
&lt;br /&gt;
After landing on the assignments page, select any student from an assignment as shown below&lt;br /&gt;
[[File:ss6a.png |border|1000px|center]]&lt;br /&gt;
Go to/Select any assignment&lt;br /&gt;
[[File:ss9a.png |border|1000px|center]]&lt;br /&gt;
Go to your scores&lt;br /&gt;
[[File:ss10a.png |border|1000px|center]]&lt;br /&gt;
You will land on the page where the changes are made and can be reviewed&lt;br /&gt;
[[File:ss11a.png |border|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
== Old Status of the application ==&lt;br /&gt;
&lt;br /&gt;
'''1. Instructor's view of teammate review''': This is the current screen given to the instructor. Here we see that the instructor can not determine who has given which review to which student in a team.&lt;br /&gt;
&lt;br /&gt;
[[File:Instructor-view-1.png|border| 700px |center|alt=The proposed expanded student display.|The proposed expanded student display.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2. Student's view of teammate review''': Currently, a student is not able to see what grades were given by their teammates. We need to implement that functionality so that the student is able to view those grades.&lt;br /&gt;
&lt;br /&gt;
[[File:Student-view-2.png|border| 700px |center|alt=The current instructor view.|The current review display for instructors.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Error in existing UI for student''': In the existing UI for a student, the highlighted block should not be rendered. This part of the screen is meant for the instructors/TAs. &lt;br /&gt;
&lt;br /&gt;
[[File:Wrong render for student.png|border|700px|center|alt=Existing UI for student|Existing UI for student.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Proposed changes ==&lt;br /&gt;
&lt;br /&gt;
''' 1) Proposed UI for instructor ''': The instructor is able to see the score for all teammates. In the existing code, only one teammate's scores are being shown. But, we are planning to change the way the (VmQuestionResponse array is populated)[https://github.com/expertiza/expertiza/blob/master/app/controllers/grades_controller.rb#L114], so that the scores for all teammates are appended to it so it correctly shows what should have already been shown in this screen for the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Proposed_screen.png|border|700px|center|alt=Proposed UI for instructor|Proposed UI for instructor.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: When a student visits this screen, they will only be shown the reviews received by them, assuming the instructor has allowed visibility of teammate reviews to students.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' 2) Show detailed review for a particular question''': The instructor can see detailed review given to a student by their teammates by clicking on a particular question number in the table.&lt;br /&gt;
&lt;br /&gt;
[[File:ss12a.png|border|700px|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' 3) Show teammate review to student UI ''': The existing code doesn't render a student's teammate review scores at all. We are planning to render the scores to a student (as shown below) when they visit this screen. However, the visibility of this screen is contingent on whether the instructor has allowed visibility of the teammate review screen to students. If the instructor has disabled this feature, then the heatgrid will not be displayed at all.&lt;br /&gt;
&lt;br /&gt;
[[File:UI_for_student.png|border|700px|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== User Stories ==&lt;br /&gt;
&lt;br /&gt;
1. As an instructor, I can view what reviews one teammate has given to other teammates.&lt;br /&gt;
&lt;br /&gt;
2. As a student, I can view what reviews my teammates have given to me.&lt;br /&gt;
&lt;br /&gt;
3. As an instructor, I can choose if I want to see all student's teammates reviews together or one by one.&lt;br /&gt;
&lt;br /&gt;
4. As a student, if I am also a TA for another subject, I should not be able to see an instructor's view to the view_team page.&lt;br /&gt;
&lt;br /&gt;
5. As an instructor, I should be able to see the name of the reviewers for the reviews to a particular student.&lt;br /&gt;
&lt;br /&gt;
== Use case diagram for the system ==  &lt;br /&gt;
&lt;br /&gt;
[[File:vie_team_use_case.png|border|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Models used / Explanation of fixes ==&lt;br /&gt;
&lt;br /&gt;
The below diagram illustrates the proposed code change for showing all team members with the teammate review data to an instructor. The existing code only iterated on the `Participant` whose ID is present in the URL of the page. To fix this, we will iterate over all teammates of the given participant so that all teammate reviews for all team members are shown to the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Logic e2165.png|border|center|alt=Flow diagram of proposed changes for showing team review data to instructor]]&lt;br /&gt;
&lt;br /&gt;
===Changes made to the code are shown below. Every change is shown and explained separately===&lt;br /&gt;
&lt;br /&gt;
====A. Added the following to app/assets/stylesheets/grades.scss:====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    .teammate_table.hidden {&lt;br /&gt;
      display: none;&lt;br /&gt;
      }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====B. In app/controllers/grades_controller.rb: ====&lt;br /&gt;
&lt;br /&gt;
'''B.1:'''&lt;br /&gt;
&lt;br /&gt;
Old code: The existing code does not differentiate when adding a view model for the TeammateReview questionnaire&lt;br /&gt;
  questionnaires.each do |questionnaire|&lt;br /&gt;
     ...&lt;br /&gt;
     @vmlist &amp;lt;&amp;lt; populate_view_model(questionnaire)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
New code: Since the current page URL contains an ID for the participant, from which we get an assignment, which gives us a list of questionnaires, we need to iterate all participants for a `TeammateReveiwQuestionnaire` questionnaire, so that we get the heatgrid view models for all members of a team.&lt;br /&gt;
  questionnaires.each do |questionnaire|&lt;br /&gt;
     ...&lt;br /&gt;
     if questionnaire.type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
        # as teammate review will be different for each participant&lt;br /&gt;
        # we need to create a separate table for each teammate&lt;br /&gt;
        @participant.team.participants.each do |team_participant|&lt;br /&gt;
          @vmlist &amp;lt;&amp;lt; populate_view_model(team_participant, questionnaire, @team)&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        # only one participant needs iterating, as apart from teammatereview&lt;br /&gt;
        # all other reviews are at &amp;quot;team&amp;quot; level&lt;br /&gt;
        @vmlist &amp;lt;&amp;lt; populate_view_model(@participant, questionnaire, @team)&lt;br /&gt;
      end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
'''B.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code: This code uses @participant as an instance variable, but this structure will not work as we need to call this ViewModel with multiple participants when iterating for a teammate review questionnaire.&lt;br /&gt;
    def populate_view_model(questionnaire)&lt;br /&gt;
      vm = VmQuestionResponse.new(questionnaire, @assignment, @round)&lt;br /&gt;
      vmquestions = questionnaire.questions&lt;br /&gt;
      vm.add_questions(vmquestions)&lt;br /&gt;
      vm.add_team_members(@team)&lt;br /&gt;
      vm.add_reviews(@participant, @team, @assignment.vary_by_round)&lt;br /&gt;
      vm.number_of_comments_greater_than_10_words&lt;br /&gt;
      vm &lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
New code: We need to call this function with a separate participant in each invocation due to our change for TeammateReviewQuestionnaire, hence it makes sense to make `participant` as an argument to this function. Similarly, as `team` is a closely related model to `participant`, we are passing it as an argument, to keep this function as &amp;quot;pure&amp;quot; as possible.&lt;br /&gt;
    def populate_view_model(participant, questionnaire, team)&lt;br /&gt;
      ...&lt;br /&gt;
      vm.add_team_members(team)&lt;br /&gt;
      vm.add_reviews(participant, team, @assignment.vary_by_round)&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
====C. In app/models/vm_question_response.rb:====&lt;br /&gt;
&lt;br /&gt;
'''C.1: '''Added the reviewee_id method: Created a helper method within the VmQuestionReponse model to retrieve the `reviewee_id` for a heatgrid&lt;br /&gt;
&lt;br /&gt;
    def reviewee_id&lt;br /&gt;
      @participant_who_is_reviewee.user_id&lt;br /&gt;
    end &lt;br /&gt;
&lt;br /&gt;
'''C.2: '''Added the reviewee_name method: Created a helper method within the VmQuestionReponse model to retrieve the name of the student who is being reviewed for a heatgrid. This method uses the functionality to anonymize the name when we are in anonymized view.&lt;br /&gt;
&lt;br /&gt;
    def reviewee_name(ip_address = nil)&lt;br /&gt;
      part = @participant_who_is_reviewee&lt;br /&gt;
      User.find_by(id: part.user_id).fullname(ip_address)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''C.3: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Does not keep track of the student being reviewed&lt;br /&gt;
    elsif @questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
      reviews = participant.teammate_reviews&lt;br /&gt;
      reviews.each do |review|&lt;br /&gt;
        review_mapping = TeammateReviewResponseMap.find_by(id: review.map_id)&lt;br /&gt;
        participant = Participant.find(review_mapping.reviewer_id)&lt;br /&gt;
&lt;br /&gt;
New code: Add an instance variable to keep track of the student who is being reviewed in this VmQuestionReponse&lt;br /&gt;
    elsif @questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
      reviews = participant.teammate_reviews&lt;br /&gt;
      @participant_who_is_reviewee = participant&lt;br /&gt;
      reviews.each do |review|&lt;br /&gt;
        review_mapping = TeammateReviewResponseMap.find_by(id: review.map_id)&lt;br /&gt;
        participant = Participant.find(review_mapping.reviewer_id)&lt;br /&gt;
&lt;br /&gt;
'''C.4: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing VmQuestionReponseScoreCell keeps no information about the reviewer, as it only stores the answer score&lt;br /&gt;
    row.score_row.push(VmQuestionResponseScoreCell.new(answer.answer, color_code, answer.comments, vm_tag_prompts))&lt;br /&gt;
&lt;br /&gt;
New code: Keep track of the response ID, so that we can retrieve the user ID for the reviewer in the model to use in the view file.&lt;br /&gt;
    &lt;br /&gt;
    row.score_row.push(VmQuestionResponseScoreCell.new(answer.answer, color_code, answer.comments, vm_tag_prompts, answer.response_id))&lt;br /&gt;
&lt;br /&gt;
====D. In app/models/vm_question_response_score_cell.rb:====&lt;br /&gt;
&lt;br /&gt;
'''D.1: '''In the method initialize of class VmQuestionResponseScoreCell&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't keep track of the response id&lt;br /&gt;
    def initialize(score_value, color_code, comments, vmprompts = nil)&lt;br /&gt;
      @score_value = score_value&lt;br /&gt;
      @color_code = color_code&lt;br /&gt;
      @comment = comments&lt;br /&gt;
      @vm_prompts = vmprompts&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
New code: We added an instance variable to keep track of response_id&lt;br /&gt;
&lt;br /&gt;
    def initialize(score_value, color_code, comments, vmprompts = nil, response_id)&lt;br /&gt;
      ...&lt;br /&gt;
      @response_id = response_id&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''D.2: '''Added a method reviewer_id to the class VmQuestionResponseScoreCell: This helper method retrieves the ID for the reviewer who created this response.&lt;br /&gt;
&lt;br /&gt;
    def reviewer_id&lt;br /&gt;
      resp = Response.find(@response_id)&lt;br /&gt;
      map = ResponseMap.find(resp.map_id)&lt;br /&gt;
      map.reviewer_id&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
====E. In app/views/grades/_add_icon_to_name.html.erb:====&lt;br /&gt;
&lt;br /&gt;
'''E.1 '''Added the following code to the file: Write the code to generate the review text only once to reduce WET code&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;%# Determine the content of the reviewed by text %&amp;gt;&lt;br /&gt;
    &amp;lt;% review_text = &amp;quot;&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% if @current_role_name.eql?'Student' or questionnaire_type != &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
      &amp;lt;%# Use Review {{index}} format for student view, and when questionnaire_type is not teammatereview %&amp;gt;&lt;br /&gt;
      &amp;lt;% review_text = &amp;quot;Review #{i + 1}&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;% resp = Response.find(review.id) %&amp;gt;&lt;br /&gt;
      &amp;lt;% map = ResponseMap.find(resp.map_id) %&amp;gt;&lt;br /&gt;
      &amp;lt;% reviewer_id = map.reviewer_id %&amp;gt;&lt;br /&gt;
      &amp;lt;% fullname = Participant.find_by(id: reviewer_id).fullname(session[:ip]) %&amp;gt;&lt;br /&gt;
      &amp;lt;% review_text = &amp;quot;Review by #{fullname}&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% end%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''E.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code is very unreadable as it's not indented, and written in a single line with 359 characters, which breaks the ruby style guide rules&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;% if review.done_by_staff_participant? %&amp;gt;&lt;br /&gt;
      &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt; &amp;lt;img data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Icon indicates this review was done by course staff&amp;quot; class=&amp;quot;img_icon&amp;quot; src=&amp;quot;/assets/staff.png&amp;quot;&amp;gt; &amp;lt;a target=&amp;quot;_blank&amp;quot; href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Click to see details&amp;quot;&amp;gt;&amp;lt;%= &amp;quot;Review &amp;quot; + i.to_s  %&amp;gt;&amp;lt;/a&amp;gt; &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt; &amp;lt;a target=&amp;quot;_blank&amp;quot; href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Click to see details&amp;quot;&amp;gt;&amp;lt;%= &amp;quot;Review &amp;quot; + i.to_s %&amp;gt;&amp;lt;/a&amp;gt;  &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Correctly indented and removes WET repetition of code blocks and makes the resulting code DRYer&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;% if review.done_by_staff_participant? %&amp;gt;&lt;br /&gt;
      &amp;lt;img&lt;br /&gt;
      data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
      data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
      title=&amp;quot;Icon indicates this review was done by course staff&amp;quot; class=&amp;quot;img_icon&amp;quot;&lt;br /&gt;
      src=&amp;quot;/assets/staff.png&amp;quot;&lt;br /&gt;
      &amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;a&lt;br /&gt;
      target=&amp;quot;_blank&amp;quot;&lt;br /&gt;
      href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;&lt;br /&gt;
      data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
      data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
      title=&amp;quot;Click to see details&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;%= review_text %&amp;gt;&lt;br /&gt;
    &amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====F.In app/views/grades/view_team.html.erb:====&lt;br /&gt;
&lt;br /&gt;
'''F.1: '''Added function teammateSelectOnChange: This function toggles the visibility for the teammate heatgrids when the instructor changes the dropdown&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  function teammateSelectOnChange(selectNode) {&lt;br /&gt;
      const revieweeIdToShow= selectNode.value;&lt;br /&gt;
      const tableSelector = &amp;quot;.teammate_table&amp;quot;;&lt;br /&gt;
      if(revieweeIdToShow == &amp;quot;all&amp;quot;) {&lt;br /&gt;
        document.querySelectorAll(tableSelector).forEach((tableNode) =&amp;gt; {&lt;br /&gt;
          tableNode.classList.remove(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
        });&lt;br /&gt;
        return;&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
    document.querySelectorAll(tableSelector).forEach((tableNode) =&amp;gt; {&lt;br /&gt;
      const tableRevieweeId = tableNode.getAttribute('data-reviewee_id');&lt;br /&gt;
      if(tableRevieweeId == revieweeIdToShow) {&lt;br /&gt;
        tableNode.classList.remove(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
      } else {&lt;br /&gt;
        tableNode.classList.add(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
      }&lt;br /&gt;
      });&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't render TeammateReviewQuestionnaire&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;% @vmlist.each do |vm| %&amp;gt;&lt;br /&gt;
        &amp;lt;% if (vm.questionnaire_display_type == &amp;quot;Metareview&amp;quot; or vm.questionnaire_display_type == &amp;quot;Author Feedback&amp;quot; or vm.questionnaire_display_type == &amp;quot;Teammate Review&amp;quot;) and @current_role_name.eql?'Student' %&amp;gt;&lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
        &amp;lt;% if vm.list_of_reviewers.length &amp;gt; 0 %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Use a boolean to render a dropdown just before the first TeammateReviewQuestionnaire, and unset that boolean so we only render 1 table. Add conditions which check for the truthiness of ```@assignment.show_teammate_reviews``` and if the current user is a student to decide whether to render the table or not. Finally, add a CSS class and a `data-reviewee_id` to keep track of the heatgrids when toggling visibility&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;%# This boolean is used to render a dropdown just before the first teammate review heat grid %&amp;gt;&lt;br /&gt;
&amp;lt;% first_teammate_review_appeared = false %&amp;gt;&lt;br /&gt;
&amp;lt;% @vmlist.each do |vm| %&amp;gt;&lt;br /&gt;
    &amp;lt;% if not @current_role_name.eql?'Student' and not first_teammate_review_appeared and vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        &amp;lt;select onchange=&amp;quot;teammateSelectOnChange(this)&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;all&amp;quot;&amp;gt;All&amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;% @vmlist.select { |tm_vm| tm_vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; }.each do |tm_vm| %&amp;gt;&lt;br /&gt;
            &amp;lt;option value=&amp;quot;&amp;lt;%= tm_vm.reviewee_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;%= tm_vm.reviewee_name(session[:ip]) %&amp;gt;&lt;br /&gt;
            &amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
        &amp;lt;/select&amp;gt;&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;% first_teammate_review_appeared = true %&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;% if (vm.questionnaire_display_type == &amp;quot;Metareview&amp;quot; or vm.questionnaire_display_type == &amp;quot;Author Feedback&amp;quot;) and @current_role_name.eql?'Student' %&amp;gt;&lt;br /&gt;
    &amp;lt;% elsif (vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; and @current_role_name.eql?'Student' and !@assignment.show_teammate_reviews)%&amp;gt;&lt;br /&gt;
    &amp;lt;% elsif (vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; and @current_role_name.eql?'Student' and @assignment.show_teammate_reviews and current_user.id != vm.reviewee_id )%&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
        &amp;lt;% if vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
          &amp;lt;div class=&amp;quot;teammate_table&amp;quot; data-reviewee_id=&amp;quot;&amp;lt;%= vm.reviewee_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
        &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.3  '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't print the teammate who is being reviewed.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
          &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
            &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: If TeammteReviewQuestionnaire is used, then use the `:reviewee_name` method for VmQuestionResponse model to print the name of the student who is being reviewed.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
          &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
            &amp;lt;% elsif vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (For: &amp;lt;%= vm.reviewee_name(session[:ip]) %&amp;gt;)&lt;br /&gt;
            &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.4 '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't inform the partial about the type of review being done&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_reviews.each do |review| %&amp;gt;&lt;br /&gt;
              &amp;lt;!-- instructors (or higher level users) see reviewer name, students see anonymized string --&amp;gt;&lt;br /&gt;
              &amp;lt;% if (['Student'].include? @current_role_name) &amp;amp;&amp;amp; @assignment.is_anonymous%&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i} %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                  &amp;lt;% user_name = User.find(Participant.find(ResponseMap.find(Response.find(review.id).map_id).reviewer_id).user_id).fullname(session[:ip]).to_s %&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i} %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% i += 1 %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
New code: Passes the type of review being done to the partial, so it can decide on how to render the review title. Note: This code seems to use repetition, but since the conditional used here are accessing `Anonymous` assignments and checking for user roles, we have not modified this code, as it is not directly related to our scope.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_reviews.each do |review| %&amp;gt;&lt;br /&gt;
              &amp;lt;!-- instructors (or higher level users) see reviewer name, students see anonymized string --&amp;gt;&lt;br /&gt;
              &amp;lt;% if (['Student'].include? @current_role_name) &amp;amp;&amp;amp; @assignment.is_anonymous%&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i, questionnaire_type: vm.questionnaire_type } %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                &amp;lt;% user_name = User.find(Participant.find(ResponseMap.find(Response.find(review.id).map_id).reviewer_id).user_id).fullname(session[:ip]).to_s %&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i, questionnaire_type: vm.questionnaire_type } %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% i += 1 %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Old code: Contains a `metrics-` column&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-true&amp;quot; align=&amp;quot;right&amp;quot; &amp;gt;&lt;br /&gt;
            Avg&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;span  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;A count of comments, for the respective question, which have word count &amp;gt; 10. The purpose of this metric is to represent how many comments for the question are of a substantial length to provide quality feedback.&amp;quot;&amp;gt;metric-1&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/thead&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
New code: As per discussion with mentor, this column has been removed in our PR.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-true&amp;quot; align=&amp;quot;right&amp;quot; &amp;gt;&lt;br /&gt;
            Avg&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/thead&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.5 '''&lt;br /&gt;
&lt;br /&gt;
Old code: It creates the ID inline in multiple places, so if we decide to change the ID generation logic, we need to modify it in multiple places. (which happened when we started rendering multiple tables for each teammate).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_rows.each do |row| %&amp;gt;&lt;br /&gt;
            &amp;lt;!-- notice the data-target. because we're toggling via looped code, we need to dynamically generate the identifier. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr data-toggle=&amp;quot;collapse&amp;quot; class=&amp;quot;accordion-toggle&amp;quot; data-target=&amp;quot;#hid&amp;lt;%= row.question_id.to_s + vm.round.to_s %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;td class = 'cf' data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= row.question_text %&amp;gt;&amp;quot;&amp;gt; &amp;lt;div style='float: left'&amp;gt;&amp;lt;%= j.to_s %&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div style='float: right'&amp;gt; &amp;amp;#&amp;lt;%= type_and_max(row) %&amp;gt;;&amp;lt;/div&amp;gt;  &amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Generate the unique HTML ID once, in a readable manner once. And conditionally make it more unique, if it is a TeammateReviewQuestionnaire, since jQuery code requires these IDs to be unique amongst different tables. If we don't make it more unique, then clicking on one teammate review table will toggle the table visibility for the first table. To prevent this &amp;quot;clashing&amp;quot;, we need to make these IDs more unique for a TeammateReviewQuestionnaire.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_rows.each do |row| %&amp;gt;&lt;br /&gt;
            &amp;lt;% target_id = &amp;quot;hid__#{row.question_id}__#{vm.round}&amp;quot; %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
              &amp;lt;%# Since we render different heatgrids with the same questions for each&lt;br /&gt;
              teammember, we need to distinguish the ID, based on the user for whom,&lt;br /&gt;
              the reviews have been created. %&amp;gt;&lt;br /&gt;
              &amp;lt;% target_id += &amp;quot;__#{vm.reviewee_id}&amp;quot; %&amp;gt;&lt;br /&gt;
            &amp;lt;% end%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;!-- notice the data-target. because we're toggling via looped code, we need to dynamically generate the identifier. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr data-toggle=&amp;quot;collapse&amp;quot; class=&amp;quot;accordion-toggle&amp;quot; data-target=&amp;quot;&amp;lt;%= &amp;quot;#&amp;quot; + target_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Old code: Written on a single line crossing 80 characters on a single line&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
              &amp;lt;% row.score_row.each do |score| %&amp;gt;&lt;br /&gt;
                  &amp;lt;% score_comment = score.comment.nil? ? '' : score.comment %&amp;gt; &amp;lt;!-- changing nil to null string to avoid Null Pointer Exception --&amp;gt;&lt;br /&gt;
                  &amp;lt;td class=&amp;quot;&amp;lt;%= score.color_code %&amp;gt;&amp;quot; align=&amp;quot;center&amp;quot; data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= strip_tags(score.comment).html_safe%&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;&amp;lt;%=  underlined?(score) %&amp;gt;&amp;quot;&amp;gt;&amp;lt;%= score.score_value.to_s %&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
                  &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
New code: Make code more readable by indenting it and splitting it over multiple lines&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
              &amp;lt;!-- actual cells with scores and colored background. --&amp;gt;&lt;br /&gt;
              &amp;lt;% row.score_row.each do |score| %&amp;gt;&lt;br /&gt;
                  &amp;lt;% score_comment = score.comment.nil? ? '' : score.comment %&amp;gt;&lt;br /&gt;
                  &amp;lt;!-- changing nil to null string to avoid Null Pointer Exception --&amp;gt;&lt;br /&gt;
                  &amp;lt;td class=&amp;quot;&amp;lt;%= score.color_code %&amp;gt;&amp;quot; align=&amp;quot;center&amp;quot; data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= strip_tags(score.comment).html_safe%&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;&amp;lt;%=  underlined?(score) %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                      &amp;lt;%= score.score_value.to_s %&amp;gt;&lt;br /&gt;
                    &amp;lt;/span&amp;gt;&lt;br /&gt;
                  &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.6 '''Removed the following code as it corresponds to the deleted column&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 &amp;lt;td  class = 'cf' align=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;%= row.countofcomments.to_s %&amp;gt;&lt;br /&gt;
              &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.7 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!--loop that creates the collapsed-by-default row, which lists all comments. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr class=&amp;quot;tablesorter-childRow&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;td colspan=&amp;quot;&amp;lt;%= (i+1).to_s %&amp;gt;&amp;quot; class=&amp;quot;hiddenRow&amp;quot; &amp;gt;&amp;lt;div id=&amp;quot;hid&amp;lt;%= row.question_id.to_s + vm.round.to_s %&amp;gt;&amp;quot; class=&amp;quot;accordion-body collapse&amp;quot; style=&amp;quot;margin-left:10px;&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;div style=&amp;quot;padding-top: 10px; padding-bottom: 10px;&amp;quot;&amp;gt;&amp;lt;%=  sanitize row.question_text %&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;div&amp;gt;&lt;br /&gt;
                  &amp;lt;table class=&amp;quot;table tbl_questlist&amp;quot;&amp;gt;&lt;br /&gt;
@@ -181,7 +233,17 @@&lt;br /&gt;
                    &amp;lt;/thead&amp;gt;&lt;br /&gt;
                    &amp;lt;% for index in 0 .. row.score_row.length - 1 %&amp;gt;&lt;br /&gt;
                        &amp;lt;tr&amp;gt;&lt;br /&gt;
                          &amp;lt;td&amp;gt;Review &amp;lt;%=index + 1%&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!--loop that creates the collapsed-by-default row, which lists all comments. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr class=&amp;quot;tablesorter-childRow&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;td colspan=&amp;quot;&amp;lt;%= (i+1).to_s %&amp;gt;&amp;quot; class=&amp;quot;hiddenRow&amp;quot; &amp;gt;&amp;lt;div id=&amp;quot;&amp;lt;%= target_id %&amp;gt;&amp;quot; class=&amp;quot;accordion-body collapse&amp;quot; style=&amp;quot;margin-left:10px;&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;div style=&amp;quot;padding-top: 10px; padding-bottom: 10px;&amp;quot;&amp;gt;&amp;lt;%=  sanitize row.question_text %&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;div&amp;gt;&lt;br /&gt;
                  &amp;lt;table class=&amp;quot;table tbl_questlist&amp;quot;&amp;gt;&lt;br /&gt;
@@ -181,7 +233,17 @@&lt;br /&gt;
                    &amp;lt;/thead&amp;gt;&lt;br /&gt;
                    &amp;lt;% for index in 0 .. row.score_row.length - 1 %&amp;gt;&lt;br /&gt;
                        &amp;lt;tr&amp;gt;&lt;br /&gt;
                          &amp;lt;% if @current_role_name.eql?'Student' or vm.questionnaire_type != &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                            &amp;lt;%# Use Review {{index}} format for student view, and&lt;br /&gt;
                            when questionnaire_type is not teammatereview %&amp;gt;&lt;br /&gt;
                            &amp;lt;td&amp;gt;Review &amp;lt;%=index + 1%&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
                          &amp;lt;% else %&amp;gt;&lt;br /&gt;
                            &amp;lt;td&amp;gt;&lt;br /&gt;
                              &amp;lt;% reviewer_id = row.score_row[index].reviewer_id %&amp;gt;&lt;br /&gt;
                              &amp;lt;% fullname = Participant.find_by(id: reviewer_id).fullname(session[:ip]) %&amp;gt;&lt;br /&gt;
                              Review by &amp;lt;%= fullname %&amp;gt;&lt;br /&gt;
                            &amp;lt;/td&amp;gt;&lt;br /&gt;
                          &amp;lt;% end%&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====G. In spec/controllers/grades_controller_spec.rb:====&lt;br /&gt;
&lt;br /&gt;
'''G.1 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
before(:each) do&lt;br /&gt;
  allow(AssignmentParticipant).to receive(:find).with('1').and_return(participant)&lt;br /&gt;
  allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
  stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
@@ -91,29 +90,106 @@&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
before(:each) do&lt;br /&gt;
  allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
  stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
@@ -91,29 +90,106 @@&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''G.2 '''Remove xdescribe '#view_team' and change describe '#view_team' as follows.&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#view_team' do&lt;br /&gt;
render_views&lt;br /&gt;
context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
  it 'renders grades#view_team page' do&lt;br /&gt;
    allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
    allow(AssignmentQuestionnaire).to receive(:find_by).with(assignment_id: 1, questionnaire_id: 1).and_return(assignment_questionnaire)&lt;br /&gt;
    allow(AssignmentQuestionnaire).to receive(:where).with(any_args).and_return([assignment_questionnaire])&lt;br /&gt;
    allow(assignment).to receive(:late_policy_id).and_return(false)&lt;br /&gt;
    allow(assignment).to receive(:calculate_penalty).and_return(false)&lt;br /&gt;
    allow(assignment).to receive(:compute_total_score).with(any_args).and_return(100)&lt;br /&gt;
    allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
    allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
    params = {id: 1}&lt;br /&gt;
    allow(TaMapping).to receive(:exists?).with(ta_id: 1, course_id: 1).and_return(true)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#view_team' do&lt;br /&gt;
render_views&lt;br /&gt;
&lt;br /&gt;
# All stubs and factories are instantiated within this scope so as to not &lt;br /&gt;
# clash with other broken test.&lt;br /&gt;
# The names of the factories created for testing view_team&lt;br /&gt;
# have `_vt` suffix ```where necessary``` to differentiate them from &lt;br /&gt;
# the above declared factories&lt;br /&gt;
&lt;br /&gt;
let(:student1_vt) { create(:student, name: &amp;quot;barry&amp;quot;, id: 12) }&lt;br /&gt;
let(:student2_vt) { create(:student, name: &amp;quot;iris&amp;quot;, id: 13) }&lt;br /&gt;
&lt;br /&gt;
let(:tm_questionnaire) {&lt;br /&gt;
  build(&lt;br /&gt;
    :teammate_review_questionnaire,&lt;br /&gt;
    id: 12,&lt;br /&gt;
    questions: [question],&lt;br /&gt;
    max_question_score: 5&lt;br /&gt;
  )&lt;br /&gt;
}&lt;br /&gt;
let(:assignment_vt) {&lt;br /&gt;
  create(:assignment, id: 6, max_team_size: 2,&lt;br /&gt;
  questionnaires: [tm_questionnaire])&lt;br /&gt;
}&lt;br /&gt;
let(:assignment_questionnaire_vt) {&lt;br /&gt;
  create(:tm_assignment_questionnaire, id: 12, used_in_round: nil,&lt;br /&gt;
  assignment: assignment_vt, questionnaire: tm_questionnaire) }&lt;br /&gt;
let(:team_vt) { create(:assignment_team, id: 12,&lt;br /&gt;
assignment: assignment_vt) }&lt;br /&gt;
let(:participant_vt) { create(:participant, id: 12,&lt;br /&gt;
  assignment: assignment_vt, user_id: student1_vt.id) }&lt;br /&gt;
let(:participant2_vt) { create(:participant, id: 13,&lt;br /&gt;
  assignment: assignment_vt, user_id: student2_vt.id) }&lt;br /&gt;
&lt;br /&gt;
before(:each) do&lt;br /&gt;
  # Need to stub this method so the factory instance with&lt;br /&gt;
  # the stubbed :team method is returned by :find&lt;br /&gt;
  # instead of a separate instance with the same data&lt;br /&gt;
  allow(AssignmentParticipant)&lt;br /&gt;
    .to receive(:find)&lt;br /&gt;
    .with(participant_vt.id.to_s)&lt;br /&gt;
    .and_return(participant_vt)&lt;br /&gt;
  allow(participant_vt).to receive(:team).and_return(team_vt)&lt;br /&gt;
  allow(team_vt).to receive(:participants).and_return([participant_vt, participant2_vt])&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:find_by)&lt;br /&gt;
    .with(assignment_id: assignment_vt.id, questionnaire_id: tm_questionnaire.id)&lt;br /&gt;
    .and_return(assignment_questionnaire_vt)&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:find_by)&lt;br /&gt;
    .with(assignment_id: assignment.id, questionnaire_id: review_questionnaire.id)&lt;br /&gt;
    .and_return(assignment_questionnaire_vt)&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:where)&lt;br /&gt;
    .with(any_args)&lt;br /&gt;
    .and_return([assignment_questionnaire_vt])&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:late_policy_id)&lt;br /&gt;
    .and_return(false)&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:calculate_penalty)&lt;br /&gt;
    .and_return(false)&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:compute_total_score)&lt;br /&gt;
    .with(any_args)&lt;br /&gt;
    .and_return(100)&lt;br /&gt;
  allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
  allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
 it 'renders grades#view_team page' do&lt;br /&gt;
  params = {id: participant_vt.id}&lt;br /&gt;
  get :view_team, params&lt;br /&gt;
  expect(response).to render_template(:view_team)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is opened by student' do&lt;br /&gt;
  it 'dropdown is not rendered' do&lt;br /&gt;
    session = { user: student1_vt }&lt;br /&gt;
    params = {id: participant_vt.id}&lt;br /&gt;
    stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
    get :view_team, params&lt;br /&gt;
    expect(response.body).to_not have_selector('select')&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is opened by instructor' do&lt;br /&gt;
  it 'dropdown is rendered' do&lt;br /&gt;
    session = { user: instructor }&lt;br /&gt;
    params = {id: participant_vt.id}&lt;br /&gt;
    get :view_team, params&lt;br /&gt;
    expect(response.body).to have_selector('select')&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
  it 'renders grades#view_team page' do&lt;br /&gt;
    params = { id: participant_vt.id }&lt;br /&gt;
    allow(TaMapping).to receive(:exists?).with(ta_id: participant_vt.user_id, course_id: 1).and_return(true)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====H. In spec/factories/factories.rb:====&lt;br /&gt;
&lt;br /&gt;
'''H.1 '''Add the following factory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
factory :teammate_review_questionnaire, class: TeammateReviewQuestionnaire do&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''H.2 '''Add another factory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
factory :tm_assignment_questionnaire, class: AssignmentQuestionnaire do&lt;br /&gt;
  user_id 1&lt;br /&gt;
  questionnaire { association(:teammate_review_questionnaire) }&lt;br /&gt;
  questionnaire_weight 100&lt;br /&gt;
  used_in_round nil&lt;br /&gt;
  topic_id nil&lt;br /&gt;
  dropdown 1&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
'''OLD STATUS'''&lt;br /&gt;
&lt;br /&gt;
1. Earlier, the tests only covered if the view_team is page is rendered when it is asked for. This can be seen on the line 94 and 103 in [https://github.com/expertiza/expertiza/blob/beta/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''NEW STATUS'''&lt;br /&gt;
&lt;br /&gt;
1. The view_team page is rendered correctly for a given student or an instructor.&lt;br /&gt;
&lt;br /&gt;
2. When students access then the view_team page, the dropdown to select a student's teammate reviews is not rendered on the page.&lt;br /&gt;
&lt;br /&gt;
3. When instructor access then the view_team page, the dropdown to select a student's teammate reviews is rendered on the page.&lt;br /&gt;
&lt;br /&gt;
4. When a student who is also a TA for another course access the view_team page, that student should be able to a student's view to the page.&lt;br /&gt;
&lt;br /&gt;
5. If show_teammate_reviews boolean is set to False, then the student should not be able to see the teammate reviews given to him/her. If it is set to True, then the student should be able to see the reviews.&lt;br /&gt;
&lt;br /&gt;
6. An instructor should be able to see the teammate reviews for all students regardless of whether the show_teammate_reviews boolean is set to True or False.&lt;br /&gt;
&lt;br /&gt;
7. The reviewer id is tracked correctly to show the correct reviewer name in the teammate reviews table. This can be seen on line 27 in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/models/vm_question_response_score_cell_spec.rb this] file &lt;br /&gt;
&lt;br /&gt;
8. An instructor can select which student's scores he/she wants to see. If no student's name is selected then the professor can see the scores of all the students.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Summary of file changes ==&lt;br /&gt;
&lt;br /&gt;
The following files are modified:&lt;br /&gt;
&lt;br /&gt;
1. app/controllers/grades_controller.rb - Controller file which changed how the view model is populated&lt;br /&gt;
&lt;br /&gt;
2. app/views/grades/view_team.html.erb - View file, which  conditionally rendered the teammate name, for a teammate review heatgrid&lt;br /&gt;
&lt;br /&gt;
3. spec/controllers/grades_controller_spec.rb - For tests verifying the proposed changes&lt;br /&gt;
&lt;br /&gt;
4. app/models/vm_question_response.rb - To modify the view-model so it can tell us the name of the person being reviewed for the current heatgrid&lt;br /&gt;
&lt;br /&gt;
5. app/models/vm_question_response_score_cell.rb - &lt;br /&gt;
&lt;br /&gt;
6. app/assets/stylesheets/grades.scss - &lt;br /&gt;
&lt;br /&gt;
7. app/views/grades/_add_icon_to_name.html.erb - &lt;br /&gt;
&lt;br /&gt;
8. spec/factories/factories.rb -&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Design Patterns ==&lt;br /&gt;
&lt;br /&gt;
Existing code does not use any design patterns, apart from if-else. It uses if-else conditional statements to check what type of questionnaire is present in the viewmodel `VmQuestionResponse`, and based on that, it renders the appropriate content.&lt;br /&gt;
&lt;br /&gt;
We decided to continue with this approach since to change the present coding style, there were required many changes (refactoring) to many files which were out of the scope of the present project. To complete the project in the assigned time, we followed the if-else approach.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;https://expertiza.ncsu.edu/&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Agarg25</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141748</id>
		<title>CSC/ECE 517 Fall 2021 - E2165. Fix teammate-review view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141748"/>
		<updated>2021-11-28T18:53:40Z</updated>

		<summary type="html">&lt;p&gt;Agarg25: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Introduction ==&lt;br /&gt;
&lt;br /&gt;
Dr. Edward Gehringer (instructor), Parimal Mehta (mentor)&lt;br /&gt;
&lt;br /&gt;
1. Anjali Garg (unity ID : agarg25)&lt;br /&gt;
&lt;br /&gt;
2. Arvasu Chikara (unity ID: achikar2)&lt;br /&gt;
&lt;br /&gt;
3. Lalit Bangad (unity ID: llbangad)&lt;br /&gt;
&lt;br /&gt;
4. Vinay Deshmukh (unity ID: vdeshmu)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Problems to be addressed ==&lt;br /&gt;
&lt;br /&gt;
After a project is submitted and reviewed, both the team members (students) and instructors should be able to view the teammate reviews. Students should be able to view the reviews by going to a particular assignment's -&amp;gt; your scores, at the bottom of the page. An instructor can view the teammate reviews by going to assignments -&amp;gt; assignment -&amp;gt; particular team's submission -&amp;gt; view submission -&amp;gt; assign grades -&amp;gt; view scores. &lt;br /&gt;
&lt;br /&gt;
In the case of the instructor, a single heat grid is shown whereas in the case of a team member, we cant view the scores. In the heat grid, it is not clear if the scores visible are for the reviews that the student has *written* for their teammates or the scores that the student has *received* from their teammates. Additionally, for instructors can choose from a list of the students on the team, but they have no way to tell whether the heat grid shows the reviews done *by* that student or done *for* that student.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Methodology Overview ==&lt;br /&gt;
&lt;br /&gt;
We have divided our work in the following tasks to address the above problems:&lt;br /&gt;
&lt;br /&gt;
1. Distinguish reviews done for a student by rendering separates heatgrids for each student&lt;br /&gt;
&lt;br /&gt;
2. For instructors, the table will have sections based on the students&lt;br /&gt;
&lt;br /&gt;
3. Include a checkbox on the edit assignment page that enables/disables visibility of heat grid to students&lt;br /&gt;
&lt;br /&gt;
4. Fix the average column for a table (which breaks for some reviews)&lt;br /&gt;
&lt;br /&gt;
5. Show a composite score derived from all reviews.  Make this code generalized, so other kinds of heat grid views could use it.&lt;br /&gt;
&lt;br /&gt;
6. Changes should work even in an anonymized view&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Motivations ==&lt;br /&gt;
&lt;br /&gt;
1. Enable users to clearly tell which reviews are done by them, and which reviews are done for them.&lt;br /&gt;
&lt;br /&gt;
2. Code should be generic so it can be used for different types of heat grids as well.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Control Flow to access the concerned screens ==&lt;br /&gt;
'''1. For instructor (Log in as an instructor):-'''&lt;br /&gt;
&lt;br /&gt;
Screen after logging in by the instructor&lt;br /&gt;
[[File:ss1.png |border|1000px|center]]&lt;br /&gt;
Got to assignments on the Manage menu &lt;br /&gt;
[[File:ss2.png |border|1000px|center]]&lt;br /&gt;
Go to assignments&lt;br /&gt;
[[File:ss3.png |border|1000px|center]]&lt;br /&gt;
Go to submissions for any assignment&lt;br /&gt;
[[File:ss4a.png |border|1000px|center]]&lt;br /&gt;
Go to Assign Grade&lt;br /&gt;
[[File:ss5a.png |border|1000px|center]]&lt;br /&gt;
You will land on the page where the changes are made and can be reviewed&lt;br /&gt;
[[File:ss7a.png |border|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
'''2. Student:- (Logged in as an instructor)'''&lt;br /&gt;
&lt;br /&gt;
After landing on the assignments page, select any student from an assignment as shown below&lt;br /&gt;
[[File:ss6a.png |border|1000px|center]]&lt;br /&gt;
Go to/Select any assignment&lt;br /&gt;
[[File:ss9a.png |border|1000px|center]]&lt;br /&gt;
Go to your scores&lt;br /&gt;
[[File:ss10a.png |border|1000px|center]]&lt;br /&gt;
You will land on the page where the changes are made and can be reviewed&lt;br /&gt;
[[File:ss11a.png |border|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Old Status of the application ==&lt;br /&gt;
&lt;br /&gt;
'''1. Instructor's view of teammate review''': This is the current screen given to the instructor. Here we see that the instructor can not determine who has given which review to which student in a team.&lt;br /&gt;
&lt;br /&gt;
[[File:Instructor-view-1.png|border| 700px |center|alt=The proposed expanded student display.|The proposed expanded student display.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2. Student's view of teammate review''': Currently, a student is not able to see what grades were given by their teammates. We need to implement that functionality so that the student is able to view those grades.&lt;br /&gt;
&lt;br /&gt;
[[File:Student-view-2.png|border| 700px |center|alt=The current instructor view.|The current review display for instructors.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Error in existing UI for student''': In the existing UI for a student, the highlighted block should not be rendered. This part of the screen is meant for the instructors/TAs. &lt;br /&gt;
&lt;br /&gt;
[[File:Wrong render for student.png|border|700px|center|alt=Existing UI for student|Existing UI for student.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Proposed changes ==&lt;br /&gt;
&lt;br /&gt;
''' 1) Proposed UI for instructor ''': The instructor is able to see the score for all teammates. In the existing code, only one teammate's scores are being shown. But, we are planning to change the way the (VmQuestionResponse array is populated)[https://github.com/expertiza/expertiza/blob/master/app/controllers/grades_controller.rb#L114], so that the scores for all teammates are appended to it so it correctly shows what should have already been shown in this screen for the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Proposed_screen.png|border|700px|center|alt=Proposed UI for instructor|Proposed UI for instructor.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: When a student visits this screen, they will only be shown the reviews received by them, assuming the instructor has allowed visibility of teammate reviews to students.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' 2) Show detailed review for a particular question''': The instructor can see detailed review given to a student by their teammates by clicking on a particular question number in the table.&lt;br /&gt;
&lt;br /&gt;
[[File:ss12a.png|border|700px|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' 3) Show teammate review to student UI ''': The existing code doesn't render a student's teammate review scores at all. We are planning to render the scores to a student (as shown below) when they visit this screen. However, the visibility of this screen is contingent on whether the instructor has allowed visibility of the teammate review screen to students. If the instructor has disabled this feature, then the heatgrid will not be displayed at all.&lt;br /&gt;
&lt;br /&gt;
[[File:UI_for_student.png|border|700px|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== User Stories ==&lt;br /&gt;
&lt;br /&gt;
1. As an instructor, I can view what reviews one teammate has given to other teammates.&lt;br /&gt;
&lt;br /&gt;
2. As a student, I can view what reviews my teammates have given to me.&lt;br /&gt;
&lt;br /&gt;
3. As an instructor, I can choose if I want to see all student's teammates reviews together or one by one.&lt;br /&gt;
&lt;br /&gt;
4. As a student, if I am also a TA for another subject, I should not be able to see an instructor's view to the view_team page.&lt;br /&gt;
&lt;br /&gt;
5. As an instructor, I should be able to see the name of the reviewers for the reviews to a particular student.&lt;br /&gt;
&lt;br /&gt;
== Use case diagram for the system ==  &lt;br /&gt;
&lt;br /&gt;
[[File:vie_team_use_case.png|border|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Models used / Explanation of fixes ==&lt;br /&gt;
&lt;br /&gt;
The below diagram illustrates the proposed code change for showing all team members with the teammate review data to an instructor. The existing code only iterated on the `Participant` whose ID is present in the URL of the page. To fix this, we will iterate over all teammates of the given participant so that all teammate reviews for all team members are shown to the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Logic e2165.png|border|center|alt=Flow diagram of proposed changes for showing team review data to instructor]]&lt;br /&gt;
&lt;br /&gt;
===Changes made to the code are shown below. Every change is shown and explained separately===&lt;br /&gt;
&lt;br /&gt;
====A. Added the following to app/assets/stylesheets/grades.scss:====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    .teammate_table.hidden {&lt;br /&gt;
      display: none;&lt;br /&gt;
      }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====B. In app/controllers/grades_controller.rb: ====&lt;br /&gt;
&lt;br /&gt;
'''B.1:'''&lt;br /&gt;
&lt;br /&gt;
Old code: The existing code does not differentiate when adding a view model for the TeammateReview questionnaire&lt;br /&gt;
  questionnaires.each do |questionnaire|&lt;br /&gt;
     ...&lt;br /&gt;
     @vmlist &amp;lt;&amp;lt; populate_view_model(questionnaire)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
New code: Since the current page URL contains an ID for the participant, from which we get an assignment, which gives us a list of questionnaires, we need to iterate all participants for a `TeammateReveiwQuestionnaire` questionnaire, so that we get the heatgrid view models for all members of a team.&lt;br /&gt;
  questionnaires.each do |questionnaire|&lt;br /&gt;
     ...&lt;br /&gt;
     if questionnaire.type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
        # as teammate review will be different for each participant&lt;br /&gt;
        # we need to create a separate table for each teammate&lt;br /&gt;
        @participant.team.participants.each do |team_participant|&lt;br /&gt;
          @vmlist &amp;lt;&amp;lt; populate_view_model(team_participant, questionnaire, @team)&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        # only one participant needs iterating, as apart from teammatereview&lt;br /&gt;
        # all other reviews are at &amp;quot;team&amp;quot; level&lt;br /&gt;
        @vmlist &amp;lt;&amp;lt; populate_view_model(@participant, questionnaire, @team)&lt;br /&gt;
      end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
'''B.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code: This code uses @participant as an instance variable, but this structure will not work as we need to call this ViewModel with multiple participants when iterating for a teammate review questionnaire.&lt;br /&gt;
    def populate_view_model(questionnaire)&lt;br /&gt;
      vm = VmQuestionResponse.new(questionnaire, @assignment, @round)&lt;br /&gt;
      vmquestions = questionnaire.questions&lt;br /&gt;
      vm.add_questions(vmquestions)&lt;br /&gt;
      vm.add_team_members(@team)&lt;br /&gt;
      vm.add_reviews(@participant, @team, @assignment.vary_by_round)&lt;br /&gt;
      vm.number_of_comments_greater_than_10_words&lt;br /&gt;
      vm &lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
New code: We need to call this function with a separate participant in each invocation due to our change for TeammateReviewQuestionnaire, hence it makes sense to make `participant` as an argument to this function. Similarly, as `team` is a closely related model to `participant`, we are passing it as an argument, to keep this function as &amp;quot;pure&amp;quot; as possible.&lt;br /&gt;
    def populate_view_model(participant, questionnaire, team)&lt;br /&gt;
      ...&lt;br /&gt;
      vm.add_team_members(team)&lt;br /&gt;
      vm.add_reviews(participant, team, @assignment.vary_by_round)&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
====C. In app/models/vm_question_response.rb:====&lt;br /&gt;
&lt;br /&gt;
'''C.1: '''Added the reviewee_id method: Created a helper method within the VmQuestionReponse model to retrieve the `reviewee_id` for a heatgrid&lt;br /&gt;
&lt;br /&gt;
    def reviewee_id&lt;br /&gt;
      @participant_who_is_reviewee.user_id&lt;br /&gt;
    end &lt;br /&gt;
&lt;br /&gt;
'''C.2: '''Added the reviewee_name method: Created a helper method within the VmQuestionReponse model to retrieve the name of the student who is being reviewed for a heatgrid. This method uses the functionality to anonymize the name when we are in anonymized view.&lt;br /&gt;
&lt;br /&gt;
    def reviewee_name(ip_address = nil)&lt;br /&gt;
      part = @participant_who_is_reviewee&lt;br /&gt;
      User.find_by(id: part.user_id).fullname(ip_address)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''C.3: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Does not keep track of the student being reviewed&lt;br /&gt;
    elsif @questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
      reviews = participant.teammate_reviews&lt;br /&gt;
      reviews.each do |review|&lt;br /&gt;
        review_mapping = TeammateReviewResponseMap.find_by(id: review.map_id)&lt;br /&gt;
        participant = Participant.find(review_mapping.reviewer_id)&lt;br /&gt;
&lt;br /&gt;
New code: Add an instance variable to keep track of the student who is being reviewed in this VmQuestionReponse&lt;br /&gt;
    elsif @questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
      reviews = participant.teammate_reviews&lt;br /&gt;
      @participant_who_is_reviewee = participant&lt;br /&gt;
      reviews.each do |review|&lt;br /&gt;
        review_mapping = TeammateReviewResponseMap.find_by(id: review.map_id)&lt;br /&gt;
        participant = Participant.find(review_mapping.reviewer_id)&lt;br /&gt;
&lt;br /&gt;
'''C.4: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing VmQuestionReponseScoreCell keeps no information about the reviewer, as it only stores the answer score&lt;br /&gt;
    row.score_row.push(VmQuestionResponseScoreCell.new(answer.answer, color_code, answer.comments, vm_tag_prompts))&lt;br /&gt;
&lt;br /&gt;
New code: Keep track of the response ID, so that we can retrieve the user ID for the reviewer in the model to use in the view file.&lt;br /&gt;
    &lt;br /&gt;
    row.score_row.push(VmQuestionResponseScoreCell.new(answer.answer, color_code, answer.comments, vm_tag_prompts, answer.response_id))&lt;br /&gt;
&lt;br /&gt;
====D. In app/models/vm_question_response_score_cell.rb:====&lt;br /&gt;
&lt;br /&gt;
'''D.1: '''In the method initialize of class VmQuestionResponseScoreCell&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't keep track of the response id&lt;br /&gt;
    def initialize(score_value, color_code, comments, vmprompts = nil)&lt;br /&gt;
      @score_value = score_value&lt;br /&gt;
      @color_code = color_code&lt;br /&gt;
      @comment = comments&lt;br /&gt;
      @vm_prompts = vmprompts&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
New code: We added an instance variable to keep track of response_id&lt;br /&gt;
&lt;br /&gt;
    def initialize(score_value, color_code, comments, vmprompts = nil, response_id)&lt;br /&gt;
      ...&lt;br /&gt;
      @response_id = response_id&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''D.2: '''Added a method reviewer_id to the class VmQuestionResponseScoreCell: This helper method retrieves the ID for the reviewer who created this response.&lt;br /&gt;
&lt;br /&gt;
    def reviewer_id&lt;br /&gt;
      resp = Response.find(@response_id)&lt;br /&gt;
      map = ResponseMap.find(resp.map_id)&lt;br /&gt;
      map.reviewer_id&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
====E. In app/views/grades/_add_icon_to_name.html.erb:====&lt;br /&gt;
&lt;br /&gt;
'''E.1 '''Added the following code to the file: Write the code to generate the review text only once to reduce WET code&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;%# Determine the content of the reviewed by text %&amp;gt;&lt;br /&gt;
    &amp;lt;% review_text = &amp;quot;&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% if @current_role_name.eql?'Student' or questionnaire_type != &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
      &amp;lt;%# Use Review {{index}} format for student view, and when questionnaire_type is not teammatereview %&amp;gt;&lt;br /&gt;
      &amp;lt;% review_text = &amp;quot;Review #{i + 1}&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;% resp = Response.find(review.id) %&amp;gt;&lt;br /&gt;
      &amp;lt;% map = ResponseMap.find(resp.map_id) %&amp;gt;&lt;br /&gt;
      &amp;lt;% reviewer_id = map.reviewer_id %&amp;gt;&lt;br /&gt;
      &amp;lt;% fullname = Participant.find_by(id: reviewer_id).fullname(session[:ip]) %&amp;gt;&lt;br /&gt;
      &amp;lt;% review_text = &amp;quot;Review by #{fullname}&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% end%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''E.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code is very unreadable as it's not indented, and written in a single line with 359 characters, which breaks the ruby style guide rules&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;% if review.done_by_staff_participant? %&amp;gt;&lt;br /&gt;
      &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt; &amp;lt;img data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Icon indicates this review was done by course staff&amp;quot; class=&amp;quot;img_icon&amp;quot; src=&amp;quot;/assets/staff.png&amp;quot;&amp;gt; &amp;lt;a target=&amp;quot;_blank&amp;quot; href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Click to see details&amp;quot;&amp;gt;&amp;lt;%= &amp;quot;Review &amp;quot; + i.to_s  %&amp;gt;&amp;lt;/a&amp;gt; &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt; &amp;lt;a target=&amp;quot;_blank&amp;quot; href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Click to see details&amp;quot;&amp;gt;&amp;lt;%= &amp;quot;Review &amp;quot; + i.to_s %&amp;gt;&amp;lt;/a&amp;gt;  &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Correctly indented and removes WET repetition of code blocks and makes the resulting code DRYer&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;% if review.done_by_staff_participant? %&amp;gt;&lt;br /&gt;
      &amp;lt;img&lt;br /&gt;
      data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
      data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
      title=&amp;quot;Icon indicates this review was done by course staff&amp;quot; class=&amp;quot;img_icon&amp;quot;&lt;br /&gt;
      src=&amp;quot;/assets/staff.png&amp;quot;&lt;br /&gt;
      &amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;a&lt;br /&gt;
      target=&amp;quot;_blank&amp;quot;&lt;br /&gt;
      href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;&lt;br /&gt;
      data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
      data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
      title=&amp;quot;Click to see details&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;%= review_text %&amp;gt;&lt;br /&gt;
    &amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====F.In app/views/grades/view_team.html.erb:====&lt;br /&gt;
&lt;br /&gt;
'''F.1: '''Added function teammateSelectOnChange: This function toggles the visibility for the teammate heatgrids when the instructor changes the dropdown&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  function teammateSelectOnChange(selectNode) {&lt;br /&gt;
      const revieweeIdToShow= selectNode.value;&lt;br /&gt;
      const tableSelector = &amp;quot;.teammate_table&amp;quot;;&lt;br /&gt;
      if(revieweeIdToShow == &amp;quot;all&amp;quot;) {&lt;br /&gt;
        document.querySelectorAll(tableSelector).forEach((tableNode) =&amp;gt; {&lt;br /&gt;
          tableNode.classList.remove(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
        });&lt;br /&gt;
        return;&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
    document.querySelectorAll(tableSelector).forEach((tableNode) =&amp;gt; {&lt;br /&gt;
      const tableRevieweeId = tableNode.getAttribute('data-reviewee_id');&lt;br /&gt;
      if(tableRevieweeId == revieweeIdToShow) {&lt;br /&gt;
        tableNode.classList.remove(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
      } else {&lt;br /&gt;
        tableNode.classList.add(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
      }&lt;br /&gt;
      });&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't render TeammateReviewQuestionnaire&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;% @vmlist.each do |vm| %&amp;gt;&lt;br /&gt;
        &amp;lt;% if (vm.questionnaire_display_type == &amp;quot;Metareview&amp;quot; or vm.questionnaire_display_type == &amp;quot;Author Feedback&amp;quot; or vm.questionnaire_display_type == &amp;quot;Teammate Review&amp;quot;) and @current_role_name.eql?'Student' %&amp;gt;&lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
        &amp;lt;% if vm.list_of_reviewers.length &amp;gt; 0 %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Use a boolean to render a dropdown just before the first TeammateReviewQuestionnaire, and unset that boolean so we only render 1 table. Add conditions which check for the truthiness of ```@assignment.show_teammate_reviews``` and if the current user is a student to decide whether to render the table or not. Finally, add a CSS class and a `data-reviewee_id` to keep track of the heatgrids when toggling visibility&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;%# This boolean is used to render a dropdown just before the first teammate review heat grid %&amp;gt;&lt;br /&gt;
&amp;lt;% first_teammate_review_appeared = false %&amp;gt;&lt;br /&gt;
&amp;lt;% @vmlist.each do |vm| %&amp;gt;&lt;br /&gt;
    &amp;lt;% if not @current_role_name.eql?'Student' and not first_teammate_review_appeared and vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        &amp;lt;select onchange=&amp;quot;teammateSelectOnChange(this)&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;all&amp;quot;&amp;gt;All&amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;% @vmlist.select { |tm_vm| tm_vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; }.each do |tm_vm| %&amp;gt;&lt;br /&gt;
            &amp;lt;option value=&amp;quot;&amp;lt;%= tm_vm.reviewee_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;%= tm_vm.reviewee_name(session[:ip]) %&amp;gt;&lt;br /&gt;
            &amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
        &amp;lt;/select&amp;gt;&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;% first_teammate_review_appeared = true %&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;% if (vm.questionnaire_display_type == &amp;quot;Metareview&amp;quot; or vm.questionnaire_display_type == &amp;quot;Author Feedback&amp;quot;) and @current_role_name.eql?'Student' %&amp;gt;&lt;br /&gt;
    &amp;lt;% elsif (vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; and @current_role_name.eql?'Student' and !@assignment.show_teammate_reviews)%&amp;gt;&lt;br /&gt;
    &amp;lt;% elsif (vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; and @current_role_name.eql?'Student' and @assignment.show_teammate_reviews and current_user.id != vm.reviewee_id )%&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
        &amp;lt;% if vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
          &amp;lt;div class=&amp;quot;teammate_table&amp;quot; data-reviewee_id=&amp;quot;&amp;lt;%= vm.reviewee_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
        &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.3  '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't print the teammate who is being reviewed.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
          &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
            &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: If TeammteReviewQuestionnaire is used, then use the `:reviewee_name` method for VmQuestionResponse model to print the name of the student who is being reviewed.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
          &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
            &amp;lt;% elsif vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (For: &amp;lt;%= vm.reviewee_name(session[:ip]) %&amp;gt;)&lt;br /&gt;
            &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.4 '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't inform the partial about the type of review being done&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_reviews.each do |review| %&amp;gt;&lt;br /&gt;
              &amp;lt;!-- instructors (or higher level users) see reviewer name, students see anonymized string --&amp;gt;&lt;br /&gt;
              &amp;lt;% if (['Student'].include? @current_role_name) &amp;amp;&amp;amp; @assignment.is_anonymous%&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i} %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                  &amp;lt;% user_name = User.find(Participant.find(ResponseMap.find(Response.find(review.id).map_id).reviewer_id).user_id).fullname(session[:ip]).to_s %&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i} %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% i += 1 %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
New code: Passes the type of review being done to the partial, so it can decide on how to render the review title. Note: This code seems to use repetition, but since the conditional used here are accessing `Anonymous` assignments and checking for user roles, we have not modified this code, as it is not directly related to our scope.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_reviews.each do |review| %&amp;gt;&lt;br /&gt;
              &amp;lt;!-- instructors (or higher level users) see reviewer name, students see anonymized string --&amp;gt;&lt;br /&gt;
              &amp;lt;% if (['Student'].include? @current_role_name) &amp;amp;&amp;amp; @assignment.is_anonymous%&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i, questionnaire_type: vm.questionnaire_type } %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                &amp;lt;% user_name = User.find(Participant.find(ResponseMap.find(Response.find(review.id).map_id).reviewer_id).user_id).fullname(session[:ip]).to_s %&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i, questionnaire_type: vm.questionnaire_type } %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% i += 1 %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Old code: Contains a `metrics-` column&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-true&amp;quot; align=&amp;quot;right&amp;quot; &amp;gt;&lt;br /&gt;
            Avg&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;span  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;A count of comments, for the respective question, which have word count &amp;gt; 10. The purpose of this metric is to represent how many comments for the question are of a substantial length to provide quality feedback.&amp;quot;&amp;gt;metric-1&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/thead&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
New code: As per discussion with mentor, this column has been removed in our PR.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-true&amp;quot; align=&amp;quot;right&amp;quot; &amp;gt;&lt;br /&gt;
            Avg&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/thead&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.5 '''&lt;br /&gt;
&lt;br /&gt;
Old code: It creates the ID inline in multiple places, so if we decide to change the ID generation logic, we need to modify it in multiple places. (which happened when we started rendering multiple tables for each teammate).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_rows.each do |row| %&amp;gt;&lt;br /&gt;
            &amp;lt;!-- notice the data-target. because we're toggling via looped code, we need to dynamically generate the identifier. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr data-toggle=&amp;quot;collapse&amp;quot; class=&amp;quot;accordion-toggle&amp;quot; data-target=&amp;quot;#hid&amp;lt;%= row.question_id.to_s + vm.round.to_s %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;td class = 'cf' data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= row.question_text %&amp;gt;&amp;quot;&amp;gt; &amp;lt;div style='float: left'&amp;gt;&amp;lt;%= j.to_s %&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div style='float: right'&amp;gt; &amp;amp;#&amp;lt;%= type_and_max(row) %&amp;gt;;&amp;lt;/div&amp;gt;  &amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Generate the unique HTML ID once, in a readable manner once. And conditionally make it more unique, if it is a TeammateReviewQuestionnaire, since jQuery code requires these IDs to be unique amongst different tables. If we don't make it more unique, then clicking on one teammate review table will toggle the table visibility for the first table. To prevent this &amp;quot;clashing&amp;quot;, we need to make these IDs more unique for a TeammateReviewQuestionnaire.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_rows.each do |row| %&amp;gt;&lt;br /&gt;
            &amp;lt;% target_id = &amp;quot;hid__#{row.question_id}__#{vm.round}&amp;quot; %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
              &amp;lt;%# Since we render different heatgrids with the same questions for each&lt;br /&gt;
              teammember, we need to distinguish the ID, based on the user for whom,&lt;br /&gt;
              the reviews have been created. %&amp;gt;&lt;br /&gt;
              &amp;lt;% target_id += &amp;quot;__#{vm.reviewee_id}&amp;quot; %&amp;gt;&lt;br /&gt;
            &amp;lt;% end%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;!-- notice the data-target. because we're toggling via looped code, we need to dynamically generate the identifier. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr data-toggle=&amp;quot;collapse&amp;quot; class=&amp;quot;accordion-toggle&amp;quot; data-target=&amp;quot;&amp;lt;%= &amp;quot;#&amp;quot; + target_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Old code: Written on a single line crossing 80 characters on a single line&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
              &amp;lt;% row.score_row.each do |score| %&amp;gt;&lt;br /&gt;
                  &amp;lt;% score_comment = score.comment.nil? ? '' : score.comment %&amp;gt; &amp;lt;!-- changing nil to null string to avoid Null Pointer Exception --&amp;gt;&lt;br /&gt;
                  &amp;lt;td class=&amp;quot;&amp;lt;%= score.color_code %&amp;gt;&amp;quot; align=&amp;quot;center&amp;quot; data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= strip_tags(score.comment).html_safe%&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;&amp;lt;%=  underlined?(score) %&amp;gt;&amp;quot;&amp;gt;&amp;lt;%= score.score_value.to_s %&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
                  &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
New code: Make code more readable by indenting it and splitting it over multiple lines&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
              &amp;lt;!-- actual cells with scores and colored background. --&amp;gt;&lt;br /&gt;
              &amp;lt;% row.score_row.each do |score| %&amp;gt;&lt;br /&gt;
                  &amp;lt;% score_comment = score.comment.nil? ? '' : score.comment %&amp;gt;&lt;br /&gt;
                  &amp;lt;!-- changing nil to null string to avoid Null Pointer Exception --&amp;gt;&lt;br /&gt;
                  &amp;lt;td class=&amp;quot;&amp;lt;%= score.color_code %&amp;gt;&amp;quot; align=&amp;quot;center&amp;quot; data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= strip_tags(score.comment).html_safe%&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;&amp;lt;%=  underlined?(score) %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                      &amp;lt;%= score.score_value.to_s %&amp;gt;&lt;br /&gt;
                    &amp;lt;/span&amp;gt;&lt;br /&gt;
                  &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.6 '''Removed the following code as it corresponds to the deleted column&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 &amp;lt;td  class = 'cf' align=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;%= row.countofcomments.to_s %&amp;gt;&lt;br /&gt;
              &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.7 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!--loop that creates the collapsed-by-default row, which lists all comments. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr class=&amp;quot;tablesorter-childRow&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;td colspan=&amp;quot;&amp;lt;%= (i+1).to_s %&amp;gt;&amp;quot; class=&amp;quot;hiddenRow&amp;quot; &amp;gt;&amp;lt;div id=&amp;quot;hid&amp;lt;%= row.question_id.to_s + vm.round.to_s %&amp;gt;&amp;quot; class=&amp;quot;accordion-body collapse&amp;quot; style=&amp;quot;margin-left:10px;&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;div style=&amp;quot;padding-top: 10px; padding-bottom: 10px;&amp;quot;&amp;gt;&amp;lt;%=  sanitize row.question_text %&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;div&amp;gt;&lt;br /&gt;
                  &amp;lt;table class=&amp;quot;table tbl_questlist&amp;quot;&amp;gt;&lt;br /&gt;
@@ -181,7 +233,17 @@&lt;br /&gt;
                    &amp;lt;/thead&amp;gt;&lt;br /&gt;
                    &amp;lt;% for index in 0 .. row.score_row.length - 1 %&amp;gt;&lt;br /&gt;
                        &amp;lt;tr&amp;gt;&lt;br /&gt;
                          &amp;lt;td&amp;gt;Review &amp;lt;%=index + 1%&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!--loop that creates the collapsed-by-default row, which lists all comments. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr class=&amp;quot;tablesorter-childRow&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;td colspan=&amp;quot;&amp;lt;%= (i+1).to_s %&amp;gt;&amp;quot; class=&amp;quot;hiddenRow&amp;quot; &amp;gt;&amp;lt;div id=&amp;quot;&amp;lt;%= target_id %&amp;gt;&amp;quot; class=&amp;quot;accordion-body collapse&amp;quot; style=&amp;quot;margin-left:10px;&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;div style=&amp;quot;padding-top: 10px; padding-bottom: 10px;&amp;quot;&amp;gt;&amp;lt;%=  sanitize row.question_text %&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;div&amp;gt;&lt;br /&gt;
                  &amp;lt;table class=&amp;quot;table tbl_questlist&amp;quot;&amp;gt;&lt;br /&gt;
@@ -181,7 +233,17 @@&lt;br /&gt;
                    &amp;lt;/thead&amp;gt;&lt;br /&gt;
                    &amp;lt;% for index in 0 .. row.score_row.length - 1 %&amp;gt;&lt;br /&gt;
                        &amp;lt;tr&amp;gt;&lt;br /&gt;
                          &amp;lt;% if @current_role_name.eql?'Student' or vm.questionnaire_type != &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                            &amp;lt;%# Use Review {{index}} format for student view, and&lt;br /&gt;
                            when questionnaire_type is not teammatereview %&amp;gt;&lt;br /&gt;
                            &amp;lt;td&amp;gt;Review &amp;lt;%=index + 1%&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
                          &amp;lt;% else %&amp;gt;&lt;br /&gt;
                            &amp;lt;td&amp;gt;&lt;br /&gt;
                              &amp;lt;% reviewer_id = row.score_row[index].reviewer_id %&amp;gt;&lt;br /&gt;
                              &amp;lt;% fullname = Participant.find_by(id: reviewer_id).fullname(session[:ip]) %&amp;gt;&lt;br /&gt;
                              Review by &amp;lt;%= fullname %&amp;gt;&lt;br /&gt;
                            &amp;lt;/td&amp;gt;&lt;br /&gt;
                          &amp;lt;% end%&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====G. In spec/controllers/grades_controller_spec.rb:====&lt;br /&gt;
&lt;br /&gt;
'''G.1 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
before(:each) do&lt;br /&gt;
  allow(AssignmentParticipant).to receive(:find).with('1').and_return(participant)&lt;br /&gt;
  allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
  stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
@@ -91,29 +90,106 @@&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
before(:each) do&lt;br /&gt;
  allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
  stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
@@ -91,29 +90,106 @@&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''G.2 '''Remove xdescribe '#view_team' and change describe '#view_team' as follows.&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#view_team' do&lt;br /&gt;
render_views&lt;br /&gt;
context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
  it 'renders grades#view_team page' do&lt;br /&gt;
    allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
    allow(AssignmentQuestionnaire).to receive(:find_by).with(assignment_id: 1, questionnaire_id: 1).and_return(assignment_questionnaire)&lt;br /&gt;
    allow(AssignmentQuestionnaire).to receive(:where).with(any_args).and_return([assignment_questionnaire])&lt;br /&gt;
    allow(assignment).to receive(:late_policy_id).and_return(false)&lt;br /&gt;
    allow(assignment).to receive(:calculate_penalty).and_return(false)&lt;br /&gt;
    allow(assignment).to receive(:compute_total_score).with(any_args).and_return(100)&lt;br /&gt;
    allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
    allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
    params = {id: 1}&lt;br /&gt;
    allow(TaMapping).to receive(:exists?).with(ta_id: 1, course_id: 1).and_return(true)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#view_team' do&lt;br /&gt;
render_views&lt;br /&gt;
&lt;br /&gt;
# All stubs and factories are instantiated within this scope so as to not &lt;br /&gt;
# clash with other broken test.&lt;br /&gt;
# The names of the factories created for testing view_team&lt;br /&gt;
# have `_vt` suffix ```where necessary``` to differentiate them from &lt;br /&gt;
# the above declared factories&lt;br /&gt;
&lt;br /&gt;
let(:student1_vt) { create(:student, name: &amp;quot;barry&amp;quot;, id: 12) }&lt;br /&gt;
let(:student2_vt) { create(:student, name: &amp;quot;iris&amp;quot;, id: 13) }&lt;br /&gt;
&lt;br /&gt;
let(:tm_questionnaire) {&lt;br /&gt;
  build(&lt;br /&gt;
    :teammate_review_questionnaire,&lt;br /&gt;
    id: 12,&lt;br /&gt;
    questions: [question],&lt;br /&gt;
    max_question_score: 5&lt;br /&gt;
  )&lt;br /&gt;
}&lt;br /&gt;
let(:assignment_vt) {&lt;br /&gt;
  create(:assignment, id: 6, max_team_size: 2,&lt;br /&gt;
  questionnaires: [tm_questionnaire])&lt;br /&gt;
}&lt;br /&gt;
let(:assignment_questionnaire_vt) {&lt;br /&gt;
  create(:tm_assignment_questionnaire, id: 12, used_in_round: nil,&lt;br /&gt;
  assignment: assignment_vt, questionnaire: tm_questionnaire) }&lt;br /&gt;
let(:team_vt) { create(:assignment_team, id: 12,&lt;br /&gt;
assignment: assignment_vt) }&lt;br /&gt;
let(:participant_vt) { create(:participant, id: 12,&lt;br /&gt;
  assignment: assignment_vt, user_id: student1_vt.id) }&lt;br /&gt;
let(:participant2_vt) { create(:participant, id: 13,&lt;br /&gt;
  assignment: assignment_vt, user_id: student2_vt.id) }&lt;br /&gt;
&lt;br /&gt;
before(:each) do&lt;br /&gt;
  # Need to stub this method so the factory instance with&lt;br /&gt;
  # the stubbed :team method is returned by :find&lt;br /&gt;
  # instead of a separate instance with the same data&lt;br /&gt;
  allow(AssignmentParticipant)&lt;br /&gt;
    .to receive(:find)&lt;br /&gt;
    .with(participant_vt.id.to_s)&lt;br /&gt;
    .and_return(participant_vt)&lt;br /&gt;
  allow(participant_vt).to receive(:team).and_return(team_vt)&lt;br /&gt;
  allow(team_vt).to receive(:participants).and_return([participant_vt, participant2_vt])&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:find_by)&lt;br /&gt;
    .with(assignment_id: assignment_vt.id, questionnaire_id: tm_questionnaire.id)&lt;br /&gt;
    .and_return(assignment_questionnaire_vt)&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:find_by)&lt;br /&gt;
    .with(assignment_id: assignment.id, questionnaire_id: review_questionnaire.id)&lt;br /&gt;
    .and_return(assignment_questionnaire_vt)&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:where)&lt;br /&gt;
    .with(any_args)&lt;br /&gt;
    .and_return([assignment_questionnaire_vt])&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:late_policy_id)&lt;br /&gt;
    .and_return(false)&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:calculate_penalty)&lt;br /&gt;
    .and_return(false)&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:compute_total_score)&lt;br /&gt;
    .with(any_args)&lt;br /&gt;
    .and_return(100)&lt;br /&gt;
  allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
  allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
 it 'renders grades#view_team page' do&lt;br /&gt;
  params = {id: participant_vt.id}&lt;br /&gt;
  get :view_team, params&lt;br /&gt;
  expect(response).to render_template(:view_team)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is opened by student' do&lt;br /&gt;
  it 'dropdown is not rendered' do&lt;br /&gt;
    session = { user: student1_vt }&lt;br /&gt;
    params = {id: participant_vt.id}&lt;br /&gt;
    stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
    get :view_team, params&lt;br /&gt;
    expect(response.body).to_not have_selector('select')&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is opened by instructor' do&lt;br /&gt;
  it 'dropdown is rendered' do&lt;br /&gt;
    session = { user: instructor }&lt;br /&gt;
    params = {id: participant_vt.id}&lt;br /&gt;
    get :view_team, params&lt;br /&gt;
    expect(response.body).to have_selector('select')&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
  it 'renders grades#view_team page' do&lt;br /&gt;
    params = { id: participant_vt.id }&lt;br /&gt;
    allow(TaMapping).to receive(:exists?).with(ta_id: participant_vt.user_id, course_id: 1).and_return(true)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====H. In spec/factories/factories.rb:====&lt;br /&gt;
&lt;br /&gt;
'''H.1 '''Add the following factory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
factory :teammate_review_questionnaire, class: TeammateReviewQuestionnaire do&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''H.2 '''Add another factory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
factory :tm_assignment_questionnaire, class: AssignmentQuestionnaire do&lt;br /&gt;
  user_id 1&lt;br /&gt;
  questionnaire { association(:teammate_review_questionnaire) }&lt;br /&gt;
  questionnaire_weight 100&lt;br /&gt;
  used_in_round nil&lt;br /&gt;
  topic_id nil&lt;br /&gt;
  dropdown 1&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
'''OLD STATUS'''&lt;br /&gt;
&lt;br /&gt;
1. Earlier, the tests only covered if the view_team is page is rendered when it is asked for. This can be seen on the line 94 and 103 in [https://github.com/expertiza/expertiza/blob/beta/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''NEW STATUS'''&lt;br /&gt;
&lt;br /&gt;
1. The view_team page is rendered correctly for a given student or an instructor.&lt;br /&gt;
&lt;br /&gt;
2. When students access then the view_team page, the dropdown to select a student's teammate reviews is not rendered on the page.&lt;br /&gt;
&lt;br /&gt;
3. When instructor access then the view_team page, the dropdown to select a student's teammate reviews is rendered on the page.&lt;br /&gt;
&lt;br /&gt;
4. When a student who is also a TA for another course access the view_team page, that student should be able to a student's view to the page.&lt;br /&gt;
&lt;br /&gt;
5. If show_teammate_reviews boolean is set to False, then the student should not be able to see the teammate reviews given to him/her. If it is set to True, then the student should be able to see the reviews.&lt;br /&gt;
&lt;br /&gt;
6. An instructor should be able to see the teammate reviews for all students regardless of whether the show_teammate_reviews boolean is set to True or False.&lt;br /&gt;
&lt;br /&gt;
7. The reviewer id is tracked correctly to show the correct reviewer name in the teammate reviews table. This can be seen on line 27 in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/models/vm_question_response_score_cell_spec.rb this] file &lt;br /&gt;
&lt;br /&gt;
8. An instructor can select which student's scores he/she wants to see. If no student's name is selected then the professor can see the scores of all the students.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Summary of file changes ==&lt;br /&gt;
&lt;br /&gt;
The following files are modified:&lt;br /&gt;
&lt;br /&gt;
1. app/controllers/grades_controller.rb - Controller file which changed how the view model is populated&lt;br /&gt;
&lt;br /&gt;
2. app/views/grades/view_team.html.erb - View file, which  conditionally rendered the teammate name, for a teammate review heatgrid&lt;br /&gt;
&lt;br /&gt;
3. spec/controllers/grades_controller_spec.rb - For tests verifying the proposed changes&lt;br /&gt;
&lt;br /&gt;
4. app/models/vm_question_response.rb - To modify the view-model so it can tell us the name of the person being reviewed for the current heatgrid&lt;br /&gt;
&lt;br /&gt;
5. app/models/vm_question_response_score_cell.rb - &lt;br /&gt;
&lt;br /&gt;
6. app/assets/stylesheets/grades.scss - &lt;br /&gt;
&lt;br /&gt;
7. app/views/grades/_add_icon_to_name.html.erb - &lt;br /&gt;
&lt;br /&gt;
8. spec/factories/factories.rb -&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Design Patterns ==&lt;br /&gt;
&lt;br /&gt;
Existing code does not use any design patterns, apart from if-else. It uses if-else conditional statements to check what type of questionnaire is present in the viewmodel `VmQuestionResponse`, and based on that, it renders the appropriate content.&lt;br /&gt;
&lt;br /&gt;
We decided to continue with this approach since to change the present coding style, there were required many changes (refactoring) to many files which were out of the scope of the present project. To complete the project in the assigned time, we followed the if-else approach.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;https://expertiza.ncsu.edu/&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Agarg25</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Vie_team_use_case.png&amp;diff=141747</id>
		<title>File:Vie team use case.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Vie_team_use_case.png&amp;diff=141747"/>
		<updated>2021-11-28T18:49:28Z</updated>

		<summary type="html">&lt;p&gt;Agarg25: Agarg25 uploaded a new version of File:Vie team use case.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Agarg25</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Vie_team_use_case.png&amp;diff=141746</id>
		<title>File:Vie team use case.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Vie_team_use_case.png&amp;diff=141746"/>
		<updated>2021-11-28T18:48:42Z</updated>

		<summary type="html">&lt;p&gt;Agarg25: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Agarg25</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141744</id>
		<title>CSC/ECE 517 Fall 2021 - E2165. Fix teammate-review view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141744"/>
		<updated>2021-11-28T18:30:19Z</updated>

		<summary type="html">&lt;p&gt;Agarg25: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Introduction ==&lt;br /&gt;
&lt;br /&gt;
Dr. Edward Gehringer (instructor), Parimal Mehta (mentor)&lt;br /&gt;
&lt;br /&gt;
1. Anjali Garg (unity ID : agarg25)&lt;br /&gt;
&lt;br /&gt;
2. Arvasu Chikara (unity ID: achikar2)&lt;br /&gt;
&lt;br /&gt;
3. Lalit Bangad (unity ID: llbangad)&lt;br /&gt;
&lt;br /&gt;
4. Vinay Deshmukh (unity ID: vdeshmu)&lt;br /&gt;
&lt;br /&gt;
== Problems to be addressed ==&lt;br /&gt;
&lt;br /&gt;
After a project is submitted and reviewed, both the team members (students) and instructors should be able to view the teammate reviews. Students should be able to view the reviews by going to a particular assignment's -&amp;gt; your scores, at the bottom of the page. An instructor can view the teammate reviews by going to assignments -&amp;gt; assignment -&amp;gt; particular team's submission -&amp;gt; view submission -&amp;gt; assign grades -&amp;gt; view scores. &lt;br /&gt;
&lt;br /&gt;
In the case of the instructor, a single heat grid is shown whereas in the case of a team member, we cant view the scores. In the heat grid, it is not clear if the scores visible are for the reviews that the student has *written* for their teammates or the scores that the student has *received* from their teammates. Additionally, for instructors can choose from a list of the students on the team, but they have no way to tell whether the heat grid shows the reviews done *by* that student or done *for* that student.&lt;br /&gt;
&lt;br /&gt;
== Methodology Overview ==&lt;br /&gt;
&lt;br /&gt;
We have divided our work in the following tasks to address the above problems:&lt;br /&gt;
&lt;br /&gt;
1. Distinguish reviews done for a student by rendering separates heatgrids for each student&lt;br /&gt;
&lt;br /&gt;
2. For instructors, the table will have sections based on the students&lt;br /&gt;
&lt;br /&gt;
3. Include a checkbox on the edit assignment page that enables/disables visibility of heat grid to students&lt;br /&gt;
&lt;br /&gt;
4. Fix the average column for a table (which breaks for some reviews)&lt;br /&gt;
&lt;br /&gt;
5. Show a composite score derived from all reviews.  Make this code generalized, so other kinds of heat grid views could use it.&lt;br /&gt;
&lt;br /&gt;
6. Changes should work even in an anonymized view&lt;br /&gt;
&lt;br /&gt;
== Motivations ==&lt;br /&gt;
&lt;br /&gt;
1. Enable users to clearly tell which reviews are done by them, and which reviews are done for them.&lt;br /&gt;
&lt;br /&gt;
2. Code should be generic so it can be used for different types of heat grids as well.&lt;br /&gt;
&lt;br /&gt;
== Control Flow to access the concerned screens ==&lt;br /&gt;
'''1. For instructor (Log in as an instructor):-'''&lt;br /&gt;
&lt;br /&gt;
Screen after logging in by the instructor&lt;br /&gt;
[[File:ss1.png |border|1000px|center]]&lt;br /&gt;
Got to assignments on the Manage menu &lt;br /&gt;
[[File:ss2.png |border|1000px|center]]&lt;br /&gt;
Go to assignments&lt;br /&gt;
[[File:ss3.png |border|1000px|center]]&lt;br /&gt;
Go to submissions for any assignment&lt;br /&gt;
[[File:ss4a.png |border|1000px|center]]&lt;br /&gt;
Go to Assign Grade&lt;br /&gt;
[[File:ss5a.png |border|1000px|center]]&lt;br /&gt;
You will land on the page where the changes are made and can be reviewed&lt;br /&gt;
[[File:ss7a.png |border|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
'''2. Student:- (Logged in as an instructor)'''&lt;br /&gt;
&lt;br /&gt;
After landing on the assignments page, select any student from an assignment as shown below&lt;br /&gt;
[[File:ss6a.png |border|1000px|center]]&lt;br /&gt;
Go to/Select any assignment&lt;br /&gt;
[[File:ss9a.png |border|1000px|center]]&lt;br /&gt;
Go to your scores&lt;br /&gt;
[[File:ss10a.png |border|1000px|center]]&lt;br /&gt;
You will land on the page where the changes are made and can be reviewed&lt;br /&gt;
[[File:ss11a.png |border|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
== Old Status of the application ==&lt;br /&gt;
&lt;br /&gt;
'''1. Instructor's view of teammate review''': This is the current screen given to the instructor. Here we see that the instructor can not determine who has given which review to which student in a team.&lt;br /&gt;
&lt;br /&gt;
[[File:Instructor-view-1.png|border| 700px |center|alt=The proposed expanded student display.|The proposed expanded student display.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2. Student's view of teammate review''': Currently, a student is not able to see what grades were given by their teammates. We need to implement that functionality so that the student is able to view those grades.&lt;br /&gt;
&lt;br /&gt;
[[File:Student-view-2.png|border| 700px |center|alt=The current instructor view.|The current review display for instructors.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Error in existing UI for student''': In the existing UI for a student, the highlighted block should not be rendered. This part of the screen is meant for the instructors/TAs. &lt;br /&gt;
&lt;br /&gt;
[[File:Wrong render for student.png|border|700px|center|alt=Existing UI for student|Existing UI for student.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Proposed changes ==&lt;br /&gt;
&lt;br /&gt;
''' 1) Proposed UI for instructor ''': The instructor is able to see the score for all teammates. In the existing code, only one teammate's scores are being shown. But, we are planning to change the way the (VmQuestionResponse array is populated)[https://github.com/expertiza/expertiza/blob/master/app/controllers/grades_controller.rb#L114], so that the scores for all teammates are appended to it so it correctly shows what should have already been shown in this screen for the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Proposed_screen.png|border|700px|center|alt=Proposed UI for instructor|Proposed UI for instructor.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: When a student visits this screen, they will only be shown the reviews received by them, assuming the instructor has allowed visibility of teammate reviews to students.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' 2) Show detailed review for a particular question''': The instructor can see detailed review given to a student by their teammates by clicking on a particular question number in the table.&lt;br /&gt;
&lt;br /&gt;
[[File:ss12a.png|border|700px|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' 3) Show teammate review to student UI ''': The existing code doesn't render a student's teammate review scores at all. We are planning to render the scores to a student (as shown below) when they visit this screen. However, the visibility of this screen is contingent on whether the instructor has allowed visibility of the teammate review screen to students. If the instructor has disabled this feature, then the heatgrid will not be displayed at all.&lt;br /&gt;
&lt;br /&gt;
[[File:UI_for_student.png|border|700px|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
== User Stories ==&lt;br /&gt;
&lt;br /&gt;
1. As an instructor, I can view what reviews one teammate has given to other teammates.&lt;br /&gt;
&lt;br /&gt;
2. As a student, I can view what reviews my teammates have given to me.&lt;br /&gt;
&lt;br /&gt;
3. As an instructor, I can choose if I want to see all student's teammates reviews together or one by one.&lt;br /&gt;
&lt;br /&gt;
4. As a student, if I am also a TA for another subject, I should not be able to see an instructor's view to the view_team page.&lt;br /&gt;
&lt;br /&gt;
5. As an instructor, I should be able to see the name of the reviewers for the reviews to a particular student.&lt;br /&gt;
&lt;br /&gt;
== Use case diagram for the system ==  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Models used / Explanation of fixes ==&lt;br /&gt;
&lt;br /&gt;
The below diagram illustrates the proposed code change for showing all team members with the teammate review data to an instructor. The existing code only iterated on the `Participant` whose ID is present in the URL of the page. To fix this, we will iterate over all teammates of the given participant so that all teammate reviews for all team members are shown to the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Logic e2165.png|border|center|alt=Flow diagram of proposed changes for showing team review data to instructor]]&lt;br /&gt;
&lt;br /&gt;
===Changes made to the code are shown below. Every change is shown and explained separately===&lt;br /&gt;
&lt;br /&gt;
====A. Added the following to app/assets/stylesheets/grades.scss:====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    .teammate_table.hidden {&lt;br /&gt;
      display: none;&lt;br /&gt;
      }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====B. In app/controllers/grades_controller.rb: ====&lt;br /&gt;
&lt;br /&gt;
'''B.1:'''&lt;br /&gt;
&lt;br /&gt;
Old code: The existing code does not differentiate when adding a view model for the TeammateReview questionnaire&lt;br /&gt;
  questionnaires.each do |questionnaire|&lt;br /&gt;
     ...&lt;br /&gt;
     @vmlist &amp;lt;&amp;lt; populate_view_model(questionnaire)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
New code: Since the current page URL contains an ID for the participant, from which we get an assignment, which gives us a list of questionnaires, we need to iterate all participants for a `TeammateReveiwQuestionnaire` questionnaire, so that we get the heatgrid view models for all members of a team.&lt;br /&gt;
  questionnaires.each do |questionnaire|&lt;br /&gt;
     ...&lt;br /&gt;
     if questionnaire.type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
        # as teammate review will be different for each participant&lt;br /&gt;
        # we need to create a separate table for each teammate&lt;br /&gt;
        @participant.team.participants.each do |team_participant|&lt;br /&gt;
          @vmlist &amp;lt;&amp;lt; populate_view_model(team_participant, questionnaire, @team)&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        # only one participant needs iterating, as apart from teammatereview&lt;br /&gt;
        # all other reviews are at &amp;quot;team&amp;quot; level&lt;br /&gt;
        @vmlist &amp;lt;&amp;lt; populate_view_model(@participant, questionnaire, @team)&lt;br /&gt;
      end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
'''B.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code: This code uses @participant as an instance variable, but this structure will not work as we need to call this ViewModel with multiple participants when iterating for a teammate review questionnaire.&lt;br /&gt;
    def populate_view_model(questionnaire)&lt;br /&gt;
      vm = VmQuestionResponse.new(questionnaire, @assignment, @round)&lt;br /&gt;
      vmquestions = questionnaire.questions&lt;br /&gt;
      vm.add_questions(vmquestions)&lt;br /&gt;
      vm.add_team_members(@team)&lt;br /&gt;
      vm.add_reviews(@participant, @team, @assignment.vary_by_round)&lt;br /&gt;
      vm.number_of_comments_greater_than_10_words&lt;br /&gt;
      vm &lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
New code: We need to call this function with a separate participant in each invocation due to our change for TeammateReviewQuestionnaire, hence it makes sense to make `participant` as an argument to this function. Similarly, as `team` is a closely related model to `participant`, we are passing it as an argument, to keep this function as &amp;quot;pure&amp;quot; as possible.&lt;br /&gt;
    def populate_view_model(participant, questionnaire, team)&lt;br /&gt;
      ...&lt;br /&gt;
      vm.add_team_members(team)&lt;br /&gt;
      vm.add_reviews(participant, team, @assignment.vary_by_round)&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
====C. In app/models/vm_question_response.rb:====&lt;br /&gt;
&lt;br /&gt;
'''C.1: '''Added the reviewee_id method: Created a helper method within the VmQuestionReponse model to retrieve the `reviewee_id` for a heatgrid&lt;br /&gt;
&lt;br /&gt;
    def reviewee_id&lt;br /&gt;
      @participant_who_is_reviewee.user_id&lt;br /&gt;
    end &lt;br /&gt;
&lt;br /&gt;
'''C.2: '''Added the reviewee_name method: Created a helper method within the VmQuestionReponse model to retrieve the name of the student who is being reviewed for a heatgrid. This method uses the functionality to anonymize the name when we are in anonymized view.&lt;br /&gt;
&lt;br /&gt;
    def reviewee_name(ip_address = nil)&lt;br /&gt;
      part = @participant_who_is_reviewee&lt;br /&gt;
      User.find_by(id: part.user_id).fullname(ip_address)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''C.3: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Does not keep track of the student being reviewed&lt;br /&gt;
    elsif @questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
      reviews = participant.teammate_reviews&lt;br /&gt;
      reviews.each do |review|&lt;br /&gt;
        review_mapping = TeammateReviewResponseMap.find_by(id: review.map_id)&lt;br /&gt;
        participant = Participant.find(review_mapping.reviewer_id)&lt;br /&gt;
&lt;br /&gt;
New code: Add an instance variable to keep track of the student who is being reviewed in this VmQuestionReponse&lt;br /&gt;
    elsif @questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
      reviews = participant.teammate_reviews&lt;br /&gt;
      @participant_who_is_reviewee = participant&lt;br /&gt;
      reviews.each do |review|&lt;br /&gt;
        review_mapping = TeammateReviewResponseMap.find_by(id: review.map_id)&lt;br /&gt;
        participant = Participant.find(review_mapping.reviewer_id)&lt;br /&gt;
&lt;br /&gt;
'''C.4: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing VmQuestionReponseScoreCell keeps no information about the reviewer, as it only stores the answer score&lt;br /&gt;
    row.score_row.push(VmQuestionResponseScoreCell.new(answer.answer, color_code, answer.comments, vm_tag_prompts))&lt;br /&gt;
&lt;br /&gt;
New code: Keep track of the response ID, so that we can retrieve the user ID for the reviewer in the model to use in the view file.&lt;br /&gt;
    &lt;br /&gt;
    row.score_row.push(VmQuestionResponseScoreCell.new(answer.answer, color_code, answer.comments, vm_tag_prompts, answer.response_id))&lt;br /&gt;
&lt;br /&gt;
====D. In app/models/vm_question_response_score_cell.rb:====&lt;br /&gt;
&lt;br /&gt;
'''D.1: '''In the method initialize of class VmQuestionResponseScoreCell&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't keep track of the response id&lt;br /&gt;
    def initialize(score_value, color_code, comments, vmprompts = nil)&lt;br /&gt;
      @score_value = score_value&lt;br /&gt;
      @color_code = color_code&lt;br /&gt;
      @comment = comments&lt;br /&gt;
      @vm_prompts = vmprompts&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
New code: We added an instance variable to keep track of response_id&lt;br /&gt;
&lt;br /&gt;
    def initialize(score_value, color_code, comments, vmprompts = nil, response_id)&lt;br /&gt;
      ...&lt;br /&gt;
      @response_id = response_id&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''D.2: '''Added a method reviewer_id to the class VmQuestionResponseScoreCell: This helper method retrieves the ID for the reviewer who created this response.&lt;br /&gt;
&lt;br /&gt;
    def reviewer_id&lt;br /&gt;
      resp = Response.find(@response_id)&lt;br /&gt;
      map = ResponseMap.find(resp.map_id)&lt;br /&gt;
      map.reviewer_id&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
====E. In app/views/grades/_add_icon_to_name.html.erb:====&lt;br /&gt;
&lt;br /&gt;
'''E.1 '''Added the following code to the file: Write the code to generate the review text only once to reduce WET code&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;%# Determine the content of the reviewed by text %&amp;gt;&lt;br /&gt;
    &amp;lt;% review_text = &amp;quot;&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% if @current_role_name.eql?'Student' or questionnaire_type != &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
      &amp;lt;%# Use Review {{index}} format for student view, and when questionnaire_type is not teammatereview %&amp;gt;&lt;br /&gt;
      &amp;lt;% review_text = &amp;quot;Review #{i + 1}&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;% resp = Response.find(review.id) %&amp;gt;&lt;br /&gt;
      &amp;lt;% map = ResponseMap.find(resp.map_id) %&amp;gt;&lt;br /&gt;
      &amp;lt;% reviewer_id = map.reviewer_id %&amp;gt;&lt;br /&gt;
      &amp;lt;% fullname = Participant.find_by(id: reviewer_id).fullname(session[:ip]) %&amp;gt;&lt;br /&gt;
      &amp;lt;% review_text = &amp;quot;Review by #{fullname}&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% end%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''E.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code is very unreadable as it's not indented, and written in a single line with 359 characters, which breaks the ruby style guide rules&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;% if review.done_by_staff_participant? %&amp;gt;&lt;br /&gt;
      &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt; &amp;lt;img data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Icon indicates this review was done by course staff&amp;quot; class=&amp;quot;img_icon&amp;quot; src=&amp;quot;/assets/staff.png&amp;quot;&amp;gt; &amp;lt;a target=&amp;quot;_blank&amp;quot; href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Click to see details&amp;quot;&amp;gt;&amp;lt;%= &amp;quot;Review &amp;quot; + i.to_s  %&amp;gt;&amp;lt;/a&amp;gt; &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt; &amp;lt;a target=&amp;quot;_blank&amp;quot; href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Click to see details&amp;quot;&amp;gt;&amp;lt;%= &amp;quot;Review &amp;quot; + i.to_s %&amp;gt;&amp;lt;/a&amp;gt;  &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code: Correctly indented and removes WET repetition of code blocks and makes the resulting code DRYer&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;% if review.done_by_staff_participant? %&amp;gt;&lt;br /&gt;
      &amp;lt;img&lt;br /&gt;
      data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
      data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
      title=&amp;quot;Icon indicates this review was done by course staff&amp;quot; class=&amp;quot;img_icon&amp;quot;&lt;br /&gt;
      src=&amp;quot;/assets/staff.png&amp;quot;&lt;br /&gt;
      &amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;a&lt;br /&gt;
      target=&amp;quot;_blank&amp;quot;&lt;br /&gt;
      href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;&lt;br /&gt;
      data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
      data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
      title=&amp;quot;Click to see details&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;%= review_text %&amp;gt;&lt;br /&gt;
    &amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====F.In app/views/grades/view_team.html.erb:====&lt;br /&gt;
&lt;br /&gt;
'''F.1: '''Added function teammateSelectOnChange:&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  function teammateSelectOnChange(selectNode) {&lt;br /&gt;
      const revieweeIdToShow= selectNode.value;&lt;br /&gt;
      const tableSelector = &amp;quot;.teammate_table&amp;quot;;&lt;br /&gt;
      if(revieweeIdToShow == &amp;quot;all&amp;quot;) {&lt;br /&gt;
        document.querySelectorAll(tableSelector).forEach((tableNode) =&amp;gt; {&lt;br /&gt;
          tableNode.classList.remove(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
        });&lt;br /&gt;
        return;&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
  document.querySelectorAll(tableSelector).forEach((tableNode) =&amp;gt; {&lt;br /&gt;
    const tableRevieweeId = tableNode.getAttribute('data-reviewee_id');&lt;br /&gt;
    if(tableRevieweeId == revieweeIdToShow) {&lt;br /&gt;
      tableNode.classList.remove(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
    } else {&lt;br /&gt;
      tableNode.classList.add(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    });&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;% @vmlist.each do |vm| %&amp;gt;&lt;br /&gt;
        &amp;lt;% if (vm.questionnaire_display_type == &amp;quot;Metareview&amp;quot; or vm.questionnaire_display_type == &amp;quot;Author Feedback&amp;quot; or vm.questionnaire_display_type == &amp;quot;Teammate Review&amp;quot;) and @current_role_name.eql?'Student' %&amp;gt;&lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
        &amp;lt;% if vm.list_of_reviewers.length &amp;gt; 0 %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
​      &amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  @@ -87,6 +131,8 @@&lt;br /&gt;
              &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
                &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                    (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
        &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;%# This boolean is used to render a dropdown just before the first teammate review heat grid %&amp;gt;&lt;br /&gt;
&amp;lt;% first_teammate_review_appeared = false %&amp;gt;&lt;br /&gt;
&amp;lt;% @vmlist.each do |vm| %&amp;gt;&lt;br /&gt;
    &amp;lt;% if not @current_role_name.eql?'Student' and not first_teammate_review_appeared and vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        &amp;lt;select onchange=&amp;quot;teammateSelectOnChange(this)&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;all&amp;quot;&amp;gt;All&amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;% @vmlist.select { |tm_vm| tm_vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; }.each do |tm_vm| %&amp;gt;&lt;br /&gt;
            &amp;lt;option value=&amp;quot;&amp;lt;%= tm_vm.reviewee_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;%= tm_vm.reviewee_name(session[:ip]) %&amp;gt;&lt;br /&gt;
            &amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
        &amp;lt;/select&amp;gt;&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;% first_teammate_review_appeared = true %&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;% if (vm.questionnaire_display_type == &amp;quot;Metareview&amp;quot; or vm.questionnaire_display_type == &amp;quot;Author Feedback&amp;quot;) and @current_role_name.eql?'Student' %&amp;gt;&lt;br /&gt;
    &amp;lt;% elsif (vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; and @current_role_name.eql?'Student' and !@assignment.show_teammate_reviews)%&amp;gt;&lt;br /&gt;
    &amp;lt;% elsif (vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; and @current_role_name.eql?'Student' and @assignment.show_teammate_reviews and current_user.id != vm.reviewee_id )%&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
        &amp;lt;% if vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
          &amp;lt;div class=&amp;quot;teammate_table&amp;quot; data-reviewee_id=&amp;quot;&amp;lt;%= vm.reviewee_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
        &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.3  '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
@@ -87,6 +131,8 @@&lt;br /&gt;
          &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
            &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
@@ -87,6 +131,8 @@&lt;br /&gt;
          &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
            &amp;lt;% elsif vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (For: &amp;lt;%= vm.reviewee_name(session[:ip]) %&amp;gt;)&lt;br /&gt;
            &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.4 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_reviews.each do |review| %&amp;gt;&lt;br /&gt;
              &amp;lt;!-- instructors (or higher level users) see reviewer name, students see anonymized string --&amp;gt;&lt;br /&gt;
              &amp;lt;% if (['Student'].include? @current_role_name) &amp;amp;&amp;amp; @assignment.is_anonymous%&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i} %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                  &amp;lt;% user_name = User.find(Participant.find(ResponseMap.find(Response.find(review.id).map_id).reviewer_id).user_id).fullname(session[:ip]).to_s %&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i} %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% i += 1 %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-true&amp;quot; align=&amp;quot;right&amp;quot; &amp;gt;&lt;br /&gt;
            Avg&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;span  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;A count of comments, for the respective question, which have word count &amp;gt; 10. The purpose of this metric is to represent how many comments for the question are of a substantial length to provide quality feedback.&amp;quot;&amp;gt;metric-1&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/thead&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_reviews.each do |review| %&amp;gt;&lt;br /&gt;
              &amp;lt;!-- instructors (or higher level users) see reviewer name, students see anonymized string --&amp;gt;&lt;br /&gt;
              &amp;lt;% if (['Student'].include? @current_role_name) &amp;amp;&amp;amp; @assignment.is_anonymous%&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i, questionnaire_type: vm.questionnaire_type } %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                &amp;lt;% user_name = User.find(Participant.find(ResponseMap.find(Response.find(review.id).map_id).reviewer_id).user_id).fullname(session[:ip]).to_s %&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i, questionnaire_type: vm.questionnaire_type } %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% i += 1 %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-true&amp;quot; align=&amp;quot;right&amp;quot; &amp;gt;&lt;br /&gt;
            Avg&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/thead&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.5 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_rows.each do |row| %&amp;gt;&lt;br /&gt;
            &amp;lt;!-- notice the data-target. because we're toggling via looped code, we need to dynamically generate the identifier. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr data-toggle=&amp;quot;collapse&amp;quot; class=&amp;quot;accordion-toggle&amp;quot; data-target=&amp;quot;#hid&amp;lt;%= row.question_id.to_s + vm.round.to_s %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;td class = 'cf' data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= row.question_text %&amp;gt;&amp;quot;&amp;gt; &amp;lt;div style='float: left'&amp;gt;&amp;lt;%= j.to_s %&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div style='float: right'&amp;gt; &amp;amp;#&amp;lt;%= type_and_max(row) %&amp;gt;;&amp;lt;/div&amp;gt;  &amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
              &amp;lt;!-- actual cells with scores and colored background. --&amp;gt;&lt;br /&gt;
              &amp;lt;% row.score_row.each do |score| %&amp;gt;&lt;br /&gt;
                  &amp;lt;% score_comment = score.comment.nil? ? '' : score.comment %&amp;gt; &amp;lt;!-- changing nil to null string to avoid Null Pointer Exception --&amp;gt;&lt;br /&gt;
                  &amp;lt;td class=&amp;quot;&amp;lt;%= score.color_code %&amp;gt;&amp;quot; align=&amp;quot;center&amp;quot; data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= strip_tags(score.comment).html_safe%&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;&amp;lt;%=  underlined?(score) %&amp;gt;&amp;quot;&amp;gt;&amp;lt;%= score.score_value.to_s %&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
                  &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_rows.each do |row| %&amp;gt;&lt;br /&gt;
            &amp;lt;% target_id = &amp;quot;hid__#{row.question_id}__#{vm.round}&amp;quot; %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
              &amp;lt;%# Since we render different heatgrids with the same questions for each&lt;br /&gt;
              teammember, we need to distinguish the ID, based on the user for whom,&lt;br /&gt;
              the reviews have been created. %&amp;gt;&lt;br /&gt;
              &amp;lt;% target_id += &amp;quot;__#{vm.reviewee_id}&amp;quot; %&amp;gt;&lt;br /&gt;
            &amp;lt;% end%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;!-- notice the data-target. because we're toggling via looped code, we need to dynamically generate the identifier. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr data-toggle=&amp;quot;collapse&amp;quot; class=&amp;quot;accordion-toggle&amp;quot; data-target=&amp;quot;&amp;lt;%= &amp;quot;#&amp;quot; + target_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;td class = 'cf' data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= row.question_text %&amp;gt;&amp;quot;&amp;gt; &amp;lt;div style='float: left'&amp;gt;&amp;lt;%= j.to_s %&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div style='float: right'&amp;gt; &amp;amp;#&amp;lt;%= type_and_max(row) %&amp;gt;;&amp;lt;/div&amp;gt;  &amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
              &amp;lt;!-- actual cells with scores and colored background. --&amp;gt;&lt;br /&gt;
              &amp;lt;% row.score_row.each do |score| %&amp;gt;&lt;br /&gt;
                  &amp;lt;% score_comment = score.comment.nil? ? '' : score.comment %&amp;gt;&lt;br /&gt;
                  &amp;lt;!-- changing nil to null string to avoid Null Pointer Exception --&amp;gt;&lt;br /&gt;
                  &amp;lt;td class=&amp;quot;&amp;lt;%= score.color_code %&amp;gt;&amp;quot; align=&amp;quot;center&amp;quot; data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= strip_tags(score.comment).html_safe%&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;&amp;lt;%=  underlined?(score) %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                      &amp;lt;%= score.score_value.to_s %&amp;gt;&lt;br /&gt;
                    &amp;lt;/span&amp;gt;&lt;br /&gt;
                  &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.6 '''Removed the following code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 &amp;lt;td  class = 'cf' align=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;%= row.countofcomments.to_s %&amp;gt;&lt;br /&gt;
              &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.7 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!--loop that creates the collapsed-by-default row, which lists all comments. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr class=&amp;quot;tablesorter-childRow&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;td colspan=&amp;quot;&amp;lt;%= (i+1).to_s %&amp;gt;&amp;quot; class=&amp;quot;hiddenRow&amp;quot; &amp;gt;&amp;lt;div id=&amp;quot;hid&amp;lt;%= row.question_id.to_s + vm.round.to_s %&amp;gt;&amp;quot; class=&amp;quot;accordion-body collapse&amp;quot; style=&amp;quot;margin-left:10px;&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;div style=&amp;quot;padding-top: 10px; padding-bottom: 10px;&amp;quot;&amp;gt;&amp;lt;%=  sanitize row.question_text %&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;div&amp;gt;&lt;br /&gt;
                  &amp;lt;table class=&amp;quot;table tbl_questlist&amp;quot;&amp;gt;&lt;br /&gt;
@@ -181,7 +233,17 @@&lt;br /&gt;
                    &amp;lt;/thead&amp;gt;&lt;br /&gt;
                    &amp;lt;% for index in 0 .. row.score_row.length - 1 %&amp;gt;&lt;br /&gt;
                        &amp;lt;tr&amp;gt;&lt;br /&gt;
                          &amp;lt;td&amp;gt;Review &amp;lt;%=index + 1%&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!--loop that creates the collapsed-by-default row, which lists all comments. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr class=&amp;quot;tablesorter-childRow&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;td colspan=&amp;quot;&amp;lt;%= (i+1).to_s %&amp;gt;&amp;quot; class=&amp;quot;hiddenRow&amp;quot; &amp;gt;&amp;lt;div id=&amp;quot;&amp;lt;%= target_id %&amp;gt;&amp;quot; class=&amp;quot;accordion-body collapse&amp;quot; style=&amp;quot;margin-left:10px;&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;div style=&amp;quot;padding-top: 10px; padding-bottom: 10px;&amp;quot;&amp;gt;&amp;lt;%=  sanitize row.question_text %&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;div&amp;gt;&lt;br /&gt;
                  &amp;lt;table class=&amp;quot;table tbl_questlist&amp;quot;&amp;gt;&lt;br /&gt;
@@ -181,7 +233,17 @@&lt;br /&gt;
                    &amp;lt;/thead&amp;gt;&lt;br /&gt;
                    &amp;lt;% for index in 0 .. row.score_row.length - 1 %&amp;gt;&lt;br /&gt;
                        &amp;lt;tr&amp;gt;&lt;br /&gt;
                          &amp;lt;% if @current_role_name.eql?'Student' or vm.questionnaire_type != &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                            &amp;lt;%# Use Review {{index}} format for student view, and&lt;br /&gt;
                            when questionnaire_type is not teammatereview %&amp;gt;&lt;br /&gt;
                            &amp;lt;td&amp;gt;Review &amp;lt;%=index + 1%&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
                          &amp;lt;% else %&amp;gt;&lt;br /&gt;
                            &amp;lt;td&amp;gt;&lt;br /&gt;
                              &amp;lt;% reviewer_id = row.score_row[index].reviewer_id %&amp;gt;&lt;br /&gt;
                              &amp;lt;% fullname = Participant.find_by(id: reviewer_id).fullname(session[:ip]) %&amp;gt;&lt;br /&gt;
                              Review by &amp;lt;%= fullname %&amp;gt;&lt;br /&gt;
                            &amp;lt;/td&amp;gt;&lt;br /&gt;
                          &amp;lt;% end%&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====G. In spec/controllers/grades_controller_spec.rb:====&lt;br /&gt;
&lt;br /&gt;
'''G.1 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
before(:each) do&lt;br /&gt;
  allow(AssignmentParticipant).to receive(:find).with('1').and_return(participant)&lt;br /&gt;
  allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
  stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
@@ -91,29 +90,106 @@&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
before(:each) do&lt;br /&gt;
  allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
  stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
@@ -91,29 +90,106 @@&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''G.2 '''Remove xdescribe '#view_team' and change describe '#view_team' as follows.&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#view_team' do&lt;br /&gt;
render_views&lt;br /&gt;
context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
  it 'renders grades#view_team page' do&lt;br /&gt;
    allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
    allow(AssignmentQuestionnaire).to receive(:find_by).with(assignment_id: 1, questionnaire_id: 1).and_return(assignment_questionnaire)&lt;br /&gt;
    allow(AssignmentQuestionnaire).to receive(:where).with(any_args).and_return([assignment_questionnaire])&lt;br /&gt;
    allow(assignment).to receive(:late_policy_id).and_return(false)&lt;br /&gt;
    allow(assignment).to receive(:calculate_penalty).and_return(false)&lt;br /&gt;
    allow(assignment).to receive(:compute_total_score).with(any_args).and_return(100)&lt;br /&gt;
    allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
    allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
    params = {id: 1}&lt;br /&gt;
    allow(TaMapping).to receive(:exists?).with(ta_id: 1, course_id: 1).and_return(true)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#view_team' do&lt;br /&gt;
render_views&lt;br /&gt;
&lt;br /&gt;
# All stubs and factories are instantiated within this scope so as to not &lt;br /&gt;
# clash with other broken test.&lt;br /&gt;
# The names of the factories created for testing view_team&lt;br /&gt;
# have `_vt` suffix ```where necessary``` to differentiate them from &lt;br /&gt;
# the above declared factories&lt;br /&gt;
&lt;br /&gt;
let(:student1_vt) { create(:student, name: &amp;quot;barry&amp;quot;, id: 12) }&lt;br /&gt;
let(:student2_vt) { create(:student, name: &amp;quot;iris&amp;quot;, id: 13) }&lt;br /&gt;
&lt;br /&gt;
let(:tm_questionnaire) {&lt;br /&gt;
  build(&lt;br /&gt;
    :teammate_review_questionnaire,&lt;br /&gt;
    id: 12,&lt;br /&gt;
    questions: [question],&lt;br /&gt;
    max_question_score: 5&lt;br /&gt;
  )&lt;br /&gt;
}&lt;br /&gt;
let(:assignment_vt) {&lt;br /&gt;
  create(:assignment, id: 6, max_team_size: 2,&lt;br /&gt;
  questionnaires: [tm_questionnaire])&lt;br /&gt;
}&lt;br /&gt;
let(:assignment_questionnaire_vt) {&lt;br /&gt;
  create(:tm_assignment_questionnaire, id: 12, used_in_round: nil,&lt;br /&gt;
  assignment: assignment_vt, questionnaire: tm_questionnaire) }&lt;br /&gt;
let(:team_vt) { create(:assignment_team, id: 12,&lt;br /&gt;
assignment: assignment_vt) }&lt;br /&gt;
let(:participant_vt) { create(:participant, id: 12,&lt;br /&gt;
  assignment: assignment_vt, user_id: student1_vt.id) }&lt;br /&gt;
let(:participant2_vt) { create(:participant, id: 13,&lt;br /&gt;
  assignment: assignment_vt, user_id: student2_vt.id) }&lt;br /&gt;
&lt;br /&gt;
before(:each) do&lt;br /&gt;
  # Need to stub this method so the factory instance with&lt;br /&gt;
  # the stubbed :team method is returned by :find&lt;br /&gt;
  # instead of a separate instance with the same data&lt;br /&gt;
  allow(AssignmentParticipant)&lt;br /&gt;
    .to receive(:find)&lt;br /&gt;
    .with(participant_vt.id.to_s)&lt;br /&gt;
    .and_return(participant_vt)&lt;br /&gt;
  allow(participant_vt).to receive(:team).and_return(team_vt)&lt;br /&gt;
  allow(team_vt).to receive(:participants).and_return([participant_vt, participant2_vt])&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:find_by)&lt;br /&gt;
    .with(assignment_id: assignment_vt.id, questionnaire_id: tm_questionnaire.id)&lt;br /&gt;
    .and_return(assignment_questionnaire_vt)&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:find_by)&lt;br /&gt;
    .with(assignment_id: assignment.id, questionnaire_id: review_questionnaire.id)&lt;br /&gt;
    .and_return(assignment_questionnaire_vt)&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:where)&lt;br /&gt;
    .with(any_args)&lt;br /&gt;
    .and_return([assignment_questionnaire_vt])&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:late_policy_id)&lt;br /&gt;
    .and_return(false)&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:calculate_penalty)&lt;br /&gt;
    .and_return(false)&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:compute_total_score)&lt;br /&gt;
    .with(any_args)&lt;br /&gt;
    .and_return(100)&lt;br /&gt;
  allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
  allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
 it 'renders grades#view_team page' do&lt;br /&gt;
  params = {id: participant_vt.id}&lt;br /&gt;
  get :view_team, params&lt;br /&gt;
  expect(response).to render_template(:view_team)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is opened by student' do&lt;br /&gt;
  it 'dropdown is not rendered' do&lt;br /&gt;
    session = { user: student1_vt }&lt;br /&gt;
    params = {id: participant_vt.id}&lt;br /&gt;
    stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
    get :view_team, params&lt;br /&gt;
    expect(response.body).to_not have_selector('select')&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is opened by instructor' do&lt;br /&gt;
  it 'dropdown is rendered' do&lt;br /&gt;
    session = { user: instructor }&lt;br /&gt;
    params = {id: participant_vt.id}&lt;br /&gt;
    get :view_team, params&lt;br /&gt;
    expect(response.body).to have_selector('select')&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
  it 'renders grades#view_team page' do&lt;br /&gt;
    params = { id: participant_vt.id }&lt;br /&gt;
    allow(TaMapping).to receive(:exists?).with(ta_id: participant_vt.user_id, course_id: 1).and_return(true)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====H. In spec/factories/factories.rb:====&lt;br /&gt;
&lt;br /&gt;
'''H.1 '''Add the following factory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
factory :teammate_review_questionnaire, class: TeammateReviewQuestionnaire do&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''H.2 '''Add another factory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
factory :tm_assignment_questionnaire, class: AssignmentQuestionnaire do&lt;br /&gt;
  user_id 1&lt;br /&gt;
  questionnaire { association(:teammate_review_questionnaire) }&lt;br /&gt;
  questionnaire_weight 100&lt;br /&gt;
  used_in_round nil&lt;br /&gt;
  topic_id nil&lt;br /&gt;
  dropdown 1&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Summary of file changes ===&lt;br /&gt;
&lt;br /&gt;
The following files are modified:&lt;br /&gt;
&lt;br /&gt;
1. app/controllers/grades_controller.rb - Controller file which changed how the view model is populated&lt;br /&gt;
&lt;br /&gt;
2. app/views/grades/view_team.html.erb - View file, which  conditionally rendered the teammate name, for a teammate review heatgrid&lt;br /&gt;
&lt;br /&gt;
3. spec/controllers/grades_controller_spec.rb - For tests verifying the proposed changes&lt;br /&gt;
&lt;br /&gt;
4. app/models/vm_question_response.rb - To modify the view-model so it can tell us the name of the person being reviewed for the current heatgrid&lt;br /&gt;
&lt;br /&gt;
5. app/models/vm_question_response_score_cell.rb - &lt;br /&gt;
&lt;br /&gt;
6. app/assets/stylesheets/grades.scss - &lt;br /&gt;
&lt;br /&gt;
7. app/views/grades/_add_icon_to_name.html.erb - &lt;br /&gt;
&lt;br /&gt;
8. spec/factories/factories.rb -&lt;br /&gt;
&lt;br /&gt;
== Design Patterns ==&lt;br /&gt;
&lt;br /&gt;
Existing code does not use any design patterns, apart from if-else. It uses if-else conditional statements to check what type of questionnaire is present in the viewmodel `VmQuestionResponse`, and based on that, it renders the appropriate content.&lt;br /&gt;
&lt;br /&gt;
We decided to continue with this approach since to change the present coding style, there were required many changes (refactoring) to many files which were out of the scope of the present project. To complete the project in the assigned time, we followed the if-else approach.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
'''OLD STATUS'''&lt;br /&gt;
&lt;br /&gt;
1. Earlier, the tests only covered if the view_team is page is rendered when it is asked for. This can be seen on the line 94 and 103 in [https://github.com/expertiza/expertiza/blob/beta/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''NEW STATUS'''&lt;br /&gt;
&lt;br /&gt;
1. The view_team page is rendered correctly for a given student or an instructor.&lt;br /&gt;
&lt;br /&gt;
2. When students access then the view_team page, the dropdown to select a student's teammate reviews is not rendered on the page.&lt;br /&gt;
&lt;br /&gt;
3. When instructor access then the view_team page, the dropdown to select a student's teammate reviews is rendered on the page.&lt;br /&gt;
&lt;br /&gt;
4. When a student who is also a TA for another course access the view_team page, that student should be able to a student's view to the page.&lt;br /&gt;
&lt;br /&gt;
5. If show_teammate_reviews boolean is set to False, then the student should not be able to see the teammate reviews given to him/her. If it is set to True, then the student should be able to see the reviews.&lt;br /&gt;
&lt;br /&gt;
6. An instructor should be able to see the teammate reviews for all students regardless of whether the show_teammate_reviews boolean is set to True or False.&lt;br /&gt;
&lt;br /&gt;
7. The reviewer id is tracked correctly to show the correct reviewer name in the teammate reviews table. This can be seen on line 27 in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/models/vm_question_response_score_cell_spec.rb this] file &lt;br /&gt;
&lt;br /&gt;
8. An instructor can select which student's scores he/she wants to see. If no student's name is selected then the professor can see the scores of all the students.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;https://expertiza.ncsu.edu/&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Agarg25</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141741</id>
		<title>CSC/ECE 517 Fall 2021 - E2165. Fix teammate-review view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141741"/>
		<updated>2021-11-28T18:18:13Z</updated>

		<summary type="html">&lt;p&gt;Agarg25: /* User Stories */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Introduction ==&lt;br /&gt;
&lt;br /&gt;
Dr. Edward Gehringer (instructor), Parimal Mehta (mentor)&lt;br /&gt;
&lt;br /&gt;
1. Anjali Garg (unity ID : agarg25)&lt;br /&gt;
&lt;br /&gt;
2. Arvasu Chikara (unity ID: achikar2)&lt;br /&gt;
&lt;br /&gt;
3. Lalit Bangad (unity ID: llbangad)&lt;br /&gt;
&lt;br /&gt;
4. Vinay Deshmukh (unity ID: vdeshmu)&lt;br /&gt;
&lt;br /&gt;
== Problems to be addressed ==&lt;br /&gt;
&lt;br /&gt;
After a project is submitted and reviewed, both the team members (students) and instructors should be able to view the teammate reviews. Students should be able to view the reviews by going to a particular assignment's -&amp;gt; your scores, at the bottom of the page. An instructor can view the teammate reviews by going to assignments -&amp;gt; assignment -&amp;gt; particular team's submission -&amp;gt; view submission -&amp;gt; assign grades -&amp;gt; view scores. &lt;br /&gt;
&lt;br /&gt;
In the case of the instructor, a single heat grid is shown whereas in the case of a team member, we cant view the scores. In the heat grid, it is not clear if the scores visible are for the reviews that the student has *written* for their teammates or the scores that the student has *received* from their teammates. Additionally, for instructors can choose from a list of the students on the team, but they have no way to tell whether the heat grid shows the reviews done *by* that student or done *for* that student.&lt;br /&gt;
&lt;br /&gt;
== Methodology Overview ==&lt;br /&gt;
&lt;br /&gt;
We have divided our work in the following tasks to address the above problems:&lt;br /&gt;
&lt;br /&gt;
1. Distinguish reviews done for a student by rendering separates heatgrids for each student&lt;br /&gt;
&lt;br /&gt;
2. For instructors, the table will have sections based on the students&lt;br /&gt;
&lt;br /&gt;
3. Include a checkbox on the edit assignment page that enables/disables visibility of heat grid to students&lt;br /&gt;
&lt;br /&gt;
4. Fix the average column for a table (which breaks for some reviews)&lt;br /&gt;
&lt;br /&gt;
5. Show a composite score derived from all reviews.  Make this code generalized, so other kinds of heat grid views could use it.&lt;br /&gt;
&lt;br /&gt;
6. Changes should work even in an anonymized view&lt;br /&gt;
&lt;br /&gt;
== Motivations ==&lt;br /&gt;
&lt;br /&gt;
1. Enable users to clearly tell which reviews are done by them, and which reviews are done for them.&lt;br /&gt;
&lt;br /&gt;
2. Code should be generic so it can be used for different types of heat grids as well.&lt;br /&gt;
&lt;br /&gt;
== Control Flow to access the concerned screens ==&lt;br /&gt;
'''1. For instructor (Log in as an instructor):-'''&lt;br /&gt;
&lt;br /&gt;
Screen after logging in by the instructor&lt;br /&gt;
[[File:ss1.png |border|1000px|center]]&lt;br /&gt;
Got to assignments on the Manage menu &lt;br /&gt;
[[File:ss2.png |border|1000px|center]]&lt;br /&gt;
Go to assignments&lt;br /&gt;
[[File:ss3.png |border|1000px|center]]&lt;br /&gt;
Go to submissions for any assignment&lt;br /&gt;
[[File:ss4a.png |border|1000px|center]]&lt;br /&gt;
Go to Assign Grade&lt;br /&gt;
[[File:ss5a.png |border|1000px|center]]&lt;br /&gt;
You will land on the page where the changes are made and can be reviewed&lt;br /&gt;
[[File:ss7a.png |border|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
'''2. Student:- (Logged in as an instructor)'''&lt;br /&gt;
&lt;br /&gt;
After landing on the assignments page, select any student from an assignment as shown below&lt;br /&gt;
[[File:ss6a.png |border|1000px|center]]&lt;br /&gt;
Go to/Select any assignment&lt;br /&gt;
[[File:ss9a.png |border|1000px|center]]&lt;br /&gt;
Go to your scores&lt;br /&gt;
[[File:ss10a.png |border|1000px|center]]&lt;br /&gt;
You will land on the page where the changes are made and can be reviewed&lt;br /&gt;
[[File:ss11a.png |border|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
== Old Status of the application ==&lt;br /&gt;
&lt;br /&gt;
'''1. Instructor's view of teammate review''': This is the current screen given to the instructor. Here we see that the instructor can not determine who has given which review to which student in a team.&lt;br /&gt;
&lt;br /&gt;
[[File:Instructor-view-1.png|border| 700px |center|alt=The proposed expanded student display.|The proposed expanded student display.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2. Student's view of teammate review''': Currently, a student is not able to see what grades were given by their teammates. We need to implement that functionality so that the student is able to view those grades.&lt;br /&gt;
&lt;br /&gt;
[[File:Student-view-2.png|border| 700px |center|alt=The current instructor view.|The current review display for instructors.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Error in existing UI for student''': In the existing UI for a student, the highlighted block should not be rendered. This part of the screen is meant for the instructors/TAs. &lt;br /&gt;
&lt;br /&gt;
[[File:Wrong render for student.png|border|700px|center|alt=Existing UI for student|Existing UI for student.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Proposed changes ==&lt;br /&gt;
&lt;br /&gt;
''' 1) Proposed UI for instructor ''': The instructor is able to see the score for all teammates. In the existing code, only one teammate's scores are being shown. But, we are planning to change the way the (VmQuestionResponse array is populated)[https://github.com/expertiza/expertiza/blob/master/app/controllers/grades_controller.rb#L114], so that the scores for all teammates are appended to it so it correctly shows what should have already been shown in this screen for the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Proposed_screen.png|border|700px|center|alt=Proposed UI for instructor|Proposed UI for instructor.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: When a student visits this screen, they will only be shown the reviews received by them, assuming the instructor has allowed visibility of teammate reviews to students.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' 2) Show detailed review for a particular question''': The instructor can see detailed review given to a student by their teammates by clicking on a particular question number in the table.&lt;br /&gt;
&lt;br /&gt;
[[File:ss12a.png|border|700px|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' 3) Show teammate review to student UI ''': The existing code doesn't render a student's teammate review scores at all. We are planning to render the scores to a student (as shown below) when they visit this screen. However, the visibility of this screen is contingent on whether the instructor has allowed visibility of the teammate review screen to students. If the instructor has disabled this feature, then the heatgrid will not be displayed at all.&lt;br /&gt;
&lt;br /&gt;
[[File:UI_for_student.png|border|700px|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
== Models used / Explanation of fixes ==&lt;br /&gt;
&lt;br /&gt;
The below diagram illustrates the proposed code change for showing all team members with the teammate review data to an instructor. The existing code only iterated on the `Participant` whose ID is present in the URL of the page. To fix this, we will iterate over all teammates of the given participant so that all teammate reviews for all team members are shown to the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Logic e2165.png|border|center|alt=Flow diagram of proposed changes for showing team review data to instructor]]&lt;br /&gt;
&lt;br /&gt;
===Changes made to the code are shown below. Every change is shown and explained separately===&lt;br /&gt;
&lt;br /&gt;
====A. Added the following to app/assets/stylesheets/grades.scss:====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    .teammate_table.hidden {&lt;br /&gt;
      display: none;&lt;br /&gt;
      }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====B. In app/controllers/grades_controller.rb: ====&lt;br /&gt;
&lt;br /&gt;
'''B.1:'''&lt;br /&gt;
&lt;br /&gt;
Old code: The existing code does not differentiate when adding a view model for the TeammateReview questionnaire&lt;br /&gt;
  questionnaires.each do |questionnaire|&lt;br /&gt;
     ...&lt;br /&gt;
     @vmlist &amp;lt;&amp;lt; populate_view_model(questionnaire)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
New code: Since the current page URL contains an ID for the participant, from which we get an assignment, which gives us a list of questionnaires, we need to iterate all participants for a `TeammateReveiwQuestionnaire` questionnaire, so that we get the heatgrid view models for all members of a team.&lt;br /&gt;
  questionnaires.each do |questionnaire|&lt;br /&gt;
     ...&lt;br /&gt;
     if questionnaire.type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
        # as teammate review will be different for each participant&lt;br /&gt;
        # we need to create a separate table for each teammate&lt;br /&gt;
        @participant.team.participants.each do |team_participant|&lt;br /&gt;
          @vmlist &amp;lt;&amp;lt; populate_view_model(team_participant, questionnaire, @team)&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        # only one participant needs iterating, as apart from teammatereview&lt;br /&gt;
        # all other reviews are at &amp;quot;team&amp;quot; level&lt;br /&gt;
        @vmlist &amp;lt;&amp;lt; populate_view_model(@participant, questionnaire, @team)&lt;br /&gt;
      end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
'''B.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code: This code uses @participant as an instance variable, but this structure will not work as we need to call this ViewModel with multiple participants when iterating for a teammate review questionnaire.&lt;br /&gt;
    def populate_view_model(questionnaire)&lt;br /&gt;
      vm = VmQuestionResponse.new(questionnaire, @assignment, @round)&lt;br /&gt;
      vmquestions = questionnaire.questions&lt;br /&gt;
      vm.add_questions(vmquestions)&lt;br /&gt;
      vm.add_team_members(@team)&lt;br /&gt;
      vm.add_reviews(@participant, @team, @assignment.vary_by_round)&lt;br /&gt;
      vm.number_of_comments_greater_than_10_words&lt;br /&gt;
      vm &lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
New code: We need to call this function with a separate participant in each invocation due to our change for TeammateReviewQuestionnaire, hence it makes sense to make `participant` as an argument to this function. Similarly, as `team` is a closely related model to `participant`, we are passing it as an argument, to keep this function as &amp;quot;pure&amp;quot; as possible.&lt;br /&gt;
    def populate_view_model(participant, questionnaire, team)&lt;br /&gt;
      ...&lt;br /&gt;
      vm.add_team_members(team)&lt;br /&gt;
      vm.add_reviews(participant, team, @assignment.vary_by_round)&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
====C. In app/models/vm_question_response.rb:====&lt;br /&gt;
&lt;br /&gt;
'''C.1: '''Added the reviewee_id method: Created a helper method within the VmQuestionReponse model to retrieve the `reviewee_id` for a heatgrid&lt;br /&gt;
&lt;br /&gt;
    def reviewee_id&lt;br /&gt;
      @participant_who_is_reviewee.user_id&lt;br /&gt;
    end &lt;br /&gt;
&lt;br /&gt;
'''C.2: '''Added the reviewee_name method: Created a helper method within the VmQuestionReponse model to retrieve the name of the student who is being reviewed for a heatgrid. This method uses the functionality to anonymize the name when we are in anonymized view.&lt;br /&gt;
&lt;br /&gt;
    def reviewee_name(ip_address = nil)&lt;br /&gt;
      part = @participant_who_is_reviewee&lt;br /&gt;
      User.find_by(id: part.user_id).fullname(ip_address)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''C.3: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Does not keep track of the student being reviewed&lt;br /&gt;
    elsif @questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
      reviews = participant.teammate_reviews&lt;br /&gt;
      reviews.each do |review|&lt;br /&gt;
        review_mapping = TeammateReviewResponseMap.find_by(id: review.map_id)&lt;br /&gt;
        participant = Participant.find(review_mapping.reviewer_id)&lt;br /&gt;
&lt;br /&gt;
New code: Add an instance variable to keep track of the student who is being reviewed in this VmQuestionReponse&lt;br /&gt;
    elsif @questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
      reviews = participant.teammate_reviews&lt;br /&gt;
      @participant_who_is_reviewee = participant&lt;br /&gt;
      reviews.each do |review|&lt;br /&gt;
        review_mapping = TeammateReviewResponseMap.find_by(id: review.map_id)&lt;br /&gt;
        participant = Participant.find(review_mapping.reviewer_id)&lt;br /&gt;
&lt;br /&gt;
'''C.4: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing VmQuestionReponseScoreCell keeps no information about the reviewer, as it only stores the answer score&lt;br /&gt;
    row.score_row.push(VmQuestionResponseScoreCell.new(answer.answer, color_code, answer.comments, vm_tag_prompts))&lt;br /&gt;
&lt;br /&gt;
New code: Keep track of the response ID, so that we can retrieve the user ID for the reviewer in the model to use in the view file.&lt;br /&gt;
    &lt;br /&gt;
    row.score_row.push(VmQuestionResponseScoreCell.new(answer.answer, color_code, answer.comments, vm_tag_prompts, answer.response_id))&lt;br /&gt;
&lt;br /&gt;
====D. In app/models/vm_question_response_score_cell.rb:====&lt;br /&gt;
&lt;br /&gt;
'''D.1: '''In the method initialize of class VmQuestionResponseScoreCell&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't keep track of the response id&lt;br /&gt;
    def initialize(score_value, color_code, comments, vmprompts = nil)&lt;br /&gt;
      @score_value = score_value&lt;br /&gt;
      @color_code = color_code&lt;br /&gt;
      @comment = comments&lt;br /&gt;
      @vm_prompts = vmprompts&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
New code: We added an instance variable to keep track of response_id&lt;br /&gt;
&lt;br /&gt;
    def initialize(score_value, color_code, comments, vmprompts = nil, response_id)&lt;br /&gt;
      ...&lt;br /&gt;
      @response_id = response_id&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''D.2: '''Added a method reviewer_id to the class VmQuestionResponseScoreCell: This helper method retrieves the ID for the reviewer who created this response.&lt;br /&gt;
&lt;br /&gt;
    def reviewer_id&lt;br /&gt;
      resp = Response.find(@response_id)&lt;br /&gt;
      map = ResponseMap.find(resp.map_id)&lt;br /&gt;
      map.reviewer_id&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
====E. In app/views/grades/_add_icon_to_name.html.erb:====&lt;br /&gt;
&lt;br /&gt;
'''E.1 '''Added the following code to the file:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;%# Determine the content of the reviewed by text %&amp;gt;&lt;br /&gt;
    &amp;lt;% review_text = &amp;quot;&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% if @current_role_name.eql?'Student' or questionnaire_type != &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
      &amp;lt;%# Use Review {{index}} format for student view, and when questionnaire_type is not teammatereview %&amp;gt;&lt;br /&gt;
      &amp;lt;% review_text = &amp;quot;Review #{i + 1}&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;% resp = Response.find(review.id) %&amp;gt;&lt;br /&gt;
      &amp;lt;% map = ResponseMap.find(resp.map_id) %&amp;gt;&lt;br /&gt;
      &amp;lt;% reviewer_id = map.reviewer_id %&amp;gt;&lt;br /&gt;
      &amp;lt;% fullname = Participant.find_by(id: reviewer_id).fullname(session[:ip]) %&amp;gt;&lt;br /&gt;
      &amp;lt;% review_text = &amp;quot;Review by #{fullname}&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% end%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''E.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;% if review.done_by_staff_participant? %&amp;gt;&lt;br /&gt;
      &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt; &amp;lt;img data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Icon indicates this review was done by course staff&amp;quot; class=&amp;quot;img_icon&amp;quot; src=&amp;quot;/assets/staff.png&amp;quot;&amp;gt; &amp;lt;a target=&amp;quot;_blank&amp;quot; href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Click to see details&amp;quot;&amp;gt;&amp;lt;%= &amp;quot;Review &amp;quot; + i.to_s  %&amp;gt;&amp;lt;/a&amp;gt; &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt; &amp;lt;a target=&amp;quot;_blank&amp;quot; href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Click to see details&amp;quot;&amp;gt;&amp;lt;%= &amp;quot;Review &amp;quot; + i.to_s %&amp;gt;&amp;lt;/a&amp;gt;  &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;% if review.done_by_staff_participant? %&amp;gt;&lt;br /&gt;
    &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;img&lt;br /&gt;
      data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
      data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
      title=&amp;quot;Icon indicates this review was done by course staff&amp;quot; class=&amp;quot;img_icon&amp;quot;&lt;br /&gt;
      src=&amp;quot;/assets/staff.png&amp;quot;&lt;br /&gt;
      &amp;gt;&lt;br /&gt;
    &amp;lt;a&lt;br /&gt;
      target=&amp;quot;_blank&amp;quot;&lt;br /&gt;
      href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;&lt;br /&gt;
      data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
      data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
      title=&amp;quot;Click to see details&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;%= review_text %&amp;gt;&lt;br /&gt;
    &amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
    &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;a&lt;br /&gt;
            target=&amp;quot;_blank&amp;quot; &lt;br /&gt;
            href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  &lt;br /&gt;
            data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
            data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
            title=&amp;quot;Click to see details&amp;quot;&lt;br /&gt;
        &amp;gt;&lt;br /&gt;
        &amp;lt;%= review_text %&amp;gt;&lt;br /&gt;
        &amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====F.In app/views/grades/view_team.html.erb:====&lt;br /&gt;
&lt;br /&gt;
'''F.1: '''Added function teammateSelectOnChange:&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  function teammateSelectOnChange(selectNode) {&lt;br /&gt;
      const revieweeIdToShow= selectNode.value;&lt;br /&gt;
      const tableSelector = &amp;quot;.teammate_table&amp;quot;;&lt;br /&gt;
      if(revieweeIdToShow == &amp;quot;all&amp;quot;) {&lt;br /&gt;
        document.querySelectorAll(tableSelector).forEach((tableNode) =&amp;gt; {&lt;br /&gt;
          tableNode.classList.remove(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
        });&lt;br /&gt;
        return;&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
  document.querySelectorAll(tableSelector).forEach((tableNode) =&amp;gt; {&lt;br /&gt;
    const tableRevieweeId = tableNode.getAttribute('data-reviewee_id');&lt;br /&gt;
    if(tableRevieweeId == revieweeIdToShow) {&lt;br /&gt;
      tableNode.classList.remove(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
    } else {&lt;br /&gt;
      tableNode.classList.add(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    });&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;% @vmlist.each do |vm| %&amp;gt;&lt;br /&gt;
        &amp;lt;% if (vm.questionnaire_display_type == &amp;quot;Metareview&amp;quot; or vm.questionnaire_display_type == &amp;quot;Author Feedback&amp;quot; or vm.questionnaire_display_type == &amp;quot;Teammate Review&amp;quot;) and @current_role_name.eql?'Student' %&amp;gt;&lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
        &amp;lt;% if vm.list_of_reviewers.length &amp;gt; 0 %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
​      &amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  @@ -87,6 +131,8 @@&lt;br /&gt;
              &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
                &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                    (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
        &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;%# This boolean is used to render a dropdown just before the first teammate review heat grid %&amp;gt;&lt;br /&gt;
&amp;lt;% first_teammate_review_appeared = false %&amp;gt;&lt;br /&gt;
&amp;lt;% @vmlist.each do |vm| %&amp;gt;&lt;br /&gt;
    &amp;lt;% if not @current_role_name.eql?'Student' and not first_teammate_review_appeared and vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        &amp;lt;select onchange=&amp;quot;teammateSelectOnChange(this)&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;all&amp;quot;&amp;gt;All&amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;% @vmlist.select { |tm_vm| tm_vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; }.each do |tm_vm| %&amp;gt;&lt;br /&gt;
            &amp;lt;option value=&amp;quot;&amp;lt;%= tm_vm.reviewee_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;%= tm_vm.reviewee_name(session[:ip]) %&amp;gt;&lt;br /&gt;
            &amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
        &amp;lt;/select&amp;gt;&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;% first_teammate_review_appeared = true %&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;% if (vm.questionnaire_display_type == &amp;quot;Metareview&amp;quot; or vm.questionnaire_display_type == &amp;quot;Author Feedback&amp;quot;) and @current_role_name.eql?'Student' %&amp;gt;&lt;br /&gt;
    &amp;lt;% elsif (vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; and @current_role_name.eql?'Student' and !@assignment.show_teammate_reviews)%&amp;gt;&lt;br /&gt;
    &amp;lt;% elsif (vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; and @current_role_name.eql?'Student' and @assignment.show_teammate_reviews and current_user.id != vm.reviewee_id )%&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
        &amp;lt;% if vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
          &amp;lt;div class=&amp;quot;teammate_table&amp;quot; data-reviewee_id=&amp;quot;&amp;lt;%= vm.reviewee_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
        &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.3  '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
@@ -87,6 +131,8 @@&lt;br /&gt;
          &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
            &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
@@ -87,6 +131,8 @@&lt;br /&gt;
          &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
            &amp;lt;% elsif vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (For: &amp;lt;%= vm.reviewee_name(session[:ip]) %&amp;gt;)&lt;br /&gt;
            &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.4 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_reviews.each do |review| %&amp;gt;&lt;br /&gt;
              &amp;lt;!-- instructors (or higher level users) see reviewer name, students see anonymized string --&amp;gt;&lt;br /&gt;
              &amp;lt;% if (['Student'].include? @current_role_name) &amp;amp;&amp;amp; @assignment.is_anonymous%&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i} %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                  &amp;lt;% user_name = User.find(Participant.find(ResponseMap.find(Response.find(review.id).map_id).reviewer_id).user_id).fullname(session[:ip]).to_s %&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i} %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% i += 1 %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-true&amp;quot; align=&amp;quot;right&amp;quot; &amp;gt;&lt;br /&gt;
            Avg&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;span  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;A count of comments, for the respective question, which have word count &amp;gt; 10. The purpose of this metric is to represent how many comments for the question are of a substantial length to provide quality feedback.&amp;quot;&amp;gt;metric-1&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/thead&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_reviews.each do |review| %&amp;gt;&lt;br /&gt;
              &amp;lt;!-- instructors (or higher level users) see reviewer name, students see anonymized string --&amp;gt;&lt;br /&gt;
              &amp;lt;% if (['Student'].include? @current_role_name) &amp;amp;&amp;amp; @assignment.is_anonymous%&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i, questionnaire_type: vm.questionnaire_type } %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                &amp;lt;% user_name = User.find(Participant.find(ResponseMap.find(Response.find(review.id).map_id).reviewer_id).user_id).fullname(session[:ip]).to_s %&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i, questionnaire_type: vm.questionnaire_type } %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% i += 1 %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-true&amp;quot; align=&amp;quot;right&amp;quot; &amp;gt;&lt;br /&gt;
            Avg&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/thead&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.5 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_rows.each do |row| %&amp;gt;&lt;br /&gt;
            &amp;lt;!-- notice the data-target. because we're toggling via looped code, we need to dynamically generate the identifier. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr data-toggle=&amp;quot;collapse&amp;quot; class=&amp;quot;accordion-toggle&amp;quot; data-target=&amp;quot;#hid&amp;lt;%= row.question_id.to_s + vm.round.to_s %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;td class = 'cf' data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= row.question_text %&amp;gt;&amp;quot;&amp;gt; &amp;lt;div style='float: left'&amp;gt;&amp;lt;%= j.to_s %&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div style='float: right'&amp;gt; &amp;amp;#&amp;lt;%= type_and_max(row) %&amp;gt;;&amp;lt;/div&amp;gt;  &amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
              &amp;lt;!-- actual cells with scores and colored background. --&amp;gt;&lt;br /&gt;
              &amp;lt;% row.score_row.each do |score| %&amp;gt;&lt;br /&gt;
                  &amp;lt;% score_comment = score.comment.nil? ? '' : score.comment %&amp;gt; &amp;lt;!-- changing nil to null string to avoid Null Pointer Exception --&amp;gt;&lt;br /&gt;
                  &amp;lt;td class=&amp;quot;&amp;lt;%= score.color_code %&amp;gt;&amp;quot; align=&amp;quot;center&amp;quot; data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= strip_tags(score.comment).html_safe%&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;&amp;lt;%=  underlined?(score) %&amp;gt;&amp;quot;&amp;gt;&amp;lt;%= score.score_value.to_s %&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
                  &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_rows.each do |row| %&amp;gt;&lt;br /&gt;
            &amp;lt;% target_id = &amp;quot;hid__#{row.question_id}__#{vm.round}&amp;quot; %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
              &amp;lt;%# Since we render different heatgrids with the same questions for each&lt;br /&gt;
              teammember, we need to distinguish the ID, based on the user for whom,&lt;br /&gt;
              the reviews have been created. %&amp;gt;&lt;br /&gt;
              &amp;lt;% target_id += &amp;quot;__#{vm.reviewee_id}&amp;quot; %&amp;gt;&lt;br /&gt;
            &amp;lt;% end%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;!-- notice the data-target. because we're toggling via looped code, we need to dynamically generate the identifier. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr data-toggle=&amp;quot;collapse&amp;quot; class=&amp;quot;accordion-toggle&amp;quot; data-target=&amp;quot;&amp;lt;%= &amp;quot;#&amp;quot; + target_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;td class = 'cf' data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= row.question_text %&amp;gt;&amp;quot;&amp;gt; &amp;lt;div style='float: left'&amp;gt;&amp;lt;%= j.to_s %&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div style='float: right'&amp;gt; &amp;amp;#&amp;lt;%= type_and_max(row) %&amp;gt;;&amp;lt;/div&amp;gt;  &amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
              &amp;lt;!-- actual cells with scores and colored background. --&amp;gt;&lt;br /&gt;
              &amp;lt;% row.score_row.each do |score| %&amp;gt;&lt;br /&gt;
                  &amp;lt;% score_comment = score.comment.nil? ? '' : score.comment %&amp;gt;&lt;br /&gt;
                  &amp;lt;!-- changing nil to null string to avoid Null Pointer Exception --&amp;gt;&lt;br /&gt;
                  &amp;lt;td class=&amp;quot;&amp;lt;%= score.color_code %&amp;gt;&amp;quot; align=&amp;quot;center&amp;quot; data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= strip_tags(score.comment).html_safe%&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;&amp;lt;%=  underlined?(score) %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                      &amp;lt;%= score.score_value.to_s %&amp;gt;&lt;br /&gt;
                    &amp;lt;/span&amp;gt;&lt;br /&gt;
                  &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.6 '''Removed the following code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 &amp;lt;td  class = 'cf' align=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;%= row.countofcomments.to_s %&amp;gt;&lt;br /&gt;
              &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.7 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!--loop that creates the collapsed-by-default row, which lists all comments. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr class=&amp;quot;tablesorter-childRow&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;td colspan=&amp;quot;&amp;lt;%= (i+1).to_s %&amp;gt;&amp;quot; class=&amp;quot;hiddenRow&amp;quot; &amp;gt;&amp;lt;div id=&amp;quot;hid&amp;lt;%= row.question_id.to_s + vm.round.to_s %&amp;gt;&amp;quot; class=&amp;quot;accordion-body collapse&amp;quot; style=&amp;quot;margin-left:10px;&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;div style=&amp;quot;padding-top: 10px; padding-bottom: 10px;&amp;quot;&amp;gt;&amp;lt;%=  sanitize row.question_text %&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;div&amp;gt;&lt;br /&gt;
                  &amp;lt;table class=&amp;quot;table tbl_questlist&amp;quot;&amp;gt;&lt;br /&gt;
@@ -181,7 +233,17 @@&lt;br /&gt;
                    &amp;lt;/thead&amp;gt;&lt;br /&gt;
                    &amp;lt;% for index in 0 .. row.score_row.length - 1 %&amp;gt;&lt;br /&gt;
                        &amp;lt;tr&amp;gt;&lt;br /&gt;
                          &amp;lt;td&amp;gt;Review &amp;lt;%=index + 1%&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!--loop that creates the collapsed-by-default row, which lists all comments. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr class=&amp;quot;tablesorter-childRow&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;td colspan=&amp;quot;&amp;lt;%= (i+1).to_s %&amp;gt;&amp;quot; class=&amp;quot;hiddenRow&amp;quot; &amp;gt;&amp;lt;div id=&amp;quot;&amp;lt;%= target_id %&amp;gt;&amp;quot; class=&amp;quot;accordion-body collapse&amp;quot; style=&amp;quot;margin-left:10px;&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;div style=&amp;quot;padding-top: 10px; padding-bottom: 10px;&amp;quot;&amp;gt;&amp;lt;%=  sanitize row.question_text %&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;div&amp;gt;&lt;br /&gt;
                  &amp;lt;table class=&amp;quot;table tbl_questlist&amp;quot;&amp;gt;&lt;br /&gt;
@@ -181,7 +233,17 @@&lt;br /&gt;
                    &amp;lt;/thead&amp;gt;&lt;br /&gt;
                    &amp;lt;% for index in 0 .. row.score_row.length - 1 %&amp;gt;&lt;br /&gt;
                        &amp;lt;tr&amp;gt;&lt;br /&gt;
                          &amp;lt;% if @current_role_name.eql?'Student' or vm.questionnaire_type != &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                            &amp;lt;%# Use Review {{index}} format for student view, and&lt;br /&gt;
                            when questionnaire_type is not teammatereview %&amp;gt;&lt;br /&gt;
                            &amp;lt;td&amp;gt;Review &amp;lt;%=index + 1%&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
                          &amp;lt;% else %&amp;gt;&lt;br /&gt;
                            &amp;lt;td&amp;gt;&lt;br /&gt;
                              &amp;lt;% reviewer_id = row.score_row[index].reviewer_id %&amp;gt;&lt;br /&gt;
                              &amp;lt;% fullname = Participant.find_by(id: reviewer_id).fullname(session[:ip]) %&amp;gt;&lt;br /&gt;
                              Review by &amp;lt;%= fullname %&amp;gt;&lt;br /&gt;
                            &amp;lt;/td&amp;gt;&lt;br /&gt;
                          &amp;lt;% end%&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====G. In spec/controllers/grades_controller_spec.rb:====&lt;br /&gt;
&lt;br /&gt;
'''G.1 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
before(:each) do&lt;br /&gt;
  allow(AssignmentParticipant).to receive(:find).with('1').and_return(participant)&lt;br /&gt;
  allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
  stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
@@ -91,29 +90,106 @@&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
before(:each) do&lt;br /&gt;
  allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
  stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
@@ -91,29 +90,106 @@&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''G.2 '''Remove xdescribe '#view_team' and change describe '#view_team' as follows.&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#view_team' do&lt;br /&gt;
render_views&lt;br /&gt;
context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
  it 'renders grades#view_team page' do&lt;br /&gt;
    allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
    allow(AssignmentQuestionnaire).to receive(:find_by).with(assignment_id: 1, questionnaire_id: 1).and_return(assignment_questionnaire)&lt;br /&gt;
    allow(AssignmentQuestionnaire).to receive(:where).with(any_args).and_return([assignment_questionnaire])&lt;br /&gt;
    allow(assignment).to receive(:late_policy_id).and_return(false)&lt;br /&gt;
    allow(assignment).to receive(:calculate_penalty).and_return(false)&lt;br /&gt;
    allow(assignment).to receive(:compute_total_score).with(any_args).and_return(100)&lt;br /&gt;
    allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
    allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
    params = {id: 1}&lt;br /&gt;
    allow(TaMapping).to receive(:exists?).with(ta_id: 1, course_id: 1).and_return(true)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#view_team' do&lt;br /&gt;
render_views&lt;br /&gt;
&lt;br /&gt;
# All stubs and factories are instantiated within this scope so as to not &lt;br /&gt;
# clash with other broken test.&lt;br /&gt;
# The names of the factories created for testing view_team&lt;br /&gt;
# have `_vt` suffix ```where necessary``` to differentiate them from &lt;br /&gt;
# the above declared factories&lt;br /&gt;
&lt;br /&gt;
let(:student1_vt) { create(:student, name: &amp;quot;barry&amp;quot;, id: 12) }&lt;br /&gt;
let(:student2_vt) { create(:student, name: &amp;quot;iris&amp;quot;, id: 13) }&lt;br /&gt;
&lt;br /&gt;
let(:tm_questionnaire) {&lt;br /&gt;
  build(&lt;br /&gt;
    :teammate_review_questionnaire,&lt;br /&gt;
    id: 12,&lt;br /&gt;
    questions: [question],&lt;br /&gt;
    max_question_score: 5&lt;br /&gt;
  )&lt;br /&gt;
}&lt;br /&gt;
let(:assignment_vt) {&lt;br /&gt;
  create(:assignment, id: 6, max_team_size: 2,&lt;br /&gt;
  questionnaires: [tm_questionnaire])&lt;br /&gt;
}&lt;br /&gt;
let(:assignment_questionnaire_vt) {&lt;br /&gt;
  create(:tm_assignment_questionnaire, id: 12, used_in_round: nil,&lt;br /&gt;
  assignment: assignment_vt, questionnaire: tm_questionnaire) }&lt;br /&gt;
let(:team_vt) { create(:assignment_team, id: 12,&lt;br /&gt;
assignment: assignment_vt) }&lt;br /&gt;
let(:participant_vt) { create(:participant, id: 12,&lt;br /&gt;
  assignment: assignment_vt, user_id: student1_vt.id) }&lt;br /&gt;
let(:participant2_vt) { create(:participant, id: 13,&lt;br /&gt;
  assignment: assignment_vt, user_id: student2_vt.id) }&lt;br /&gt;
&lt;br /&gt;
before(:each) do&lt;br /&gt;
  # Need to stub this method so the factory instance with&lt;br /&gt;
  # the stubbed :team method is returned by :find&lt;br /&gt;
  # instead of a separate instance with the same data&lt;br /&gt;
  allow(AssignmentParticipant)&lt;br /&gt;
    .to receive(:find)&lt;br /&gt;
    .with(participant_vt.id.to_s)&lt;br /&gt;
    .and_return(participant_vt)&lt;br /&gt;
  allow(participant_vt).to receive(:team).and_return(team_vt)&lt;br /&gt;
  allow(team_vt).to receive(:participants).and_return([participant_vt, participant2_vt])&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:find_by)&lt;br /&gt;
    .with(assignment_id: assignment_vt.id, questionnaire_id: tm_questionnaire.id)&lt;br /&gt;
    .and_return(assignment_questionnaire_vt)&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:find_by)&lt;br /&gt;
    .with(assignment_id: assignment.id, questionnaire_id: review_questionnaire.id)&lt;br /&gt;
    .and_return(assignment_questionnaire_vt)&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:where)&lt;br /&gt;
    .with(any_args)&lt;br /&gt;
    .and_return([assignment_questionnaire_vt])&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:late_policy_id)&lt;br /&gt;
    .and_return(false)&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:calculate_penalty)&lt;br /&gt;
    .and_return(false)&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:compute_total_score)&lt;br /&gt;
    .with(any_args)&lt;br /&gt;
    .and_return(100)&lt;br /&gt;
  allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
  allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
 it 'renders grades#view_team page' do&lt;br /&gt;
  params = {id: participant_vt.id}&lt;br /&gt;
  get :view_team, params&lt;br /&gt;
  expect(response).to render_template(:view_team)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is opened by student' do&lt;br /&gt;
  it 'dropdown is not rendered' do&lt;br /&gt;
    session = { user: student1_vt }&lt;br /&gt;
    params = {id: participant_vt.id}&lt;br /&gt;
    stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
    get :view_team, params&lt;br /&gt;
    expect(response.body).to_not have_selector('select')&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is opened by instructor' do&lt;br /&gt;
  it 'dropdown is rendered' do&lt;br /&gt;
    session = { user: instructor }&lt;br /&gt;
    params = {id: participant_vt.id}&lt;br /&gt;
    get :view_team, params&lt;br /&gt;
    expect(response.body).to have_selector('select')&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
  it 'renders grades#view_team page' do&lt;br /&gt;
    params = { id: participant_vt.id }&lt;br /&gt;
    allow(TaMapping).to receive(:exists?).with(ta_id: participant_vt.user_id, course_id: 1).and_return(true)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====H. In spec/factories/factories.rb:====&lt;br /&gt;
&lt;br /&gt;
'''H.1 '''Add the following factory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
factory :teammate_review_questionnaire, class: TeammateReviewQuestionnaire do&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''H.2 '''Add another factory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
factory :tm_assignment_questionnaire, class: AssignmentQuestionnaire do&lt;br /&gt;
  user_id 1&lt;br /&gt;
  questionnaire { association(:teammate_review_questionnaire) }&lt;br /&gt;
  questionnaire_weight 100&lt;br /&gt;
  used_in_round nil&lt;br /&gt;
  topic_id nil&lt;br /&gt;
  dropdown 1&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Summary of file changes ===&lt;br /&gt;
&lt;br /&gt;
The following files are modified:&lt;br /&gt;
&lt;br /&gt;
1. app/controllers/grades_controller.rb - Controller file which changed how the view model is populated&lt;br /&gt;
&lt;br /&gt;
2. app/views/grades/view_team.html.erb - View file, which  conditionally rendered the teammate name, for a teammate review heatgrid&lt;br /&gt;
&lt;br /&gt;
3. spec/controllers/grades_controller_spec.rb - For tests verifying the proposed changes&lt;br /&gt;
&lt;br /&gt;
4. app/models/vm_question_response.rb - To modify the view-model so it can tell us the name of the person being reviewed for the current heatgrid&lt;br /&gt;
&lt;br /&gt;
5. app/models/vm_question_response_score_cell.rb - &lt;br /&gt;
&lt;br /&gt;
6. app/assets/stylesheets/grades.scss - &lt;br /&gt;
&lt;br /&gt;
7. app/views/grades/_add_icon_to_name.html.erb - &lt;br /&gt;
&lt;br /&gt;
8. spec/factories/factories.rb -&lt;br /&gt;
&lt;br /&gt;
== Design Patterns ==&lt;br /&gt;
&lt;br /&gt;
Existing code does not use any design patterns, apart from if-else. It uses if-else conditional statements to check what type of questionnaire is present in the viewmodel `VmQuestionResponse`, and based on that, it renders the appropriate content.&lt;br /&gt;
&lt;br /&gt;
We decided to continue with this approach since to change the present coding style, there were required many changes (refactoring) to many files which were out of the scope of the present project. To complete the project in the assigned time, we followed the if-else approach.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== User Stories ==&lt;br /&gt;
&lt;br /&gt;
1. As an instructor, I can view what reviews one teammate has given to other teammates.&lt;br /&gt;
&lt;br /&gt;
2. As a student, I can view what reviews my teammates have given to me.&lt;br /&gt;
&lt;br /&gt;
3. As an instructor, I can choose if I want to see all student's teammates reviews together or one by one.&lt;br /&gt;
&lt;br /&gt;
4. As a student, if I am also a TA for another subject, I should not be able to see an instructor's view to the view_team page.&lt;br /&gt;
&lt;br /&gt;
5. As an instructor, I should be able to see the name of the reviewers for the reviews to a particular student.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
'''OLD STATUS'''&lt;br /&gt;
&lt;br /&gt;
1. Earlier, the tests only covered if the view_team is page is rendered when it is asked for. This can be seen on the line 94 and 103 in [https://github.com/expertiza/expertiza/blob/beta/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''NEW STATUS'''&lt;br /&gt;
&lt;br /&gt;
1. The view_team page is rendered correctly for a given student or an instructor.&lt;br /&gt;
&lt;br /&gt;
2. When students access then the view_team page, the dropdown to select a student's teammate reviews is not rendered on the page.&lt;br /&gt;
&lt;br /&gt;
3. When instructor access then the view_team page, the dropdown to select a student's teammate reviews is rendered on the page.&lt;br /&gt;
&lt;br /&gt;
4. When a student who is also a TA for another course access the view_team page, that student should be able to a student's view to the page.&lt;br /&gt;
&lt;br /&gt;
5. If show_teammate_reviews boolean is set to False, then the student should not be able to see the teammate reviews given to him/her. If it is set to True, then the student should be able to see the reviews.&lt;br /&gt;
&lt;br /&gt;
6. An instructor should be able to see the teammate reviews for all students regardless of whether the show_teammate_reviews boolean is set to True or False.&lt;br /&gt;
&lt;br /&gt;
7. The reviewer id is tracked correctly to show the correct reviewer name in the teammate reviews table. This can be seen on line 27 in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/models/vm_question_response_score_cell_spec.rb this] file &lt;br /&gt;
&lt;br /&gt;
8. An instructor can select which student's scores he/she wants to see. If no student's name is selected then the professor can see the scores of all the students.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;https://expertiza.ncsu.edu/&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Agarg25</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141740</id>
		<title>CSC/ECE 517 Fall 2021 - E2165. Fix teammate-review view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141740"/>
		<updated>2021-11-28T18:08:52Z</updated>

		<summary type="html">&lt;p&gt;Agarg25: /* Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Introduction ==&lt;br /&gt;
&lt;br /&gt;
Dr. Edward Gehringer (instructor), Parimal Mehta (mentor)&lt;br /&gt;
&lt;br /&gt;
1. Anjali Garg (unity ID : agarg25)&lt;br /&gt;
&lt;br /&gt;
2. Arvasu Chikara (unity ID: achikar2)&lt;br /&gt;
&lt;br /&gt;
3. Lalit Bangad (unity ID: llbangad)&lt;br /&gt;
&lt;br /&gt;
4. Vinay Deshmukh (unity ID: vdeshmu)&lt;br /&gt;
&lt;br /&gt;
== Problems to be addressed ==&lt;br /&gt;
&lt;br /&gt;
After a project is submitted and reviewed, both the team members (students) and instructors should be able to view the teammate reviews. Students should be able to view the reviews by going to a particular assignment's -&amp;gt; your scores, at the bottom of the page. An instructor can view the teammate reviews by going to assignments -&amp;gt; assignment -&amp;gt; particular team's submission -&amp;gt; view submission -&amp;gt; assign grades -&amp;gt; view scores. &lt;br /&gt;
&lt;br /&gt;
In the case of the instructor, a single heat grid is shown whereas in the case of a team member, we cant view the scores. In the heat grid, it is not clear if the scores visible are for the reviews that the student has *written* for their teammates or the scores that the student has *received* from their teammates. Additionally, for instructors can choose from a list of the students on the team, but they have no way to tell whether the heat grid shows the reviews done *by* that student or done *for* that student.&lt;br /&gt;
&lt;br /&gt;
== Methodology Overview ==&lt;br /&gt;
&lt;br /&gt;
We have divided our work in the following tasks to address the above problems:&lt;br /&gt;
&lt;br /&gt;
1. Distinguish reviews done for a student by rendering separates heatgrids for each student&lt;br /&gt;
&lt;br /&gt;
2. For instructors, the table will have sections based on the students&lt;br /&gt;
&lt;br /&gt;
3. Include a checkbox on the edit assignment page that enables/disables visibility of heat grid to students&lt;br /&gt;
&lt;br /&gt;
4. Fix the average column for a table (which breaks for some reviews)&lt;br /&gt;
&lt;br /&gt;
5. Show a composite score derived from all reviews.  Make this code generalized, so other kinds of heat grid views could use it.&lt;br /&gt;
&lt;br /&gt;
6. Changes should work even in an anonymized view&lt;br /&gt;
&lt;br /&gt;
== Motivations ==&lt;br /&gt;
&lt;br /&gt;
1. Enable users to clearly tell which reviews are done by them, and which reviews are done for them.&lt;br /&gt;
&lt;br /&gt;
2. Code should be generic so it can be used for different types of heat grids as well.&lt;br /&gt;
&lt;br /&gt;
== Control Flow to access the concerned screens ==&lt;br /&gt;
'''1. For instructor (Log in as an instructor):-'''&lt;br /&gt;
&lt;br /&gt;
Screen after logging in by the instructor&lt;br /&gt;
[[File:ss1.png |border|1000px|center]]&lt;br /&gt;
Got to assignments on the Manage menu &lt;br /&gt;
[[File:ss2.png |border|1000px|center]]&lt;br /&gt;
Go to assignments&lt;br /&gt;
[[File:ss3.png |border|1000px|center]]&lt;br /&gt;
Go to submissions for any assignment&lt;br /&gt;
[[File:ss4a.png |border|1000px|center]]&lt;br /&gt;
Go to Assign Grade&lt;br /&gt;
[[File:ss5a.png |border|1000px|center]]&lt;br /&gt;
You will land on the page where the changes are made and can be reviewed&lt;br /&gt;
[[File:ss7a.png |border|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
'''2. Student:- (Logged in as an instructor)'''&lt;br /&gt;
&lt;br /&gt;
After landing on the assignments page, select any student from an assignment as shown below&lt;br /&gt;
[[File:ss6a.png |border|1000px|center]]&lt;br /&gt;
Go to/Select any assignment&lt;br /&gt;
[[File:ss9a.png |border|1000px|center]]&lt;br /&gt;
Go to your scores&lt;br /&gt;
[[File:ss10a.png |border|1000px|center]]&lt;br /&gt;
You will land on the page where the changes are made and can be reviewed&lt;br /&gt;
[[File:ss11a.png |border|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
== Old Status of the application ==&lt;br /&gt;
&lt;br /&gt;
'''1. Instructor's view of teammate review''': This is the current screen given to the instructor. Here we see that the instructor can not determine who has given which review to which student in a team.&lt;br /&gt;
&lt;br /&gt;
[[File:Instructor-view-1.png|border| 700px |center|alt=The proposed expanded student display.|The proposed expanded student display.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2. Student's view of teammate review''': Currently, a student is not able to see what grades were given by their teammates. We need to implement that functionality so that the student is able to view those grades.&lt;br /&gt;
&lt;br /&gt;
[[File:Student-view-2.png|border| 700px |center|alt=The current instructor view.|The current review display for instructors.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Error in existing UI for student''': In the existing UI for a student, the highlighted block should not be rendered. This part of the screen is meant for the instructors/TAs. &lt;br /&gt;
&lt;br /&gt;
[[File:Wrong render for student.png|border|700px|center|alt=Existing UI for student|Existing UI for student.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Proposed changes ==&lt;br /&gt;
&lt;br /&gt;
''' 1) Proposed UI for instructor ''': The instructor is able to see the score for all teammates. In the existing code, only one teammate's scores are being shown. But, we are planning to change the way the (VmQuestionResponse array is populated)[https://github.com/expertiza/expertiza/blob/master/app/controllers/grades_controller.rb#L114], so that the scores for all teammates are appended to it so it correctly shows what should have already been shown in this screen for the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Proposed_screen.png|border|700px|center|alt=Proposed UI for instructor|Proposed UI for instructor.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: When a student visits this screen, they will only be shown the reviews received by them, assuming the instructor has allowed visibility of teammate reviews to students.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' 2) Show detailed review for a particular question''': The instructor can see detailed review given to a student by their teammates by clicking on a particular question number in the table.&lt;br /&gt;
&lt;br /&gt;
[[File:ss12a.png|border|700px|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' 3) Show teammate review to student UI ''': The existing code doesn't render a student's teammate review scores at all. We are planning to render the scores to a student (as shown below) when they visit this screen. However, the visibility of this screen is contingent on whether the instructor has allowed visibility of the teammate review screen to students. If the instructor has disabled this feature, then the heatgrid will not be displayed at all.&lt;br /&gt;
&lt;br /&gt;
[[File:UI_for_student.png|border|700px|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
== Models used / Explanation of fixes ==&lt;br /&gt;
&lt;br /&gt;
The below diagram illustrates the proposed code change for showing all team members with the teammate review data to an instructor. The existing code only iterated on the `Participant` whose ID is present in the URL of the page. To fix this, we will iterate over all teammates of the given participant so that all teammate reviews for all team members are shown to the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Logic e2165.png|border|center|alt=Flow diagram of proposed changes for showing team review data to instructor]]&lt;br /&gt;
&lt;br /&gt;
===Changes made to the code are shown below. Every change is shown and explained separately===&lt;br /&gt;
&lt;br /&gt;
====A. Added the following to app/assets/stylesheets/grades.scss:====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    .teammate_table.hidden {&lt;br /&gt;
      display: none;&lt;br /&gt;
      }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====B. In app/controllers/grades_controller.rb: ====&lt;br /&gt;
&lt;br /&gt;
'''B.1:'''&lt;br /&gt;
&lt;br /&gt;
Old code: The existing code does not differentiate when adding a view model for the TeammateReview questionnaire&lt;br /&gt;
  questionnaires.each do |questionnaire|&lt;br /&gt;
     ...&lt;br /&gt;
     @vmlist &amp;lt;&amp;lt; populate_view_model(questionnaire)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
New code: Since the current page URL contains an ID for the participant, from which we get an assignment, which gives us a list of questionnaires, we need to iterate all participants for a `TeammateReveiwQuestionnaire` questionnaire, so that we get the heatgrid view models for all members of a team.&lt;br /&gt;
  questionnaires.each do |questionnaire|&lt;br /&gt;
     ...&lt;br /&gt;
     if questionnaire.type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
        # as teammate review will be different for each participant&lt;br /&gt;
        # we need to create a separate table for each teammate&lt;br /&gt;
        @participant.team.participants.each do |team_participant|&lt;br /&gt;
          @vmlist &amp;lt;&amp;lt; populate_view_model(team_participant, questionnaire, @team)&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        # only one participant needs iterating, as apart from teammatereview&lt;br /&gt;
        # all other reviews are at &amp;quot;team&amp;quot; level&lt;br /&gt;
        @vmlist &amp;lt;&amp;lt; populate_view_model(@participant, questionnaire, @team)&lt;br /&gt;
      end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
'''B.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code: This code uses @participant as an instance variable, but this structure will not work as we need to call this ViewModel with multiple participants when iterating for a teammate review questionnaire.&lt;br /&gt;
    def populate_view_model(questionnaire)&lt;br /&gt;
      vm = VmQuestionResponse.new(questionnaire, @assignment, @round)&lt;br /&gt;
      vmquestions = questionnaire.questions&lt;br /&gt;
      vm.add_questions(vmquestions)&lt;br /&gt;
      vm.add_team_members(@team)&lt;br /&gt;
      vm.add_reviews(@participant, @team, @assignment.vary_by_round)&lt;br /&gt;
      vm.number_of_comments_greater_than_10_words&lt;br /&gt;
      vm &lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
New code: We need to call this function with a separate participant in each invocation due to our change for TeammateReviewQuestionnaire, hence it makes sense to make `participant` as an argument to this function. Similarly, as `team` is a closely related model to `participant`, we are passing it as an argument, to keep this function as &amp;quot;pure&amp;quot; as possible.&lt;br /&gt;
    def populate_view_model(participant, questionnaire, team)&lt;br /&gt;
      ...&lt;br /&gt;
      vm.add_team_members(team)&lt;br /&gt;
      vm.add_reviews(participant, team, @assignment.vary_by_round)&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
====C. In app/models/vm_question_response.rb:====&lt;br /&gt;
&lt;br /&gt;
'''C.1: '''Added the reviewee_id method: Created a helper method within the VmQuestionReponse model to retrieve the `reviewee_id` for a heatgrid&lt;br /&gt;
&lt;br /&gt;
    def reviewee_id&lt;br /&gt;
      @participant_who_is_reviewee.user_id&lt;br /&gt;
    end &lt;br /&gt;
&lt;br /&gt;
'''C.2: '''Added the reviewee_name method: Created a helper method within the VmQuestionReponse model to retrieve the name of the student who is being reviewed for a heatgrid. This method uses the functionality to anonymize the name when we are in anonymized view.&lt;br /&gt;
&lt;br /&gt;
    def reviewee_name(ip_address = nil)&lt;br /&gt;
      part = @participant_who_is_reviewee&lt;br /&gt;
      User.find_by(id: part.user_id).fullname(ip_address)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''C.3: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Does not keep track of the student being reviewed&lt;br /&gt;
    elsif @questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
      reviews = participant.teammate_reviews&lt;br /&gt;
      reviews.each do |review|&lt;br /&gt;
        review_mapping = TeammateReviewResponseMap.find_by(id: review.map_id)&lt;br /&gt;
        participant = Participant.find(review_mapping.reviewer_id)&lt;br /&gt;
&lt;br /&gt;
New code: Add an instance variable to keep track of the student who is being reviewed in this VmQuestionReponse&lt;br /&gt;
    elsif @questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
      reviews = participant.teammate_reviews&lt;br /&gt;
      @participant_who_is_reviewee = participant&lt;br /&gt;
      reviews.each do |review|&lt;br /&gt;
        review_mapping = TeammateReviewResponseMap.find_by(id: review.map_id)&lt;br /&gt;
        participant = Participant.find(review_mapping.reviewer_id)&lt;br /&gt;
&lt;br /&gt;
'''C.4: '''&lt;br /&gt;
&lt;br /&gt;
Old code: Existing VmQuestionReponseScoreCell keeps no information about the reviewer, as it only stores the answer score&lt;br /&gt;
    row.score_row.push(VmQuestionResponseScoreCell.new(answer.answer, color_code, answer.comments, vm_tag_prompts))&lt;br /&gt;
&lt;br /&gt;
New code: Keep track of the response ID, so that we can retrieve the user ID for the reviewer in the model to use in the view file.&lt;br /&gt;
    &lt;br /&gt;
    row.score_row.push(VmQuestionResponseScoreCell.new(answer.answer, color_code, answer.comments, vm_tag_prompts, answer.response_id))&lt;br /&gt;
&lt;br /&gt;
====D. In app/models/vm_question_response_score_cell.rb:====&lt;br /&gt;
&lt;br /&gt;
'''D.1: '''In the method initialize of class VmQuestionResponseScoreCell&lt;br /&gt;
&lt;br /&gt;
Old code: Existing code doesn't keep track of the response id&lt;br /&gt;
    def initialize(score_value, color_code, comments, vmprompts = nil)&lt;br /&gt;
      @score_value = score_value&lt;br /&gt;
      @color_code = color_code&lt;br /&gt;
      @comment = comments&lt;br /&gt;
      @vm_prompts = vmprompts&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
New code: We added an instance variable to keep track of response_id&lt;br /&gt;
&lt;br /&gt;
    def initialize(score_value, color_code, comments, vmprompts = nil, response_id)&lt;br /&gt;
      ...&lt;br /&gt;
      @response_id = response_id&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''D.2: '''Added a method reviewer_id to the class VmQuestionResponseScoreCell: This helper method retrieves the ID for the reviewer who created this response.&lt;br /&gt;
&lt;br /&gt;
    def reviewer_id&lt;br /&gt;
      resp = Response.find(@response_id)&lt;br /&gt;
      map = ResponseMap.find(resp.map_id)&lt;br /&gt;
      map.reviewer_id&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
====E. In app/views/grades/_add_icon_to_name.html.erb:====&lt;br /&gt;
&lt;br /&gt;
'''E.1 '''Added the following code to the file:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;%# Determine the content of the reviewed by text %&amp;gt;&lt;br /&gt;
    &amp;lt;% review_text = &amp;quot;&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% if @current_role_name.eql?'Student' or questionnaire_type != &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
      &amp;lt;%# Use Review {{index}} format for student view, and when questionnaire_type is not teammatereview %&amp;gt;&lt;br /&gt;
      &amp;lt;% review_text = &amp;quot;Review #{i + 1}&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;% resp = Response.find(review.id) %&amp;gt;&lt;br /&gt;
      &amp;lt;% map = ResponseMap.find(resp.map_id) %&amp;gt;&lt;br /&gt;
      &amp;lt;% reviewer_id = map.reviewer_id %&amp;gt;&lt;br /&gt;
      &amp;lt;% fullname = Participant.find_by(id: reviewer_id).fullname(session[:ip]) %&amp;gt;&lt;br /&gt;
      &amp;lt;% review_text = &amp;quot;Review by #{fullname}&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% end%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''E.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;% if review.done_by_staff_participant? %&amp;gt;&lt;br /&gt;
      &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt; &amp;lt;img data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Icon indicates this review was done by course staff&amp;quot; class=&amp;quot;img_icon&amp;quot; src=&amp;quot;/assets/staff.png&amp;quot;&amp;gt; &amp;lt;a target=&amp;quot;_blank&amp;quot; href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Click to see details&amp;quot;&amp;gt;&amp;lt;%= &amp;quot;Review &amp;quot; + i.to_s  %&amp;gt;&amp;lt;/a&amp;gt; &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt; &amp;lt;a target=&amp;quot;_blank&amp;quot; href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Click to see details&amp;quot;&amp;gt;&amp;lt;%= &amp;quot;Review &amp;quot; + i.to_s %&amp;gt;&amp;lt;/a&amp;gt;  &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;% if review.done_by_staff_participant? %&amp;gt;&lt;br /&gt;
    &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;img&lt;br /&gt;
      data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
      data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
      title=&amp;quot;Icon indicates this review was done by course staff&amp;quot; class=&amp;quot;img_icon&amp;quot;&lt;br /&gt;
      src=&amp;quot;/assets/staff.png&amp;quot;&lt;br /&gt;
      &amp;gt;&lt;br /&gt;
    &amp;lt;a&lt;br /&gt;
      target=&amp;quot;_blank&amp;quot;&lt;br /&gt;
      href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;&lt;br /&gt;
      data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
      data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
      title=&amp;quot;Click to see details&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;%= review_text %&amp;gt;&lt;br /&gt;
    &amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
    &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;a&lt;br /&gt;
            target=&amp;quot;_blank&amp;quot; &lt;br /&gt;
            href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  &lt;br /&gt;
            data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
            data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
            title=&amp;quot;Click to see details&amp;quot;&lt;br /&gt;
        &amp;gt;&lt;br /&gt;
        &amp;lt;%= review_text %&amp;gt;&lt;br /&gt;
        &amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====F.In app/views/grades/view_team.html.erb:====&lt;br /&gt;
&lt;br /&gt;
'''F.1: '''Added function teammateSelectOnChange:&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  function teammateSelectOnChange(selectNode) {&lt;br /&gt;
      const revieweeIdToShow= selectNode.value;&lt;br /&gt;
      const tableSelector = &amp;quot;.teammate_table&amp;quot;;&lt;br /&gt;
      if(revieweeIdToShow == &amp;quot;all&amp;quot;) {&lt;br /&gt;
        document.querySelectorAll(tableSelector).forEach((tableNode) =&amp;gt; {&lt;br /&gt;
          tableNode.classList.remove(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
        });&lt;br /&gt;
        return;&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
  document.querySelectorAll(tableSelector).forEach((tableNode) =&amp;gt; {&lt;br /&gt;
    const tableRevieweeId = tableNode.getAttribute('data-reviewee_id');&lt;br /&gt;
    if(tableRevieweeId == revieweeIdToShow) {&lt;br /&gt;
      tableNode.classList.remove(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
    } else {&lt;br /&gt;
      tableNode.classList.add(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    });&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;% @vmlist.each do |vm| %&amp;gt;&lt;br /&gt;
        &amp;lt;% if (vm.questionnaire_display_type == &amp;quot;Metareview&amp;quot; or vm.questionnaire_display_type == &amp;quot;Author Feedback&amp;quot; or vm.questionnaire_display_type == &amp;quot;Teammate Review&amp;quot;) and @current_role_name.eql?'Student' %&amp;gt;&lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
        &amp;lt;% if vm.list_of_reviewers.length &amp;gt; 0 %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
​      &amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  @@ -87,6 +131,8 @@&lt;br /&gt;
              &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
                &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                    (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
        &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;%# This boolean is used to render a dropdown just before the first teammate review heat grid %&amp;gt;&lt;br /&gt;
&amp;lt;% first_teammate_review_appeared = false %&amp;gt;&lt;br /&gt;
&amp;lt;% @vmlist.each do |vm| %&amp;gt;&lt;br /&gt;
    &amp;lt;% if not @current_role_name.eql?'Student' and not first_teammate_review_appeared and vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        &amp;lt;select onchange=&amp;quot;teammateSelectOnChange(this)&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;all&amp;quot;&amp;gt;All&amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;% @vmlist.select { |tm_vm| tm_vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; }.each do |tm_vm| %&amp;gt;&lt;br /&gt;
            &amp;lt;option value=&amp;quot;&amp;lt;%= tm_vm.reviewee_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;%= tm_vm.reviewee_name(session[:ip]) %&amp;gt;&lt;br /&gt;
            &amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
        &amp;lt;/select&amp;gt;&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;% first_teammate_review_appeared = true %&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;% if (vm.questionnaire_display_type == &amp;quot;Metareview&amp;quot; or vm.questionnaire_display_type == &amp;quot;Author Feedback&amp;quot;) and @current_role_name.eql?'Student' %&amp;gt;&lt;br /&gt;
    &amp;lt;% elsif (vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; and @current_role_name.eql?'Student' and !@assignment.show_teammate_reviews)%&amp;gt;&lt;br /&gt;
    &amp;lt;% elsif (vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; and @current_role_name.eql?'Student' and @assignment.show_teammate_reviews and current_user.id != vm.reviewee_id )%&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
        &amp;lt;% if vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
          &amp;lt;div class=&amp;quot;teammate_table&amp;quot; data-reviewee_id=&amp;quot;&amp;lt;%= vm.reviewee_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
        &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.3  '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
@@ -87,6 +131,8 @@&lt;br /&gt;
          &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
            &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
@@ -87,6 +131,8 @@&lt;br /&gt;
          &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
            &amp;lt;% elsif vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (For: &amp;lt;%= vm.reviewee_name(session[:ip]) %&amp;gt;)&lt;br /&gt;
            &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.4 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_reviews.each do |review| %&amp;gt;&lt;br /&gt;
              &amp;lt;!-- instructors (or higher level users) see reviewer name, students see anonymized string --&amp;gt;&lt;br /&gt;
              &amp;lt;% if (['Student'].include? @current_role_name) &amp;amp;&amp;amp; @assignment.is_anonymous%&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i} %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                  &amp;lt;% user_name = User.find(Participant.find(ResponseMap.find(Response.find(review.id).map_id).reviewer_id).user_id).fullname(session[:ip]).to_s %&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i} %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% i += 1 %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-true&amp;quot; align=&amp;quot;right&amp;quot; &amp;gt;&lt;br /&gt;
            Avg&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;span  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;A count of comments, for the respective question, which have word count &amp;gt; 10. The purpose of this metric is to represent how many comments for the question are of a substantial length to provide quality feedback.&amp;quot;&amp;gt;metric-1&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/thead&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_reviews.each do |review| %&amp;gt;&lt;br /&gt;
              &amp;lt;!-- instructors (or higher level users) see reviewer name, students see anonymized string --&amp;gt;&lt;br /&gt;
              &amp;lt;% if (['Student'].include? @current_role_name) &amp;amp;&amp;amp; @assignment.is_anonymous%&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i, questionnaire_type: vm.questionnaire_type } %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                &amp;lt;% user_name = User.find(Participant.find(ResponseMap.find(Response.find(review.id).map_id).reviewer_id).user_id).fullname(session[:ip]).to_s %&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i, questionnaire_type: vm.questionnaire_type } %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% i += 1 %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-true&amp;quot; align=&amp;quot;right&amp;quot; &amp;gt;&lt;br /&gt;
            Avg&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/thead&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.5 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_rows.each do |row| %&amp;gt;&lt;br /&gt;
            &amp;lt;!-- notice the data-target. because we're toggling via looped code, we need to dynamically generate the identifier. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr data-toggle=&amp;quot;collapse&amp;quot; class=&amp;quot;accordion-toggle&amp;quot; data-target=&amp;quot;#hid&amp;lt;%= row.question_id.to_s + vm.round.to_s %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;td class = 'cf' data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= row.question_text %&amp;gt;&amp;quot;&amp;gt; &amp;lt;div style='float: left'&amp;gt;&amp;lt;%= j.to_s %&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div style='float: right'&amp;gt; &amp;amp;#&amp;lt;%= type_and_max(row) %&amp;gt;;&amp;lt;/div&amp;gt;  &amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
              &amp;lt;!-- actual cells with scores and colored background. --&amp;gt;&lt;br /&gt;
              &amp;lt;% row.score_row.each do |score| %&amp;gt;&lt;br /&gt;
                  &amp;lt;% score_comment = score.comment.nil? ? '' : score.comment %&amp;gt; &amp;lt;!-- changing nil to null string to avoid Null Pointer Exception --&amp;gt;&lt;br /&gt;
                  &amp;lt;td class=&amp;quot;&amp;lt;%= score.color_code %&amp;gt;&amp;quot; align=&amp;quot;center&amp;quot; data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= strip_tags(score.comment).html_safe%&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;&amp;lt;%=  underlined?(score) %&amp;gt;&amp;quot;&amp;gt;&amp;lt;%= score.score_value.to_s %&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
                  &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_rows.each do |row| %&amp;gt;&lt;br /&gt;
            &amp;lt;% target_id = &amp;quot;hid__#{row.question_id}__#{vm.round}&amp;quot; %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
              &amp;lt;%# Since we render different heatgrids with the same questions for each&lt;br /&gt;
              teammember, we need to distinguish the ID, based on the user for whom,&lt;br /&gt;
              the reviews have been created. %&amp;gt;&lt;br /&gt;
              &amp;lt;% target_id += &amp;quot;__#{vm.reviewee_id}&amp;quot; %&amp;gt;&lt;br /&gt;
            &amp;lt;% end%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;!-- notice the data-target. because we're toggling via looped code, we need to dynamically generate the identifier. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr data-toggle=&amp;quot;collapse&amp;quot; class=&amp;quot;accordion-toggle&amp;quot; data-target=&amp;quot;&amp;lt;%= &amp;quot;#&amp;quot; + target_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;td class = 'cf' data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= row.question_text %&amp;gt;&amp;quot;&amp;gt; &amp;lt;div style='float: left'&amp;gt;&amp;lt;%= j.to_s %&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div style='float: right'&amp;gt; &amp;amp;#&amp;lt;%= type_and_max(row) %&amp;gt;;&amp;lt;/div&amp;gt;  &amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
              &amp;lt;!-- actual cells with scores and colored background. --&amp;gt;&lt;br /&gt;
              &amp;lt;% row.score_row.each do |score| %&amp;gt;&lt;br /&gt;
                  &amp;lt;% score_comment = score.comment.nil? ? '' : score.comment %&amp;gt;&lt;br /&gt;
                  &amp;lt;!-- changing nil to null string to avoid Null Pointer Exception --&amp;gt;&lt;br /&gt;
                  &amp;lt;td class=&amp;quot;&amp;lt;%= score.color_code %&amp;gt;&amp;quot; align=&amp;quot;center&amp;quot; data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= strip_tags(score.comment).html_safe%&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;&amp;lt;%=  underlined?(score) %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                      &amp;lt;%= score.score_value.to_s %&amp;gt;&lt;br /&gt;
                    &amp;lt;/span&amp;gt;&lt;br /&gt;
                  &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.6 '''Removed the following code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 &amp;lt;td  class = 'cf' align=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;%= row.countofcomments.to_s %&amp;gt;&lt;br /&gt;
              &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.7 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!--loop that creates the collapsed-by-default row, which lists all comments. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr class=&amp;quot;tablesorter-childRow&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;td colspan=&amp;quot;&amp;lt;%= (i+1).to_s %&amp;gt;&amp;quot; class=&amp;quot;hiddenRow&amp;quot; &amp;gt;&amp;lt;div id=&amp;quot;hid&amp;lt;%= row.question_id.to_s + vm.round.to_s %&amp;gt;&amp;quot; class=&amp;quot;accordion-body collapse&amp;quot; style=&amp;quot;margin-left:10px;&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;div style=&amp;quot;padding-top: 10px; padding-bottom: 10px;&amp;quot;&amp;gt;&amp;lt;%=  sanitize row.question_text %&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;div&amp;gt;&lt;br /&gt;
                  &amp;lt;table class=&amp;quot;table tbl_questlist&amp;quot;&amp;gt;&lt;br /&gt;
@@ -181,7 +233,17 @@&lt;br /&gt;
                    &amp;lt;/thead&amp;gt;&lt;br /&gt;
                    &amp;lt;% for index in 0 .. row.score_row.length - 1 %&amp;gt;&lt;br /&gt;
                        &amp;lt;tr&amp;gt;&lt;br /&gt;
                          &amp;lt;td&amp;gt;Review &amp;lt;%=index + 1%&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!--loop that creates the collapsed-by-default row, which lists all comments. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr class=&amp;quot;tablesorter-childRow&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;td colspan=&amp;quot;&amp;lt;%= (i+1).to_s %&amp;gt;&amp;quot; class=&amp;quot;hiddenRow&amp;quot; &amp;gt;&amp;lt;div id=&amp;quot;&amp;lt;%= target_id %&amp;gt;&amp;quot; class=&amp;quot;accordion-body collapse&amp;quot; style=&amp;quot;margin-left:10px;&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;div style=&amp;quot;padding-top: 10px; padding-bottom: 10px;&amp;quot;&amp;gt;&amp;lt;%=  sanitize row.question_text %&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;div&amp;gt;&lt;br /&gt;
                  &amp;lt;table class=&amp;quot;table tbl_questlist&amp;quot;&amp;gt;&lt;br /&gt;
@@ -181,7 +233,17 @@&lt;br /&gt;
                    &amp;lt;/thead&amp;gt;&lt;br /&gt;
                    &amp;lt;% for index in 0 .. row.score_row.length - 1 %&amp;gt;&lt;br /&gt;
                        &amp;lt;tr&amp;gt;&lt;br /&gt;
                          &amp;lt;% if @current_role_name.eql?'Student' or vm.questionnaire_type != &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                            &amp;lt;%# Use Review {{index}} format for student view, and&lt;br /&gt;
                            when questionnaire_type is not teammatereview %&amp;gt;&lt;br /&gt;
                            &amp;lt;td&amp;gt;Review &amp;lt;%=index + 1%&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
                          &amp;lt;% else %&amp;gt;&lt;br /&gt;
                            &amp;lt;td&amp;gt;&lt;br /&gt;
                              &amp;lt;% reviewer_id = row.score_row[index].reviewer_id %&amp;gt;&lt;br /&gt;
                              &amp;lt;% fullname = Participant.find_by(id: reviewer_id).fullname(session[:ip]) %&amp;gt;&lt;br /&gt;
                              Review by &amp;lt;%= fullname %&amp;gt;&lt;br /&gt;
                            &amp;lt;/td&amp;gt;&lt;br /&gt;
                          &amp;lt;% end%&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====G. In spec/controllers/grades_controller_spec.rb:====&lt;br /&gt;
&lt;br /&gt;
'''G.1 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
before(:each) do&lt;br /&gt;
  allow(AssignmentParticipant).to receive(:find).with('1').and_return(participant)&lt;br /&gt;
  allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
  stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
@@ -91,29 +90,106 @@&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
before(:each) do&lt;br /&gt;
  allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
  stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
@@ -91,29 +90,106 @@&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''G.2 '''Remove xdescribe '#view_team' and change describe '#view_team' as follows.&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#view_team' do&lt;br /&gt;
render_views&lt;br /&gt;
context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
  it 'renders grades#view_team page' do&lt;br /&gt;
    allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
    allow(AssignmentQuestionnaire).to receive(:find_by).with(assignment_id: 1, questionnaire_id: 1).and_return(assignment_questionnaire)&lt;br /&gt;
    allow(AssignmentQuestionnaire).to receive(:where).with(any_args).and_return([assignment_questionnaire])&lt;br /&gt;
    allow(assignment).to receive(:late_policy_id).and_return(false)&lt;br /&gt;
    allow(assignment).to receive(:calculate_penalty).and_return(false)&lt;br /&gt;
    allow(assignment).to receive(:compute_total_score).with(any_args).and_return(100)&lt;br /&gt;
    allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
    allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
    params = {id: 1}&lt;br /&gt;
    allow(TaMapping).to receive(:exists?).with(ta_id: 1, course_id: 1).and_return(true)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#view_team' do&lt;br /&gt;
render_views&lt;br /&gt;
&lt;br /&gt;
# All stubs and factories are instantiated within this scope so as to not &lt;br /&gt;
# clash with other broken test.&lt;br /&gt;
# The names of the factories created for testing view_team&lt;br /&gt;
# have `_vt` suffix ```where necessary``` to differentiate them from &lt;br /&gt;
# the above declared factories&lt;br /&gt;
&lt;br /&gt;
let(:student1_vt) { create(:student, name: &amp;quot;barry&amp;quot;, id: 12) }&lt;br /&gt;
let(:student2_vt) { create(:student, name: &amp;quot;iris&amp;quot;, id: 13) }&lt;br /&gt;
&lt;br /&gt;
let(:tm_questionnaire) {&lt;br /&gt;
  build(&lt;br /&gt;
    :teammate_review_questionnaire,&lt;br /&gt;
    id: 12,&lt;br /&gt;
    questions: [question],&lt;br /&gt;
    max_question_score: 5&lt;br /&gt;
  )&lt;br /&gt;
}&lt;br /&gt;
let(:assignment_vt) {&lt;br /&gt;
  create(:assignment, id: 6, max_team_size: 2,&lt;br /&gt;
  questionnaires: [tm_questionnaire])&lt;br /&gt;
}&lt;br /&gt;
let(:assignment_questionnaire_vt) {&lt;br /&gt;
  create(:tm_assignment_questionnaire, id: 12, used_in_round: nil,&lt;br /&gt;
  assignment: assignment_vt, questionnaire: tm_questionnaire) }&lt;br /&gt;
let(:team_vt) { create(:assignment_team, id: 12,&lt;br /&gt;
assignment: assignment_vt) }&lt;br /&gt;
let(:participant_vt) { create(:participant, id: 12,&lt;br /&gt;
  assignment: assignment_vt, user_id: student1_vt.id) }&lt;br /&gt;
let(:participant2_vt) { create(:participant, id: 13,&lt;br /&gt;
  assignment: assignment_vt, user_id: student2_vt.id) }&lt;br /&gt;
&lt;br /&gt;
before(:each) do&lt;br /&gt;
  # Need to stub this method so the factory instance with&lt;br /&gt;
  # the stubbed :team method is returned by :find&lt;br /&gt;
  # instead of a separate instance with the same data&lt;br /&gt;
  allow(AssignmentParticipant)&lt;br /&gt;
    .to receive(:find)&lt;br /&gt;
    .with(participant_vt.id.to_s)&lt;br /&gt;
    .and_return(participant_vt)&lt;br /&gt;
  allow(participant_vt).to receive(:team).and_return(team_vt)&lt;br /&gt;
  allow(team_vt).to receive(:participants).and_return([participant_vt, participant2_vt])&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:find_by)&lt;br /&gt;
    .with(assignment_id: assignment_vt.id, questionnaire_id: tm_questionnaire.id)&lt;br /&gt;
    .and_return(assignment_questionnaire_vt)&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:find_by)&lt;br /&gt;
    .with(assignment_id: assignment.id, questionnaire_id: review_questionnaire.id)&lt;br /&gt;
    .and_return(assignment_questionnaire_vt)&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:where)&lt;br /&gt;
    .with(any_args)&lt;br /&gt;
    .and_return([assignment_questionnaire_vt])&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:late_policy_id)&lt;br /&gt;
    .and_return(false)&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:calculate_penalty)&lt;br /&gt;
    .and_return(false)&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:compute_total_score)&lt;br /&gt;
    .with(any_args)&lt;br /&gt;
    .and_return(100)&lt;br /&gt;
  allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
  allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
 it 'renders grades#view_team page' do&lt;br /&gt;
  params = {id: participant_vt.id}&lt;br /&gt;
  get :view_team, params&lt;br /&gt;
  expect(response).to render_template(:view_team)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is opened by student' do&lt;br /&gt;
  it 'dropdown is not rendered' do&lt;br /&gt;
    session = { user: student1_vt }&lt;br /&gt;
    params = {id: participant_vt.id}&lt;br /&gt;
    stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
    get :view_team, params&lt;br /&gt;
    expect(response.body).to_not have_selector('select')&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is opened by instructor' do&lt;br /&gt;
  it 'dropdown is rendered' do&lt;br /&gt;
    session = { user: instructor }&lt;br /&gt;
    params = {id: participant_vt.id}&lt;br /&gt;
    get :view_team, params&lt;br /&gt;
    expect(response.body).to have_selector('select')&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
  it 'renders grades#view_team page' do&lt;br /&gt;
    params = { id: participant_vt.id }&lt;br /&gt;
    allow(TaMapping).to receive(:exists?).with(ta_id: participant_vt.user_id, course_id: 1).and_return(true)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====H. In spec/factories/factories.rb:====&lt;br /&gt;
&lt;br /&gt;
'''H.1 '''Add the following factory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
factory :teammate_review_questionnaire, class: TeammateReviewQuestionnaire do&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''H.2 '''Add another factory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
factory :tm_assignment_questionnaire, class: AssignmentQuestionnaire do&lt;br /&gt;
  user_id 1&lt;br /&gt;
  questionnaire { association(:teammate_review_questionnaire) }&lt;br /&gt;
  questionnaire_weight 100&lt;br /&gt;
  used_in_round nil&lt;br /&gt;
  topic_id nil&lt;br /&gt;
  dropdown 1&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Summary of file changes ===&lt;br /&gt;
&lt;br /&gt;
The following files are modified:&lt;br /&gt;
&lt;br /&gt;
1. app/controllers/grades_controller.rb - Controller file which changed how the view model is populated&lt;br /&gt;
&lt;br /&gt;
2. app/views/grades/view_team.html.erb - View file, which  conditionally rendered the teammate name, for a teammate review heatgrid&lt;br /&gt;
&lt;br /&gt;
3. spec/controllers/grades_controller_spec.rb - For tests verifying the proposed changes&lt;br /&gt;
&lt;br /&gt;
4. app/models/vm_question_response.rb - To modify the view-model so it can tell us the name of the person being reviewed for the current heatgrid&lt;br /&gt;
&lt;br /&gt;
5. app/models/vm_question_response_score_cell.rb - &lt;br /&gt;
&lt;br /&gt;
6. app/assets/stylesheets/grades.scss - &lt;br /&gt;
&lt;br /&gt;
7. app/views/grades/_add_icon_to_name.html.erb - &lt;br /&gt;
&lt;br /&gt;
8. spec/factories/factories.rb -&lt;br /&gt;
&lt;br /&gt;
== Design Patterns ==&lt;br /&gt;
&lt;br /&gt;
Existing code does not use any design patterns, apart from if-else. It uses if-else conditional statements to check what type of questionnaire is present in the viewmodel `VmQuestionResponse`, and based on that, it renders the appropriate content.&lt;br /&gt;
&lt;br /&gt;
We decided to continue with this approach since to change the present coding style, there were required many changes (refactoring) to many files which were out of the scope of the present project. To complete the project in the assigned time, we followed the if-else approach.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== User Stories ==&lt;br /&gt;
&lt;br /&gt;
1. As an instructor, I can view what reviews one teammate has given to other teammates.&lt;br /&gt;
&lt;br /&gt;
2. As a student, I can view what reviews my teammates have given to me.&lt;br /&gt;
&lt;br /&gt;
3. As an instructor, I can select if a student's reviews are anonymously shown to their teammates.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
'''OLD STATUS'''&lt;br /&gt;
&lt;br /&gt;
1. Earlier, the tests only covered if the view_team is page is rendered when it is asked for. This can be seen on the line 94 and 103 in [https://github.com/expertiza/expertiza/blob/beta/spec/controllers/grades_controller_spec.rb this] file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''NEW STATUS'''&lt;br /&gt;
&lt;br /&gt;
1. The view_team page is rendered correctly for a given student or an instructor.&lt;br /&gt;
&lt;br /&gt;
2. When students access then the view_team page, the dropdown to select a student's teammate reviews is not rendered on the page.&lt;br /&gt;
&lt;br /&gt;
3. When instructor access then the view_team page, the dropdown to select a student's teammate reviews is rendered on the page.&lt;br /&gt;
&lt;br /&gt;
4. When a student who is also a TA for another course access the view_team page, that student should be able to a student's view to the page.&lt;br /&gt;
&lt;br /&gt;
5. If show_teammate_reviews boolean is set to False, then the student should not be able to see the teammate reviews given to him/her. If it is set to True, then the student should be able to see the reviews.&lt;br /&gt;
&lt;br /&gt;
6. An instructor should be able to see the teammate reviews for all students regardless of whether the show_teammate_reviews boolean is set to True or False.&lt;br /&gt;
&lt;br /&gt;
7. The reviewer id is tracked correctly to show the correct reviewer name in the teammate reviews table. This can be seen on line 27 in [https://github.com/expertiza/expertiza/blob/66239d9a8a53697ea170a92208593b36d06dfd24/spec/models/vm_question_response_score_cell_spec.rb this] file &lt;br /&gt;
&lt;br /&gt;
8. An instructor can select which student's scores he/she wants to see. If no student's name is selected then the professor can see the scores of all the students.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;https://expertiza.ncsu.edu/&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Agarg25</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141736</id>
		<title>CSC/ECE 517 Fall 2021 - E2165. Fix teammate-review view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141736"/>
		<updated>2021-11-28T17:31:37Z</updated>

		<summary type="html">&lt;p&gt;Agarg25: /* Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Introduction ==&lt;br /&gt;
&lt;br /&gt;
Dr. Edward Gehringer (instructor), Parimal Mehta (mentor)&lt;br /&gt;
&lt;br /&gt;
1. Anjali Garg (unity ID : agarg25)&lt;br /&gt;
&lt;br /&gt;
2. Arvasu Chikara (unity ID: achikar2)&lt;br /&gt;
&lt;br /&gt;
3. Lalit Bangad (unity ID: llbangad)&lt;br /&gt;
&lt;br /&gt;
4. Vinay Deshmukh (unity ID: vdeshmu)&lt;br /&gt;
&lt;br /&gt;
== Problems to be addressed ==&lt;br /&gt;
&lt;br /&gt;
After a project is submitted and reviewed, both the team members (students) and instructors should be able to view the teammate reviews. Students should be able to view the reviews by going to a particular assignment's -&amp;gt; your scores, at the bottom of the page. An instructor can view the teammate reviews by going to assignments -&amp;gt; assignment -&amp;gt; particular team's submission -&amp;gt; view submission -&amp;gt; assign grades -&amp;gt; view scores. &lt;br /&gt;
&lt;br /&gt;
In the case of the instructor, a single heat grid is shown whereas in the case of a team member, we cant view the scores. In the heat grid, it is not clear if the scores visible are for the reviews that the student has *written* for their teammates or the scores that the student has *received* from their teammates. Additionally, for instructors can choose from a list of the students on the team, but they have no way to tell whether the heat grid shows the reviews done *by* that student or done *for* that student.&lt;br /&gt;
&lt;br /&gt;
== Methodology Overview ==&lt;br /&gt;
&lt;br /&gt;
We have divided our work in the following tasks to address the above problems:&lt;br /&gt;
&lt;br /&gt;
1. Distinguish reviews done for a student by rendering separates heatgrids for each student&lt;br /&gt;
&lt;br /&gt;
2. For instructors, the table will have sections based on the students&lt;br /&gt;
&lt;br /&gt;
3. Include a checkbox on the edit assignment page that enables/disables visibility of heat grid to students&lt;br /&gt;
&lt;br /&gt;
4. Fix the average column for a table (which breaks for some reviews)&lt;br /&gt;
&lt;br /&gt;
5. Show a composite score derived from all reviews.  Make this code generalized, so other kinds of heat grid views could use it.&lt;br /&gt;
&lt;br /&gt;
6. Changes should work even in an anonymized view&lt;br /&gt;
&lt;br /&gt;
== Motivations ==&lt;br /&gt;
&lt;br /&gt;
1. Enable users to clearly tell which reviews are done by them, and which reviews are done for them.&lt;br /&gt;
&lt;br /&gt;
2. Code should be generic so it can be used for different types of heat grids as well.&lt;br /&gt;
&lt;br /&gt;
== Control Flow to access the concerned screens ==&lt;br /&gt;
'''1. For instructor (Log in as an instructor):-'''&lt;br /&gt;
&lt;br /&gt;
Screen after logging in by the instructor&lt;br /&gt;
[[File:ss1.png |border|1000px|center]]&lt;br /&gt;
Got to assignments on the Manage menu &lt;br /&gt;
[[File:ss2.png |border|1000px|center]]&lt;br /&gt;
Go to assignments&lt;br /&gt;
[[File:ss3.png |border|1000px|center]]&lt;br /&gt;
Go to submissions for any assignment&lt;br /&gt;
[[File:ss4a.png |border|1000px|center]]&lt;br /&gt;
Go to Assign Grade&lt;br /&gt;
[[File:ss5a.png |border|1000px|center]]&lt;br /&gt;
You will land on the page where the changes are made and can be reviewed&lt;br /&gt;
[[File:ss7a.png |border|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
'''2. Student:- (Logged in as an instructor)'''&lt;br /&gt;
&lt;br /&gt;
After landing on the assignments page, select any student from an assignment as shown below&lt;br /&gt;
[[File:ss6a.png |border|1000px|center]]&lt;br /&gt;
Go to/Select any assignment&lt;br /&gt;
[[File:ss9a.png |border|1000px|center]]&lt;br /&gt;
Go to your scores&lt;br /&gt;
[[File:ss10a.png |border|1000px|center]]&lt;br /&gt;
You will land on the page where the changes are made and can be reviewed&lt;br /&gt;
[[File:ss11a.png |border|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
== Old Status of the application ==&lt;br /&gt;
&lt;br /&gt;
'''1. Instructor's view of teammate review''': This is the current screen given to the instructor. Here we see that the instructor can not determine who has given which review to which student in a team.&lt;br /&gt;
&lt;br /&gt;
[[File:Instructor-view-1.png|border| 700px |center|alt=The proposed expanded student display.|The proposed expanded student display.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2. Student's view of teammate review''': Currently, a student is not able to see what grades were given by their teammates. We need to implement that functionality so that the student is able to view those grades.&lt;br /&gt;
&lt;br /&gt;
[[File:Student-view-2.png|border| 700px |center|alt=The current instructor view.|The current review display for instructors.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Error in existing UI for student''': In the existing UI for a student, the highlighted block should not be rendered. This part of the screen is meant for the instructors/TAs. &lt;br /&gt;
&lt;br /&gt;
[[File:Wrong render for student.png|border|700px|center|alt=Existing UI for student|Existing UI for student.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Proposed changes ==&lt;br /&gt;
&lt;br /&gt;
''' 1) Proposed UI for instructor ''': The instructor is able to see the score for all teammates. In the existing code, only one teammate's scores are being shown. But, we are planning to change the way the (VmQuestionResponse array is populated)[https://github.com/expertiza/expertiza/blob/master/app/controllers/grades_controller.rb#L114], so that the scores for all teammates are appended to it so it correctly shows what should have already been shown in this screen for the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Proposed_screen.png|border|700px|center|alt=Proposed UI for instructor|Proposed UI for instructor.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: When a student visits this screen, they will only be shown the reviews received by them, assuming the instructor has allowed visibility of teammate reviews to students.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' 2) Show detailed review for a particular question''': The instructor can see detailed review given to a student by their teammates by clicking on a particular question number in the table.&lt;br /&gt;
&lt;br /&gt;
[[File:ss12a.png|border|700px|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' 3) Show teammate review to student UI ''': The existing code doesn't render a student's teammate review scores at all. We are planning to render the scores to a student (as shown below) when they visit this screen. However, the visibility of this screen is contingent on whether the instructor has allowed visibility of the teammate review screen to students. If the instructor has disabled this feature, then the heatgrid will not be displayed at all.&lt;br /&gt;
&lt;br /&gt;
[[File:UI_for_student.png|border|700px|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
== Models used / Explanation of fixes ==&lt;br /&gt;
&lt;br /&gt;
The below diagram illustrates the proposed code change for showing all team members with the teammate review data to an instructor. The existing code only iterated on the `Participant` whose ID is present in the URL of the page. To fix this, we will iterate over all teammates of the given participant so that all teammate reviews for all team members are shown to the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Logic e2165.png|border|center|alt=Flow diagram of proposed changes for showing team review data to instructor]]&lt;br /&gt;
&lt;br /&gt;
===Changes made to the code are shown below. Every change is shown and explained separately===&lt;br /&gt;
&lt;br /&gt;
====A. Added the following to app/assets/stylesheets/grades.scss:====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    .teammate_table.hidden {&lt;br /&gt;
      display: none;&lt;br /&gt;
      }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====B. In app/controllers/grades_controller.rb: ====&lt;br /&gt;
&lt;br /&gt;
'''B.1:'''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
  @vmlist &amp;lt;&amp;lt; populate_view_model(questionnaire)&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
     if questionnaire.type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
        # as teammate review will be different for each participant&lt;br /&gt;
        # we need to create a separate table for each teammate&lt;br /&gt;
        @participant.team.participants.each do |team_participant|&lt;br /&gt;
          @vmlist &amp;lt;&amp;lt; populate_view_model(team_participant, questionnaire, @team)&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        # only one participant needs iterating, as apart from teammatereview&lt;br /&gt;
        # all other reviews are at &amp;quot;team&amp;quot; level&lt;br /&gt;
        @vmlist &amp;lt;&amp;lt; populate_view_model(@participant, questionnaire, @team)&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
'''B.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
    def populate_view_model(questionnaire)&lt;br /&gt;
      vm = VmQuestionResponse.new(questionnaire, @assignment, @round)&lt;br /&gt;
      vmquestions = questionnaire.questions&lt;br /&gt;
      vm.add_questions(vmquestions)&lt;br /&gt;
      vm.add_team_members(@team)&lt;br /&gt;
      vm.add_reviews(@participant, @team, @assignment.vary_by_round)&lt;br /&gt;
      vm.number_of_comments_greater_than_10_words&lt;br /&gt;
      vm &lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
    def populate_view_model(participant, questionnaire, team)&lt;br /&gt;
      vm = VmQuestionResponse.new(questionnaire, @assignment, @round)&lt;br /&gt;
      vmquestions = questionnaire.questions&lt;br /&gt;
      vm.add_questions(vmquestions)&lt;br /&gt;
      vm.add_team_members(team)&lt;br /&gt;
      vm.add_reviews(participant, team, @assignment.vary_by_round)&lt;br /&gt;
      vm.number_of_comments_greater_than_10_words&lt;br /&gt;
      vm&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====C. In app/models/vm_question_response.rb:====&lt;br /&gt;
&lt;br /&gt;
'''C.1: '''Added the reviewee_id method&lt;br /&gt;
&lt;br /&gt;
    def reviewee_id&lt;br /&gt;
      @participant_who_is_reviewee.user_id&lt;br /&gt;
    end &lt;br /&gt;
&lt;br /&gt;
'''C.2: '''Added the reviewee_name method&lt;br /&gt;
&lt;br /&gt;
    def reviewee_name(ip_address = nil)&lt;br /&gt;
      part = @participant_who_is_reviewee&lt;br /&gt;
      User.find_by(id: part.user_id).fullname(ip_address)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''C.3: '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
    elsif @questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
      reviews = participant.teammate_reviews&lt;br /&gt;
      reviews.each do |review|&lt;br /&gt;
        review_mapping = TeammateReviewResponseMap.find_by(id: review.map_id)&lt;br /&gt;
        participant = Participant.find(review_mapping.reviewer_id)&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
    elsif @questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
      reviews = participant.teammate_reviews&lt;br /&gt;
      @participant_who_is_reviewee = participant&lt;br /&gt;
      reviews.each do |review|&lt;br /&gt;
        review_mapping = TeammateReviewResponseMap.find_by(id: review.map_id)&lt;br /&gt;
        participant = Participant.find(review_mapping.reviewer_id)&lt;br /&gt;
&lt;br /&gt;
'''C.4: '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
    row.score_row.push(VmQuestionResponseScoreCell.new(answer.answer, color_code, answer.comments, vm_tag_prompts))&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
    &lt;br /&gt;
    row.score_row.push(VmQuestionResponseScoreCell.new(answer.answer, color_code, answer.comments, vm_tag_prompts, answer.response_id))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====D. In app/models/vm_question_response_score_cell.rb:====&lt;br /&gt;
&lt;br /&gt;
'''D.1: '''In the method initialize of class VmQuestionResponseScoreCell&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
    def initialize(score_value, color_code, comments, vmprompts = nil)&lt;br /&gt;
      @score_value = score_value&lt;br /&gt;
      @color_code = color_code&lt;br /&gt;
      @comment = comments&lt;br /&gt;
      @vm_prompts = vmprompts&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&lt;br /&gt;
    def initialize(score_value, color_code, comments, vmprompts = nil, response_id)&lt;br /&gt;
      @score_value = score_value&lt;br /&gt;
      @color_code = color_code&lt;br /&gt;
      @comment = comments&lt;br /&gt;
      @vm_prompts = vmprompts&lt;br /&gt;
      @response_id = response_id&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''D.2: '''Added a method reviewer_id to the class VmQuestionResponseScoreCell&lt;br /&gt;
&lt;br /&gt;
    def reviewer_id&lt;br /&gt;
      resp = Response.find(@response_id)&lt;br /&gt;
      map = ResponseMap.find(resp.map_id)&lt;br /&gt;
      map.reviewer_id&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====E. In app/views/grades/_add_icon_to_name.html.erb:====&lt;br /&gt;
&lt;br /&gt;
'''E.1 '''Added the following code to the file:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;%# Determine the content of the reviewed by text %&amp;gt;&lt;br /&gt;
    &amp;lt;% review_text = &amp;quot;&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% if @current_role_name.eql?'Student' or questionnaire_type != &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
      &amp;lt;%# Use Review {{index}} format for student view, and when questionnaire_type is not teammatereview %&amp;gt;&lt;br /&gt;
      &amp;lt;% review_text = &amp;quot;Review #{i + 1}&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;% resp = Response.find(review.id) %&amp;gt;&lt;br /&gt;
      &amp;lt;% map = ResponseMap.find(resp.map_id) %&amp;gt;&lt;br /&gt;
      &amp;lt;% reviewer_id = map.reviewer_id %&amp;gt;&lt;br /&gt;
      &amp;lt;% fullname = Participant.find_by(id: reviewer_id).fullname(session[:ip]) %&amp;gt;&lt;br /&gt;
      &amp;lt;% review_text = &amp;quot;Review by #{fullname}&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% end%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''E.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;% if review.done_by_staff_participant? %&amp;gt;&lt;br /&gt;
      &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt; &amp;lt;img data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Icon indicates this review was done by course staff&amp;quot; class=&amp;quot;img_icon&amp;quot; src=&amp;quot;/assets/staff.png&amp;quot;&amp;gt; &amp;lt;a target=&amp;quot;_blank&amp;quot; href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Click to see details&amp;quot;&amp;gt;&amp;lt;%= &amp;quot;Review &amp;quot; + i.to_s  %&amp;gt;&amp;lt;/a&amp;gt; &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt; &amp;lt;a target=&amp;quot;_blank&amp;quot; href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Click to see details&amp;quot;&amp;gt;&amp;lt;%= &amp;quot;Review &amp;quot; + i.to_s %&amp;gt;&amp;lt;/a&amp;gt;  &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;% if review.done_by_staff_participant? %&amp;gt;&lt;br /&gt;
    &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;img&lt;br /&gt;
      data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
      data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
      title=&amp;quot;Icon indicates this review was done by course staff&amp;quot; class=&amp;quot;img_icon&amp;quot;&lt;br /&gt;
      src=&amp;quot;/assets/staff.png&amp;quot;&lt;br /&gt;
      &amp;gt;&lt;br /&gt;
    &amp;lt;a&lt;br /&gt;
      target=&amp;quot;_blank&amp;quot;&lt;br /&gt;
      href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;&lt;br /&gt;
      data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
      data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
      title=&amp;quot;Click to see details&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;%= review_text %&amp;gt;&lt;br /&gt;
    &amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
    &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;a&lt;br /&gt;
            target=&amp;quot;_blank&amp;quot; &lt;br /&gt;
            href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  &lt;br /&gt;
            data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
            data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
            title=&amp;quot;Click to see details&amp;quot;&lt;br /&gt;
        &amp;gt;&lt;br /&gt;
        &amp;lt;%= review_text %&amp;gt;&lt;br /&gt;
        &amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====F.In app/views/grades/view_team.html.erb:====&lt;br /&gt;
&lt;br /&gt;
'''F.1: '''Added function teammateSelectOnChange:&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  function teammateSelectOnChange(selectNode) {&lt;br /&gt;
      const revieweeIdToShow= selectNode.value;&lt;br /&gt;
      const tableSelector = &amp;quot;.teammate_table&amp;quot;;&lt;br /&gt;
      if(revieweeIdToShow == &amp;quot;all&amp;quot;) {&lt;br /&gt;
        document.querySelectorAll(tableSelector).forEach((tableNode) =&amp;gt; {&lt;br /&gt;
          tableNode.classList.remove(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
        });&lt;br /&gt;
        return;&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
  document.querySelectorAll(tableSelector).forEach((tableNode) =&amp;gt; {&lt;br /&gt;
    const tableRevieweeId = tableNode.getAttribute('data-reviewee_id');&lt;br /&gt;
    if(tableRevieweeId == revieweeIdToShow) {&lt;br /&gt;
      tableNode.classList.remove(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
    } else {&lt;br /&gt;
      tableNode.classList.add(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    });&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;% @vmlist.each do |vm| %&amp;gt;&lt;br /&gt;
        &amp;lt;% if (vm.questionnaire_display_type == &amp;quot;Metareview&amp;quot; or vm.questionnaire_display_type == &amp;quot;Author Feedback&amp;quot; or vm.questionnaire_display_type == &amp;quot;Teammate Review&amp;quot;) and @current_role_name.eql?'Student' %&amp;gt;&lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
        &amp;lt;% if vm.list_of_reviewers.length &amp;gt; 0 %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
​      &amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  @@ -87,6 +131,8 @@&lt;br /&gt;
              &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
                &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                    (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
        &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;%# This boolean is used to render a dropdown just before the first teammate review heat grid %&amp;gt;&lt;br /&gt;
&amp;lt;% first_teammate_review_appeared = false %&amp;gt;&lt;br /&gt;
&amp;lt;% @vmlist.each do |vm| %&amp;gt;&lt;br /&gt;
    &amp;lt;% if not @current_role_name.eql?'Student' and not first_teammate_review_appeared and vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        &amp;lt;select onchange=&amp;quot;teammateSelectOnChange(this)&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;all&amp;quot;&amp;gt;All&amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;% @vmlist.select { |tm_vm| tm_vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; }.each do |tm_vm| %&amp;gt;&lt;br /&gt;
            &amp;lt;option value=&amp;quot;&amp;lt;%= tm_vm.reviewee_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;%= tm_vm.reviewee_name(session[:ip]) %&amp;gt;&lt;br /&gt;
            &amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
        &amp;lt;/select&amp;gt;&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;% first_teammate_review_appeared = true %&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;% if (vm.questionnaire_display_type == &amp;quot;Metareview&amp;quot; or vm.questionnaire_display_type == &amp;quot;Author Feedback&amp;quot;) and @current_role_name.eql?'Student' %&amp;gt;&lt;br /&gt;
    &amp;lt;% elsif (vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; and @current_role_name.eql?'Student' and !@assignment.show_teammate_reviews)%&amp;gt;&lt;br /&gt;
    &amp;lt;% elsif (vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; and @current_role_name.eql?'Student' and @assignment.show_teammate_reviews and current_user.id != vm.reviewee_id )%&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
        &amp;lt;% if vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
          &amp;lt;div class=&amp;quot;teammate_table&amp;quot; data-reviewee_id=&amp;quot;&amp;lt;%= vm.reviewee_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
        &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.3  '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
@@ -87,6 +131,8 @@&lt;br /&gt;
          &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
            &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
@@ -87,6 +131,8 @@&lt;br /&gt;
          &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
            &amp;lt;% elsif vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (For: &amp;lt;%= vm.reviewee_name(session[:ip]) %&amp;gt;)&lt;br /&gt;
            &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.4 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_reviews.each do |review| %&amp;gt;&lt;br /&gt;
              &amp;lt;!-- instructors (or higher level users) see reviewer name, students see anonymized string --&amp;gt;&lt;br /&gt;
              &amp;lt;% if (['Student'].include? @current_role_name) &amp;amp;&amp;amp; @assignment.is_anonymous%&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i} %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                  &amp;lt;% user_name = User.find(Participant.find(ResponseMap.find(Response.find(review.id).map_id).reviewer_id).user_id).fullname(session[:ip]).to_s %&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i} %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% i += 1 %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-true&amp;quot; align=&amp;quot;right&amp;quot; &amp;gt;&lt;br /&gt;
            Avg&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;span  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;A count of comments, for the respective question, which have word count &amp;gt; 10. The purpose of this metric is to represent how many comments for the question are of a substantial length to provide quality feedback.&amp;quot;&amp;gt;metric-1&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/thead&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_reviews.each do |review| %&amp;gt;&lt;br /&gt;
              &amp;lt;!-- instructors (or higher level users) see reviewer name, students see anonymized string --&amp;gt;&lt;br /&gt;
              &amp;lt;% if (['Student'].include? @current_role_name) &amp;amp;&amp;amp; @assignment.is_anonymous%&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i, questionnaire_type: vm.questionnaire_type } %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                &amp;lt;% user_name = User.find(Participant.find(ResponseMap.find(Response.find(review.id).map_id).reviewer_id).user_id).fullname(session[:ip]).to_s %&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i, questionnaire_type: vm.questionnaire_type } %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% i += 1 %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-true&amp;quot; align=&amp;quot;right&amp;quot; &amp;gt;&lt;br /&gt;
            Avg&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/thead&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.5 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_rows.each do |row| %&amp;gt;&lt;br /&gt;
            &amp;lt;!-- notice the data-target. because we're toggling via looped code, we need to dynamically generate the identifier. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr data-toggle=&amp;quot;collapse&amp;quot; class=&amp;quot;accordion-toggle&amp;quot; data-target=&amp;quot;#hid&amp;lt;%= row.question_id.to_s + vm.round.to_s %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;td class = 'cf' data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= row.question_text %&amp;gt;&amp;quot;&amp;gt; &amp;lt;div style='float: left'&amp;gt;&amp;lt;%= j.to_s %&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div style='float: right'&amp;gt; &amp;amp;#&amp;lt;%= type_and_max(row) %&amp;gt;;&amp;lt;/div&amp;gt;  &amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
              &amp;lt;!-- actual cells with scores and colored background. --&amp;gt;&lt;br /&gt;
              &amp;lt;% row.score_row.each do |score| %&amp;gt;&lt;br /&gt;
                  &amp;lt;% score_comment = score.comment.nil? ? '' : score.comment %&amp;gt; &amp;lt;!-- changing nil to null string to avoid Null Pointer Exception --&amp;gt;&lt;br /&gt;
                  &amp;lt;td class=&amp;quot;&amp;lt;%= score.color_code %&amp;gt;&amp;quot; align=&amp;quot;center&amp;quot; data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= strip_tags(score.comment).html_safe%&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;&amp;lt;%=  underlined?(score) %&amp;gt;&amp;quot;&amp;gt;&amp;lt;%= score.score_value.to_s %&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
                  &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_rows.each do |row| %&amp;gt;&lt;br /&gt;
            &amp;lt;% target_id = &amp;quot;hid__#{row.question_id}__#{vm.round}&amp;quot; %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
              &amp;lt;%# Since we render different heatgrids with the same questions for each&lt;br /&gt;
              teammember, we need to distinguish the ID, based on the user for whom,&lt;br /&gt;
              the reviews have been created. %&amp;gt;&lt;br /&gt;
              &amp;lt;% target_id += &amp;quot;__#{vm.reviewee_id}&amp;quot; %&amp;gt;&lt;br /&gt;
            &amp;lt;% end%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;!-- notice the data-target. because we're toggling via looped code, we need to dynamically generate the identifier. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr data-toggle=&amp;quot;collapse&amp;quot; class=&amp;quot;accordion-toggle&amp;quot; data-target=&amp;quot;&amp;lt;%= &amp;quot;#&amp;quot; + target_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;td class = 'cf' data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= row.question_text %&amp;gt;&amp;quot;&amp;gt; &amp;lt;div style='float: left'&amp;gt;&amp;lt;%= j.to_s %&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div style='float: right'&amp;gt; &amp;amp;#&amp;lt;%= type_and_max(row) %&amp;gt;;&amp;lt;/div&amp;gt;  &amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
              &amp;lt;!-- actual cells with scores and colored background. --&amp;gt;&lt;br /&gt;
              &amp;lt;% row.score_row.each do |score| %&amp;gt;&lt;br /&gt;
                  &amp;lt;% score_comment = score.comment.nil? ? '' : score.comment %&amp;gt;&lt;br /&gt;
                  &amp;lt;!-- changing nil to null string to avoid Null Pointer Exception --&amp;gt;&lt;br /&gt;
                  &amp;lt;td class=&amp;quot;&amp;lt;%= score.color_code %&amp;gt;&amp;quot; align=&amp;quot;center&amp;quot; data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= strip_tags(score.comment).html_safe%&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;&amp;lt;%=  underlined?(score) %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                      &amp;lt;%= score.score_value.to_s %&amp;gt;&lt;br /&gt;
                    &amp;lt;/span&amp;gt;&lt;br /&gt;
                  &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.6 '''Removed the following code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 &amp;lt;td  class = 'cf' align=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;%= row.countofcomments.to_s %&amp;gt;&lt;br /&gt;
              &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.7 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!--loop that creates the collapsed-by-default row, which lists all comments. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr class=&amp;quot;tablesorter-childRow&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;td colspan=&amp;quot;&amp;lt;%= (i+1).to_s %&amp;gt;&amp;quot; class=&amp;quot;hiddenRow&amp;quot; &amp;gt;&amp;lt;div id=&amp;quot;hid&amp;lt;%= row.question_id.to_s + vm.round.to_s %&amp;gt;&amp;quot; class=&amp;quot;accordion-body collapse&amp;quot; style=&amp;quot;margin-left:10px;&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;div style=&amp;quot;padding-top: 10px; padding-bottom: 10px;&amp;quot;&amp;gt;&amp;lt;%=  sanitize row.question_text %&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;div&amp;gt;&lt;br /&gt;
                  &amp;lt;table class=&amp;quot;table tbl_questlist&amp;quot;&amp;gt;&lt;br /&gt;
@@ -181,7 +233,17 @@&lt;br /&gt;
                    &amp;lt;/thead&amp;gt;&lt;br /&gt;
                    &amp;lt;% for index in 0 .. row.score_row.length - 1 %&amp;gt;&lt;br /&gt;
                        &amp;lt;tr&amp;gt;&lt;br /&gt;
                          &amp;lt;td&amp;gt;Review &amp;lt;%=index + 1%&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!--loop that creates the collapsed-by-default row, which lists all comments. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr class=&amp;quot;tablesorter-childRow&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;td colspan=&amp;quot;&amp;lt;%= (i+1).to_s %&amp;gt;&amp;quot; class=&amp;quot;hiddenRow&amp;quot; &amp;gt;&amp;lt;div id=&amp;quot;&amp;lt;%= target_id %&amp;gt;&amp;quot; class=&amp;quot;accordion-body collapse&amp;quot; style=&amp;quot;margin-left:10px;&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;div style=&amp;quot;padding-top: 10px; padding-bottom: 10px;&amp;quot;&amp;gt;&amp;lt;%=  sanitize row.question_text %&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;div&amp;gt;&lt;br /&gt;
                  &amp;lt;table class=&amp;quot;table tbl_questlist&amp;quot;&amp;gt;&lt;br /&gt;
@@ -181,7 +233,17 @@&lt;br /&gt;
                    &amp;lt;/thead&amp;gt;&lt;br /&gt;
                    &amp;lt;% for index in 0 .. row.score_row.length - 1 %&amp;gt;&lt;br /&gt;
                        &amp;lt;tr&amp;gt;&lt;br /&gt;
                          &amp;lt;% if @current_role_name.eql?'Student' or vm.questionnaire_type != &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                            &amp;lt;%# Use Review {{index}} format for student view, and&lt;br /&gt;
                            when questionnaire_type is not teammatereview %&amp;gt;&lt;br /&gt;
                            &amp;lt;td&amp;gt;Review &amp;lt;%=index + 1%&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
                          &amp;lt;% else %&amp;gt;&lt;br /&gt;
                            &amp;lt;td&amp;gt;&lt;br /&gt;
                              &amp;lt;% reviewer_id = row.score_row[index].reviewer_id %&amp;gt;&lt;br /&gt;
                              &amp;lt;% fullname = Participant.find_by(id: reviewer_id).fullname(session[:ip]) %&amp;gt;&lt;br /&gt;
                              Review by &amp;lt;%= fullname %&amp;gt;&lt;br /&gt;
                            &amp;lt;/td&amp;gt;&lt;br /&gt;
                          &amp;lt;% end%&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====G. In spec/controllers/grades_controller_spec.rb:====&lt;br /&gt;
&lt;br /&gt;
'''G.1 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
before(:each) do&lt;br /&gt;
  allow(AssignmentParticipant).to receive(:find).with('1').and_return(participant)&lt;br /&gt;
  allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
  stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
@@ -91,29 +90,106 @@&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
before(:each) do&lt;br /&gt;
  allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
  stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
@@ -91,29 +90,106 @@&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''G.2 '''Remove xdescribe '#view_team' and change describe '#view_team' as follows.&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#view_team' do&lt;br /&gt;
render_views&lt;br /&gt;
context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
  it 'renders grades#view_team page' do&lt;br /&gt;
    allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
    allow(AssignmentQuestionnaire).to receive(:find_by).with(assignment_id: 1, questionnaire_id: 1).and_return(assignment_questionnaire)&lt;br /&gt;
    allow(AssignmentQuestionnaire).to receive(:where).with(any_args).and_return([assignment_questionnaire])&lt;br /&gt;
    allow(assignment).to receive(:late_policy_id).and_return(false)&lt;br /&gt;
    allow(assignment).to receive(:calculate_penalty).and_return(false)&lt;br /&gt;
    allow(assignment).to receive(:compute_total_score).with(any_args).and_return(100)&lt;br /&gt;
    allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
    allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
    params = {id: 1}&lt;br /&gt;
    allow(TaMapping).to receive(:exists?).with(ta_id: 1, course_id: 1).and_return(true)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#view_team' do&lt;br /&gt;
render_views&lt;br /&gt;
&lt;br /&gt;
# All stubs and factories are instantiated within this scope so as to not &lt;br /&gt;
# clash with other broken test.&lt;br /&gt;
# The names of the factories created for testing view_team&lt;br /&gt;
# have `_vt` suffix ```where necessary``` to differentiate them from &lt;br /&gt;
# the above declared factories&lt;br /&gt;
&lt;br /&gt;
let(:student1_vt) { create(:student, name: &amp;quot;barry&amp;quot;, id: 12) }&lt;br /&gt;
let(:student2_vt) { create(:student, name: &amp;quot;iris&amp;quot;, id: 13) }&lt;br /&gt;
&lt;br /&gt;
let(:tm_questionnaire) {&lt;br /&gt;
  build(&lt;br /&gt;
    :teammate_review_questionnaire,&lt;br /&gt;
    id: 12,&lt;br /&gt;
    questions: [question],&lt;br /&gt;
    max_question_score: 5&lt;br /&gt;
  )&lt;br /&gt;
}&lt;br /&gt;
let(:assignment_vt) {&lt;br /&gt;
  create(:assignment, id: 6, max_team_size: 2,&lt;br /&gt;
  questionnaires: [tm_questionnaire])&lt;br /&gt;
}&lt;br /&gt;
let(:assignment_questionnaire_vt) {&lt;br /&gt;
  create(:tm_assignment_questionnaire, id: 12, used_in_round: nil,&lt;br /&gt;
  assignment: assignment_vt, questionnaire: tm_questionnaire) }&lt;br /&gt;
let(:team_vt) { create(:assignment_team, id: 12,&lt;br /&gt;
assignment: assignment_vt) }&lt;br /&gt;
let(:participant_vt) { create(:participant, id: 12,&lt;br /&gt;
  assignment: assignment_vt, user_id: student1_vt.id) }&lt;br /&gt;
let(:participant2_vt) { create(:participant, id: 13,&lt;br /&gt;
  assignment: assignment_vt, user_id: student2_vt.id) }&lt;br /&gt;
&lt;br /&gt;
before(:each) do&lt;br /&gt;
  # Need to stub this method so the factory instance with&lt;br /&gt;
  # the stubbed :team method is returned by :find&lt;br /&gt;
  # instead of a separate instance with the same data&lt;br /&gt;
  allow(AssignmentParticipant)&lt;br /&gt;
    .to receive(:find)&lt;br /&gt;
    .with(participant_vt.id.to_s)&lt;br /&gt;
    .and_return(participant_vt)&lt;br /&gt;
  allow(participant_vt).to receive(:team).and_return(team_vt)&lt;br /&gt;
  allow(team_vt).to receive(:participants).and_return([participant_vt, participant2_vt])&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:find_by)&lt;br /&gt;
    .with(assignment_id: assignment_vt.id, questionnaire_id: tm_questionnaire.id)&lt;br /&gt;
    .and_return(assignment_questionnaire_vt)&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:find_by)&lt;br /&gt;
    .with(assignment_id: assignment.id, questionnaire_id: review_questionnaire.id)&lt;br /&gt;
    .and_return(assignment_questionnaire_vt)&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:where)&lt;br /&gt;
    .with(any_args)&lt;br /&gt;
    .and_return([assignment_questionnaire_vt])&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:late_policy_id)&lt;br /&gt;
    .and_return(false)&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:calculate_penalty)&lt;br /&gt;
    .and_return(false)&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:compute_total_score)&lt;br /&gt;
    .with(any_args)&lt;br /&gt;
    .and_return(100)&lt;br /&gt;
  allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
  allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
 it 'renders grades#view_team page' do&lt;br /&gt;
  params = {id: participant_vt.id}&lt;br /&gt;
  get :view_team, params&lt;br /&gt;
  expect(response).to render_template(:view_team)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is opened by student' do&lt;br /&gt;
  it 'dropdown is not rendered' do&lt;br /&gt;
    session = { user: student1_vt }&lt;br /&gt;
    params = {id: participant_vt.id}&lt;br /&gt;
    stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
    get :view_team, params&lt;br /&gt;
    expect(response.body).to_not have_selector('select')&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is opened by instructor' do&lt;br /&gt;
  it 'dropdown is rendered' do&lt;br /&gt;
    session = { user: instructor }&lt;br /&gt;
    params = {id: participant_vt.id}&lt;br /&gt;
    get :view_team, params&lt;br /&gt;
    expect(response.body).to have_selector('select')&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
  it 'renders grades#view_team page' do&lt;br /&gt;
    params = { id: participant_vt.id }&lt;br /&gt;
    allow(TaMapping).to receive(:exists?).with(ta_id: participant_vt.user_id, course_id: 1).and_return(true)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====H. In spec/factories/factories.rb:====&lt;br /&gt;
&lt;br /&gt;
'''H.1 '''Add the following factory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
factory :teammate_review_questionnaire, class: TeammateReviewQuestionnaire do&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''H.2 '''Add another factory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
factory :tm_assignment_questionnaire, class: AssignmentQuestionnaire do&lt;br /&gt;
  user_id 1&lt;br /&gt;
  questionnaire { association(:teammate_review_questionnaire) }&lt;br /&gt;
  questionnaire_weight 100&lt;br /&gt;
  used_in_round nil&lt;br /&gt;
  topic_id nil&lt;br /&gt;
  dropdown 1&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Summary of file changes ===&lt;br /&gt;
&lt;br /&gt;
The following files are modified:&lt;br /&gt;
&lt;br /&gt;
1. app/controllers/grades_controller.rb - Controller file which changed how the view model is populated&lt;br /&gt;
&lt;br /&gt;
2. app/views/grades/view_team.html.erb - View file, which  conditionally rendered the teammate name, for a teammate review heatgrid&lt;br /&gt;
&lt;br /&gt;
3. spec/controllers/grades_controller_spec.rb - For tests verifying the proposed changes&lt;br /&gt;
&lt;br /&gt;
4. app/models/vm_question_response.rb - To modify the view-model so it can tell us the name of the person being reviewed for the current heatgrid&lt;br /&gt;
&lt;br /&gt;
5. app/models/vm_question_response_score_cell.rb - &lt;br /&gt;
&lt;br /&gt;
6. app/assets/stylesheets/grades.scss - &lt;br /&gt;
&lt;br /&gt;
7. app/views/grades/_add_icon_to_name.html.erb - &lt;br /&gt;
&lt;br /&gt;
8. spec/factories/factories.rb -&lt;br /&gt;
&lt;br /&gt;
== Design Patterns ==&lt;br /&gt;
&lt;br /&gt;
Existing code does not use any design patterns, apart from if-else. It uses if-else conditional statements to check what type of questionnaire is present in the viewmodel `VmQuestionResponse`, and based on that, it renders the appropriate content.&lt;br /&gt;
&lt;br /&gt;
We decided to continue with this approach since to change the present coding style, there were required many changes (refactoring) to many files which were out of the scope of the present project. To complete the project in the assigned time, we followed the if-else approach.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== User Stories ==&lt;br /&gt;
&lt;br /&gt;
1. As an instructor, I can view what reviews one teammate has given to other teammates.&lt;br /&gt;
&lt;br /&gt;
2. As a student, I can view what reviews my teammates have given to me.&lt;br /&gt;
&lt;br /&gt;
3. As an instructor, I can select if a student's reviews are anonymously shown to their teammates.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
'''CURRENT STATUS'''&lt;br /&gt;
&lt;br /&gt;
1. Presently, the tests only cover if the view_team is page is rendered when it is asked for. This can be seen in the following link: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''OUR PROPOSAL'''&lt;br /&gt;
&lt;br /&gt;
- When show_team is set as false by the professor, the student should not be able to see his scores.&lt;br /&gt;
&lt;br /&gt;
- When show_team is set as true by the professor, the student should be able to see his.&lt;br /&gt;
&lt;br /&gt;
- An instructor can select which student's scores he/she wants to see. If no student's name is selected then the professor can see the scores of all the students.&lt;br /&gt;
- The instructor can decide whether to show the names of the reviewer to the reviewer in teammate reviews, by selecting a checkbox for the same.&lt;br /&gt;
[[File:Untitled Diagram.drawio.png|border|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;https://expertiza.ncsu.edu/&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Agarg25</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141735</id>
		<title>CSC/ECE 517 Fall 2021 - E2165. Fix teammate-review view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141735"/>
		<updated>2021-11-28T17:29:01Z</updated>

		<summary type="html">&lt;p&gt;Agarg25: /* Models used / Explanation of fixes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Introduction ==&lt;br /&gt;
&lt;br /&gt;
Dr. Edward Gehringer (instructor), Parimal Mehta (mentor)&lt;br /&gt;
&lt;br /&gt;
1. Anjali Garg (unity ID : agarg25)&lt;br /&gt;
&lt;br /&gt;
2. Arvasu Chikara (unity ID: achikar2)&lt;br /&gt;
&lt;br /&gt;
3. Lalit Bangad (unity ID: llbangad)&lt;br /&gt;
&lt;br /&gt;
4. Vinay Deshmukh (unity ID: vdeshmu)&lt;br /&gt;
&lt;br /&gt;
== Problems to be addressed ==&lt;br /&gt;
&lt;br /&gt;
After a project is submitted and reviewed, both the team members (students) and instructors should be able to view the teammate reviews. Students should be able to view the reviews by going to a particular assignment's -&amp;gt; your scores, at the bottom of the page. An instructor can view the teammate reviews by going to assignments -&amp;gt; assignment -&amp;gt; particular team's submission -&amp;gt; view submission -&amp;gt; assign grades -&amp;gt; view scores. &lt;br /&gt;
&lt;br /&gt;
In the case of the instructor, a single heat grid is shown whereas in the case of a team member, we cant view the scores. In the heat grid, it is not clear if the scores visible are for the reviews that the student has *written* for their teammates or the scores that the student has *received* from their teammates. Additionally, for instructors can choose from a list of the students on the team, but they have no way to tell whether the heat grid shows the reviews done *by* that student or done *for* that student.&lt;br /&gt;
&lt;br /&gt;
== Methodology Overview ==&lt;br /&gt;
&lt;br /&gt;
We have divided our work in the following tasks to address the above problems:&lt;br /&gt;
&lt;br /&gt;
1. Distinguish reviews done for a student by rendering separates heatgrids for each student&lt;br /&gt;
&lt;br /&gt;
2. For instructors, the table will have sections based on the students&lt;br /&gt;
&lt;br /&gt;
3. Include a checkbox on the edit assignment page that enables/disables visibility of heat grid to students&lt;br /&gt;
&lt;br /&gt;
4. Fix the average column for a table (which breaks for some reviews)&lt;br /&gt;
&lt;br /&gt;
5. Show a composite score derived from all reviews.  Make this code generalized, so other kinds of heat grid views could use it.&lt;br /&gt;
&lt;br /&gt;
6. Changes should work even in an anonymized view&lt;br /&gt;
&lt;br /&gt;
== Motivations ==&lt;br /&gt;
&lt;br /&gt;
1. Enable users to clearly tell which reviews are done by them, and which reviews are done for them.&lt;br /&gt;
&lt;br /&gt;
2. Code should be generic so it can be used for different types of heat grids as well.&lt;br /&gt;
&lt;br /&gt;
== Control Flow to access the concerned screens ==&lt;br /&gt;
'''1. For instructor (Log in as an instructor):-'''&lt;br /&gt;
&lt;br /&gt;
Screen after logging in by the instructor&lt;br /&gt;
[[File:ss1.png |border|1000px|center]]&lt;br /&gt;
Got to assignments on the Manage menu &lt;br /&gt;
[[File:ss2.png |border|1000px|center]]&lt;br /&gt;
Go to assignments&lt;br /&gt;
[[File:ss3.png |border|1000px|center]]&lt;br /&gt;
Go to submissions for any assignment&lt;br /&gt;
[[File:ss4a.png |border|1000px|center]]&lt;br /&gt;
Go to Assign Grade&lt;br /&gt;
[[File:ss5a.png |border|1000px|center]]&lt;br /&gt;
You will land on the page where the changes are made and can be reviewed&lt;br /&gt;
[[File:ss7a.png |border|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
'''2. Student:- (Logged in as an instructor)'''&lt;br /&gt;
&lt;br /&gt;
After landing on the assignments page, select any student from an assignment as shown below&lt;br /&gt;
[[File:ss6a.png |border|1000px|center]]&lt;br /&gt;
Go to/Select any assignment&lt;br /&gt;
[[File:ss9a.png |border|1000px|center]]&lt;br /&gt;
Go to your scores&lt;br /&gt;
[[File:ss10a.png |border|1000px|center]]&lt;br /&gt;
You will land on the page where the changes are made and can be reviewed&lt;br /&gt;
[[File:ss11a.png |border|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
== Old Status of the application ==&lt;br /&gt;
&lt;br /&gt;
'''1. Instructor's view of teammate review''': This is the current screen given to the instructor. Here we see that the instructor can not determine who has given which review to which student in a team.&lt;br /&gt;
&lt;br /&gt;
[[File:Instructor-view-1.png|border| 700px |center|alt=The proposed expanded student display.|The proposed expanded student display.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2. Student's view of teammate review''': Currently, a student is not able to see what grades were given by their teammates. We need to implement that functionality so that the student is able to view those grades.&lt;br /&gt;
&lt;br /&gt;
[[File:Student-view-2.png|border| 700px |center|alt=The current instructor view.|The current review display for instructors.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Error in existing UI for student''': In the existing UI for a student, the highlighted block should not be rendered. This part of the screen is meant for the instructors/TAs. &lt;br /&gt;
&lt;br /&gt;
[[File:Wrong render for student.png|border|700px|center|alt=Existing UI for student|Existing UI for student.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Proposed changes ==&lt;br /&gt;
&lt;br /&gt;
''' 1) Proposed UI for instructor ''': The instructor is able to see the score for all teammates. In the existing code, only one teammate's scores are being shown. But, we are planning to change the way the (VmQuestionResponse array is populated)[https://github.com/expertiza/expertiza/blob/master/app/controllers/grades_controller.rb#L114], so that the scores for all teammates are appended to it so it correctly shows what should have already been shown in this screen for the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Proposed_screen.png|border|700px|center|alt=Proposed UI for instructor|Proposed UI for instructor.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: When a student visits this screen, they will only be shown the reviews received by them, assuming the instructor has allowed visibility of teammate reviews to students.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' 2) Show detailed review for a particular question''': The instructor can see detailed review given to a student by their teammates by clicking on a particular question number in the table.&lt;br /&gt;
&lt;br /&gt;
[[File:ss12a.png|border|700px|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' 3) Show teammate review to student UI ''': The existing code doesn't render a student's teammate review scores at all. We are planning to render the scores to a student (as shown below) when they visit this screen. However, the visibility of this screen is contingent on whether the instructor has allowed visibility of the teammate review screen to students. If the instructor has disabled this feature, then the heatgrid will not be displayed at all.&lt;br /&gt;
&lt;br /&gt;
[[File:UI_for_student.png|border|700px|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
== Models used / Explanation of fixes ==&lt;br /&gt;
&lt;br /&gt;
The below diagram illustrates the proposed code change for showing all team members with the teammate review data to an instructor. The existing code only iterated on the `Participant` whose ID is present in the URL of the page. To fix this, we will iterate over all teammates of the given participant so that all teammate reviews for all team members are shown to the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Logic e2165.png|border|center|alt=Flow diagram of proposed changes for showing team review data to instructor]]&lt;br /&gt;
&lt;br /&gt;
===Changes made to the code are shown below. Every change is shown and explained separately===&lt;br /&gt;
&lt;br /&gt;
====A. Added the following to app/assets/stylesheets/grades.scss:====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    .teammate_table.hidden {&lt;br /&gt;
      display: none;&lt;br /&gt;
      }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====B. In app/controllers/grades_controller.rb: ====&lt;br /&gt;
&lt;br /&gt;
'''B.1:'''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
  @vmlist &amp;lt;&amp;lt; populate_view_model(questionnaire)&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
     if questionnaire.type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
        # as teammate review will be different for each participant&lt;br /&gt;
        # we need to create a separate table for each teammate&lt;br /&gt;
        @participant.team.participants.each do |team_participant|&lt;br /&gt;
          @vmlist &amp;lt;&amp;lt; populate_view_model(team_participant, questionnaire, @team)&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        # only one participant needs iterating, as apart from teammatereview&lt;br /&gt;
        # all other reviews are at &amp;quot;team&amp;quot; level&lt;br /&gt;
        @vmlist &amp;lt;&amp;lt; populate_view_model(@participant, questionnaire, @team)&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
'''B.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
    def populate_view_model(questionnaire)&lt;br /&gt;
      vm = VmQuestionResponse.new(questionnaire, @assignment, @round)&lt;br /&gt;
      vmquestions = questionnaire.questions&lt;br /&gt;
      vm.add_questions(vmquestions)&lt;br /&gt;
      vm.add_team_members(@team)&lt;br /&gt;
      vm.add_reviews(@participant, @team, @assignment.vary_by_round)&lt;br /&gt;
      vm.number_of_comments_greater_than_10_words&lt;br /&gt;
      vm &lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
    def populate_view_model(participant, questionnaire, team)&lt;br /&gt;
      vm = VmQuestionResponse.new(questionnaire, @assignment, @round)&lt;br /&gt;
      vmquestions = questionnaire.questions&lt;br /&gt;
      vm.add_questions(vmquestions)&lt;br /&gt;
      vm.add_team_members(team)&lt;br /&gt;
      vm.add_reviews(participant, team, @assignment.vary_by_round)&lt;br /&gt;
      vm.number_of_comments_greater_than_10_words&lt;br /&gt;
      vm&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====C. In app/models/vm_question_response.rb:====&lt;br /&gt;
&lt;br /&gt;
'''C.1: '''Added the reviewee_id method&lt;br /&gt;
&lt;br /&gt;
    def reviewee_id&lt;br /&gt;
      @participant_who_is_reviewee.user_id&lt;br /&gt;
    end &lt;br /&gt;
&lt;br /&gt;
'''C.2: '''Added the reviewee_name method&lt;br /&gt;
&lt;br /&gt;
    def reviewee_name(ip_address = nil)&lt;br /&gt;
      part = @participant_who_is_reviewee&lt;br /&gt;
      User.find_by(id: part.user_id).fullname(ip_address)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''C.3: '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
    elsif @questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
      reviews = participant.teammate_reviews&lt;br /&gt;
      reviews.each do |review|&lt;br /&gt;
        review_mapping = TeammateReviewResponseMap.find_by(id: review.map_id)&lt;br /&gt;
        participant = Participant.find(review_mapping.reviewer_id)&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
    elsif @questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
      reviews = participant.teammate_reviews&lt;br /&gt;
      @participant_who_is_reviewee = participant&lt;br /&gt;
      reviews.each do |review|&lt;br /&gt;
        review_mapping = TeammateReviewResponseMap.find_by(id: review.map_id)&lt;br /&gt;
        participant = Participant.find(review_mapping.reviewer_id)&lt;br /&gt;
&lt;br /&gt;
'''C.4: '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
    row.score_row.push(VmQuestionResponseScoreCell.new(answer.answer, color_code, answer.comments, vm_tag_prompts))&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
    &lt;br /&gt;
    row.score_row.push(VmQuestionResponseScoreCell.new(answer.answer, color_code, answer.comments, vm_tag_prompts, answer.response_id))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====D. In app/models/vm_question_response_score_cell.rb:====&lt;br /&gt;
&lt;br /&gt;
'''D.1: '''In the method initialize of class VmQuestionResponseScoreCell&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
    def initialize(score_value, color_code, comments, vmprompts = nil)&lt;br /&gt;
      @score_value = score_value&lt;br /&gt;
      @color_code = color_code&lt;br /&gt;
      @comment = comments&lt;br /&gt;
      @vm_prompts = vmprompts&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&lt;br /&gt;
    def initialize(score_value, color_code, comments, vmprompts = nil, response_id)&lt;br /&gt;
      @score_value = score_value&lt;br /&gt;
      @color_code = color_code&lt;br /&gt;
      @comment = comments&lt;br /&gt;
      @vm_prompts = vmprompts&lt;br /&gt;
      @response_id = response_id&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''D.2: '''Added a method reviewer_id to the class VmQuestionResponseScoreCell&lt;br /&gt;
&lt;br /&gt;
    def reviewer_id&lt;br /&gt;
      resp = Response.find(@response_id)&lt;br /&gt;
      map = ResponseMap.find(resp.map_id)&lt;br /&gt;
      map.reviewer_id&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====E. In app/views/grades/_add_icon_to_name.html.erb:====&lt;br /&gt;
&lt;br /&gt;
'''E.1 '''Added the following code to the file:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;%# Determine the content of the reviewed by text %&amp;gt;&lt;br /&gt;
    &amp;lt;% review_text = &amp;quot;&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% if @current_role_name.eql?'Student' or questionnaire_type != &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
      &amp;lt;%# Use Review {{index}} format for student view, and when questionnaire_type is not teammatereview %&amp;gt;&lt;br /&gt;
      &amp;lt;% review_text = &amp;quot;Review #{i + 1}&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;% resp = Response.find(review.id) %&amp;gt;&lt;br /&gt;
      &amp;lt;% map = ResponseMap.find(resp.map_id) %&amp;gt;&lt;br /&gt;
      &amp;lt;% reviewer_id = map.reviewer_id %&amp;gt;&lt;br /&gt;
      &amp;lt;% fullname = Participant.find_by(id: reviewer_id).fullname(session[:ip]) %&amp;gt;&lt;br /&gt;
      &amp;lt;% review_text = &amp;quot;Review by #{fullname}&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% end%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''E.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;% if review.done_by_staff_participant? %&amp;gt;&lt;br /&gt;
      &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt; &amp;lt;img data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Icon indicates this review was done by course staff&amp;quot; class=&amp;quot;img_icon&amp;quot; src=&amp;quot;/assets/staff.png&amp;quot;&amp;gt; &amp;lt;a target=&amp;quot;_blank&amp;quot; href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Click to see details&amp;quot;&amp;gt;&amp;lt;%= &amp;quot;Review &amp;quot; + i.to_s  %&amp;gt;&amp;lt;/a&amp;gt; &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt; &amp;lt;a target=&amp;quot;_blank&amp;quot; href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Click to see details&amp;quot;&amp;gt;&amp;lt;%= &amp;quot;Review &amp;quot; + i.to_s %&amp;gt;&amp;lt;/a&amp;gt;  &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;% if review.done_by_staff_participant? %&amp;gt;&lt;br /&gt;
    &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;img&lt;br /&gt;
      data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
      data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
      title=&amp;quot;Icon indicates this review was done by course staff&amp;quot; class=&amp;quot;img_icon&amp;quot;&lt;br /&gt;
      src=&amp;quot;/assets/staff.png&amp;quot;&lt;br /&gt;
      &amp;gt;&lt;br /&gt;
    &amp;lt;a&lt;br /&gt;
      target=&amp;quot;_blank&amp;quot;&lt;br /&gt;
      href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;&lt;br /&gt;
      data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
      data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
      title=&amp;quot;Click to see details&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;%= review_text %&amp;gt;&lt;br /&gt;
    &amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
    &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;a&lt;br /&gt;
            target=&amp;quot;_blank&amp;quot; &lt;br /&gt;
            href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  &lt;br /&gt;
            data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
            data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
            title=&amp;quot;Click to see details&amp;quot;&lt;br /&gt;
        &amp;gt;&lt;br /&gt;
        &amp;lt;%= review_text %&amp;gt;&lt;br /&gt;
        &amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====F.In app/views/grades/view_team.html.erb:====&lt;br /&gt;
&lt;br /&gt;
'''F.1: '''Added function teammateSelectOnChange:&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  function teammateSelectOnChange(selectNode) {&lt;br /&gt;
      const revieweeIdToShow= selectNode.value;&lt;br /&gt;
      const tableSelector = &amp;quot;.teammate_table&amp;quot;;&lt;br /&gt;
      if(revieweeIdToShow == &amp;quot;all&amp;quot;) {&lt;br /&gt;
        document.querySelectorAll(tableSelector).forEach((tableNode) =&amp;gt; {&lt;br /&gt;
          tableNode.classList.remove(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
        });&lt;br /&gt;
        return;&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
  document.querySelectorAll(tableSelector).forEach((tableNode) =&amp;gt; {&lt;br /&gt;
    const tableRevieweeId = tableNode.getAttribute('data-reviewee_id');&lt;br /&gt;
    if(tableRevieweeId == revieweeIdToShow) {&lt;br /&gt;
      tableNode.classList.remove(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
    } else {&lt;br /&gt;
      tableNode.classList.add(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    });&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;% @vmlist.each do |vm| %&amp;gt;&lt;br /&gt;
        &amp;lt;% if (vm.questionnaire_display_type == &amp;quot;Metareview&amp;quot; or vm.questionnaire_display_type == &amp;quot;Author Feedback&amp;quot; or vm.questionnaire_display_type == &amp;quot;Teammate Review&amp;quot;) and @current_role_name.eql?'Student' %&amp;gt;&lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
        &amp;lt;% if vm.list_of_reviewers.length &amp;gt; 0 %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
​      &amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  @@ -87,6 +131,8 @@&lt;br /&gt;
              &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
                &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                    (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
        &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;%# This boolean is used to render a dropdown just before the first teammate review heat grid %&amp;gt;&lt;br /&gt;
&amp;lt;% first_teammate_review_appeared = false %&amp;gt;&lt;br /&gt;
&amp;lt;% @vmlist.each do |vm| %&amp;gt;&lt;br /&gt;
    &amp;lt;% if not @current_role_name.eql?'Student' and not first_teammate_review_appeared and vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        &amp;lt;select onchange=&amp;quot;teammateSelectOnChange(this)&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;all&amp;quot;&amp;gt;All&amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;% @vmlist.select { |tm_vm| tm_vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; }.each do |tm_vm| %&amp;gt;&lt;br /&gt;
            &amp;lt;option value=&amp;quot;&amp;lt;%= tm_vm.reviewee_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;%= tm_vm.reviewee_name(session[:ip]) %&amp;gt;&lt;br /&gt;
            &amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
        &amp;lt;/select&amp;gt;&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;% first_teammate_review_appeared = true %&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;% if (vm.questionnaire_display_type == &amp;quot;Metareview&amp;quot; or vm.questionnaire_display_type == &amp;quot;Author Feedback&amp;quot;) and @current_role_name.eql?'Student' %&amp;gt;&lt;br /&gt;
    &amp;lt;% elsif (vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; and @current_role_name.eql?'Student' and !@assignment.show_teammate_reviews)%&amp;gt;&lt;br /&gt;
    &amp;lt;% elsif (vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; and @current_role_name.eql?'Student' and @assignment.show_teammate_reviews and current_user.id != vm.reviewee_id )%&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
        &amp;lt;% if vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
          &amp;lt;div class=&amp;quot;teammate_table&amp;quot; data-reviewee_id=&amp;quot;&amp;lt;%= vm.reviewee_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
        &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.3  '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
@@ -87,6 +131,8 @@&lt;br /&gt;
          &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
            &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
@@ -87,6 +131,8 @@&lt;br /&gt;
          &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
            &amp;lt;% elsif vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (For: &amp;lt;%= vm.reviewee_name(session[:ip]) %&amp;gt;)&lt;br /&gt;
            &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.4 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_reviews.each do |review| %&amp;gt;&lt;br /&gt;
              &amp;lt;!-- instructors (or higher level users) see reviewer name, students see anonymized string --&amp;gt;&lt;br /&gt;
              &amp;lt;% if (['Student'].include? @current_role_name) &amp;amp;&amp;amp; @assignment.is_anonymous%&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i} %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                  &amp;lt;% user_name = User.find(Participant.find(ResponseMap.find(Response.find(review.id).map_id).reviewer_id).user_id).fullname(session[:ip]).to_s %&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i} %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% i += 1 %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-true&amp;quot; align=&amp;quot;right&amp;quot; &amp;gt;&lt;br /&gt;
            Avg&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;span  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;A count of comments, for the respective question, which have word count &amp;gt; 10. The purpose of this metric is to represent how many comments for the question are of a substantial length to provide quality feedback.&amp;quot;&amp;gt;metric-1&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/thead&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_reviews.each do |review| %&amp;gt;&lt;br /&gt;
              &amp;lt;!-- instructors (or higher level users) see reviewer name, students see anonymized string --&amp;gt;&lt;br /&gt;
              &amp;lt;% if (['Student'].include? @current_role_name) &amp;amp;&amp;amp; @assignment.is_anonymous%&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i, questionnaire_type: vm.questionnaire_type } %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                &amp;lt;% user_name = User.find(Participant.find(ResponseMap.find(Response.find(review.id).map_id).reviewer_id).user_id).fullname(session[:ip]).to_s %&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i, questionnaire_type: vm.questionnaire_type } %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% i += 1 %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-true&amp;quot; align=&amp;quot;right&amp;quot; &amp;gt;&lt;br /&gt;
            Avg&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/thead&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.5 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_rows.each do |row| %&amp;gt;&lt;br /&gt;
            &amp;lt;!-- notice the data-target. because we're toggling via looped code, we need to dynamically generate the identifier. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr data-toggle=&amp;quot;collapse&amp;quot; class=&amp;quot;accordion-toggle&amp;quot; data-target=&amp;quot;#hid&amp;lt;%= row.question_id.to_s + vm.round.to_s %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;td class = 'cf' data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= row.question_text %&amp;gt;&amp;quot;&amp;gt; &amp;lt;div style='float: left'&amp;gt;&amp;lt;%= j.to_s %&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div style='float: right'&amp;gt; &amp;amp;#&amp;lt;%= type_and_max(row) %&amp;gt;;&amp;lt;/div&amp;gt;  &amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
              &amp;lt;!-- actual cells with scores and colored background. --&amp;gt;&lt;br /&gt;
              &amp;lt;% row.score_row.each do |score| %&amp;gt;&lt;br /&gt;
                  &amp;lt;% score_comment = score.comment.nil? ? '' : score.comment %&amp;gt; &amp;lt;!-- changing nil to null string to avoid Null Pointer Exception --&amp;gt;&lt;br /&gt;
                  &amp;lt;td class=&amp;quot;&amp;lt;%= score.color_code %&amp;gt;&amp;quot; align=&amp;quot;center&amp;quot; data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= strip_tags(score.comment).html_safe%&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;&amp;lt;%=  underlined?(score) %&amp;gt;&amp;quot;&amp;gt;&amp;lt;%= score.score_value.to_s %&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
                  &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_rows.each do |row| %&amp;gt;&lt;br /&gt;
            &amp;lt;% target_id = &amp;quot;hid__#{row.question_id}__#{vm.round}&amp;quot; %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
              &amp;lt;%# Since we render different heatgrids with the same questions for each&lt;br /&gt;
              teammember, we need to distinguish the ID, based on the user for whom,&lt;br /&gt;
              the reviews have been created. %&amp;gt;&lt;br /&gt;
              &amp;lt;% target_id += &amp;quot;__#{vm.reviewee_id}&amp;quot; %&amp;gt;&lt;br /&gt;
            &amp;lt;% end%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;!-- notice the data-target. because we're toggling via looped code, we need to dynamically generate the identifier. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr data-toggle=&amp;quot;collapse&amp;quot; class=&amp;quot;accordion-toggle&amp;quot; data-target=&amp;quot;&amp;lt;%= &amp;quot;#&amp;quot; + target_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;td class = 'cf' data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= row.question_text %&amp;gt;&amp;quot;&amp;gt; &amp;lt;div style='float: left'&amp;gt;&amp;lt;%= j.to_s %&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div style='float: right'&amp;gt; &amp;amp;#&amp;lt;%= type_and_max(row) %&amp;gt;;&amp;lt;/div&amp;gt;  &amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
              &amp;lt;!-- actual cells with scores and colored background. --&amp;gt;&lt;br /&gt;
              &amp;lt;% row.score_row.each do |score| %&amp;gt;&lt;br /&gt;
                  &amp;lt;% score_comment = score.comment.nil? ? '' : score.comment %&amp;gt;&lt;br /&gt;
                  &amp;lt;!-- changing nil to null string to avoid Null Pointer Exception --&amp;gt;&lt;br /&gt;
                  &amp;lt;td class=&amp;quot;&amp;lt;%= score.color_code %&amp;gt;&amp;quot; align=&amp;quot;center&amp;quot; data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= strip_tags(score.comment).html_safe%&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;&amp;lt;%=  underlined?(score) %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                      &amp;lt;%= score.score_value.to_s %&amp;gt;&lt;br /&gt;
                    &amp;lt;/span&amp;gt;&lt;br /&gt;
                  &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.6 '''Removed the following code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 &amp;lt;td  class = 'cf' align=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;%= row.countofcomments.to_s %&amp;gt;&lt;br /&gt;
              &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.7 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!--loop that creates the collapsed-by-default row, which lists all comments. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr class=&amp;quot;tablesorter-childRow&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;td colspan=&amp;quot;&amp;lt;%= (i+1).to_s %&amp;gt;&amp;quot; class=&amp;quot;hiddenRow&amp;quot; &amp;gt;&amp;lt;div id=&amp;quot;hid&amp;lt;%= row.question_id.to_s + vm.round.to_s %&amp;gt;&amp;quot; class=&amp;quot;accordion-body collapse&amp;quot; style=&amp;quot;margin-left:10px;&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;div style=&amp;quot;padding-top: 10px; padding-bottom: 10px;&amp;quot;&amp;gt;&amp;lt;%=  sanitize row.question_text %&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;div&amp;gt;&lt;br /&gt;
                  &amp;lt;table class=&amp;quot;table tbl_questlist&amp;quot;&amp;gt;&lt;br /&gt;
@@ -181,7 +233,17 @@&lt;br /&gt;
                    &amp;lt;/thead&amp;gt;&lt;br /&gt;
                    &amp;lt;% for index in 0 .. row.score_row.length - 1 %&amp;gt;&lt;br /&gt;
                        &amp;lt;tr&amp;gt;&lt;br /&gt;
                          &amp;lt;td&amp;gt;Review &amp;lt;%=index + 1%&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!--loop that creates the collapsed-by-default row, which lists all comments. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr class=&amp;quot;tablesorter-childRow&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;td colspan=&amp;quot;&amp;lt;%= (i+1).to_s %&amp;gt;&amp;quot; class=&amp;quot;hiddenRow&amp;quot; &amp;gt;&amp;lt;div id=&amp;quot;&amp;lt;%= target_id %&amp;gt;&amp;quot; class=&amp;quot;accordion-body collapse&amp;quot; style=&amp;quot;margin-left:10px;&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;div style=&amp;quot;padding-top: 10px; padding-bottom: 10px;&amp;quot;&amp;gt;&amp;lt;%=  sanitize row.question_text %&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;div&amp;gt;&lt;br /&gt;
                  &amp;lt;table class=&amp;quot;table tbl_questlist&amp;quot;&amp;gt;&lt;br /&gt;
@@ -181,7 +233,17 @@&lt;br /&gt;
                    &amp;lt;/thead&amp;gt;&lt;br /&gt;
                    &amp;lt;% for index in 0 .. row.score_row.length - 1 %&amp;gt;&lt;br /&gt;
                        &amp;lt;tr&amp;gt;&lt;br /&gt;
                          &amp;lt;% if @current_role_name.eql?'Student' or vm.questionnaire_type != &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                            &amp;lt;%# Use Review {{index}} format for student view, and&lt;br /&gt;
                            when questionnaire_type is not teammatereview %&amp;gt;&lt;br /&gt;
                            &amp;lt;td&amp;gt;Review &amp;lt;%=index + 1%&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
                          &amp;lt;% else %&amp;gt;&lt;br /&gt;
                            &amp;lt;td&amp;gt;&lt;br /&gt;
                              &amp;lt;% reviewer_id = row.score_row[index].reviewer_id %&amp;gt;&lt;br /&gt;
                              &amp;lt;% fullname = Participant.find_by(id: reviewer_id).fullname(session[:ip]) %&amp;gt;&lt;br /&gt;
                              Review by &amp;lt;%= fullname %&amp;gt;&lt;br /&gt;
                            &amp;lt;/td&amp;gt;&lt;br /&gt;
                          &amp;lt;% end%&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====G. In spec/controllers/grades_controller_spec.rb:====&lt;br /&gt;
&lt;br /&gt;
'''G.1 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
before(:each) do&lt;br /&gt;
  allow(AssignmentParticipant).to receive(:find).with('1').and_return(participant)&lt;br /&gt;
  allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
  stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
@@ -91,29 +90,106 @@&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
before(:each) do&lt;br /&gt;
  allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
  stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
@@ -91,29 +90,106 @@&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''G.2 '''Remove xdescribe '#view_team' and change describe '#view_team' as follows.&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#view_team' do&lt;br /&gt;
render_views&lt;br /&gt;
context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
  it 'renders grades#view_team page' do&lt;br /&gt;
    allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
    allow(AssignmentQuestionnaire).to receive(:find_by).with(assignment_id: 1, questionnaire_id: 1).and_return(assignment_questionnaire)&lt;br /&gt;
    allow(AssignmentQuestionnaire).to receive(:where).with(any_args).and_return([assignment_questionnaire])&lt;br /&gt;
    allow(assignment).to receive(:late_policy_id).and_return(false)&lt;br /&gt;
    allow(assignment).to receive(:calculate_penalty).and_return(false)&lt;br /&gt;
    allow(assignment).to receive(:compute_total_score).with(any_args).and_return(100)&lt;br /&gt;
    allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
    allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
    params = {id: 1}&lt;br /&gt;
    allow(TaMapping).to receive(:exists?).with(ta_id: 1, course_id: 1).and_return(true)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#view_team' do&lt;br /&gt;
render_views&lt;br /&gt;
&lt;br /&gt;
# All stubs and factories are instantiated within this scope so as to not &lt;br /&gt;
# clash with other broken test.&lt;br /&gt;
# The names of the factories created for testing view_team&lt;br /&gt;
# have `_vt` suffix ```where necessary``` to differentiate them from &lt;br /&gt;
# the above declared factories&lt;br /&gt;
&lt;br /&gt;
let(:student1_vt) { create(:student, name: &amp;quot;barry&amp;quot;, id: 12) }&lt;br /&gt;
let(:student2_vt) { create(:student, name: &amp;quot;iris&amp;quot;, id: 13) }&lt;br /&gt;
&lt;br /&gt;
let(:tm_questionnaire) {&lt;br /&gt;
  build(&lt;br /&gt;
    :teammate_review_questionnaire,&lt;br /&gt;
    id: 12,&lt;br /&gt;
    questions: [question],&lt;br /&gt;
    max_question_score: 5&lt;br /&gt;
  )&lt;br /&gt;
}&lt;br /&gt;
let(:assignment_vt) {&lt;br /&gt;
  create(:assignment, id: 6, max_team_size: 2,&lt;br /&gt;
  questionnaires: [tm_questionnaire])&lt;br /&gt;
}&lt;br /&gt;
let(:assignment_questionnaire_vt) {&lt;br /&gt;
  create(:tm_assignment_questionnaire, id: 12, used_in_round: nil,&lt;br /&gt;
  assignment: assignment_vt, questionnaire: tm_questionnaire) }&lt;br /&gt;
let(:team_vt) { create(:assignment_team, id: 12,&lt;br /&gt;
assignment: assignment_vt) }&lt;br /&gt;
let(:participant_vt) { create(:participant, id: 12,&lt;br /&gt;
  assignment: assignment_vt, user_id: student1_vt.id) }&lt;br /&gt;
let(:participant2_vt) { create(:participant, id: 13,&lt;br /&gt;
  assignment: assignment_vt, user_id: student2_vt.id) }&lt;br /&gt;
&lt;br /&gt;
before(:each) do&lt;br /&gt;
  # Need to stub this method so the factory instance with&lt;br /&gt;
  # the stubbed :team method is returned by :find&lt;br /&gt;
  # instead of a separate instance with the same data&lt;br /&gt;
  allow(AssignmentParticipant)&lt;br /&gt;
    .to receive(:find)&lt;br /&gt;
    .with(participant_vt.id.to_s)&lt;br /&gt;
    .and_return(participant_vt)&lt;br /&gt;
  allow(participant_vt).to receive(:team).and_return(team_vt)&lt;br /&gt;
  allow(team_vt).to receive(:participants).and_return([participant_vt, participant2_vt])&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:find_by)&lt;br /&gt;
    .with(assignment_id: assignment_vt.id, questionnaire_id: tm_questionnaire.id)&lt;br /&gt;
    .and_return(assignment_questionnaire_vt)&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:find_by)&lt;br /&gt;
    .with(assignment_id: assignment.id, questionnaire_id: review_questionnaire.id)&lt;br /&gt;
    .and_return(assignment_questionnaire_vt)&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:where)&lt;br /&gt;
    .with(any_args)&lt;br /&gt;
    .and_return([assignment_questionnaire_vt])&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:late_policy_id)&lt;br /&gt;
    .and_return(false)&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:calculate_penalty)&lt;br /&gt;
    .and_return(false)&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:compute_total_score)&lt;br /&gt;
    .with(any_args)&lt;br /&gt;
    .and_return(100)&lt;br /&gt;
  allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
  allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
 it 'renders grades#view_team page' do&lt;br /&gt;
  params = {id: participant_vt.id}&lt;br /&gt;
  get :view_team, params&lt;br /&gt;
  expect(response).to render_template(:view_team)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is opened by student' do&lt;br /&gt;
  it 'dropdown is not rendered' do&lt;br /&gt;
    session = { user: student1_vt }&lt;br /&gt;
    params = {id: participant_vt.id}&lt;br /&gt;
    stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
    get :view_team, params&lt;br /&gt;
    expect(response.body).to_not have_selector('select')&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is opened by instructor' do&lt;br /&gt;
  it 'dropdown is rendered' do&lt;br /&gt;
    session = { user: instructor }&lt;br /&gt;
    params = {id: participant_vt.id}&lt;br /&gt;
    get :view_team, params&lt;br /&gt;
    expect(response.body).to have_selector('select')&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
  it 'renders grades#view_team page' do&lt;br /&gt;
    params = { id: participant_vt.id }&lt;br /&gt;
    allow(TaMapping).to receive(:exists?).with(ta_id: participant_vt.user_id, course_id: 1).and_return(true)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====H. In spec/factories/factories.rb:====&lt;br /&gt;
&lt;br /&gt;
'''H.1 '''Add the following factory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
factory :teammate_review_questionnaire, class: TeammateReviewQuestionnaire do&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''H.2 '''Add another factory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
factory :tm_assignment_questionnaire, class: AssignmentQuestionnaire do&lt;br /&gt;
  user_id 1&lt;br /&gt;
  questionnaire { association(:teammate_review_questionnaire) }&lt;br /&gt;
  questionnaire_weight 100&lt;br /&gt;
  used_in_round nil&lt;br /&gt;
  topic_id nil&lt;br /&gt;
  dropdown 1&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Summary of file changes ===&lt;br /&gt;
&lt;br /&gt;
The following files are modified:&lt;br /&gt;
&lt;br /&gt;
1. app/controllers/grades_controller.rb - Controller file which changed how the view model is populated&lt;br /&gt;
&lt;br /&gt;
2. app/views/grades/view_team.html.erb - View file, which  conditionally rendered the teammate name, for a teammate review heatgrid&lt;br /&gt;
&lt;br /&gt;
3. spec/controllers/grades_controller_spec.rb - For tests verifying the proposed changes&lt;br /&gt;
&lt;br /&gt;
4. app/models/vm_question_response.rb - To modify the view-model so it can tell us the name of the person being reviewed for the current heatgrid&lt;br /&gt;
&lt;br /&gt;
5. app/models/vm_question_response_score_cell.rb - &lt;br /&gt;
&lt;br /&gt;
6. app/assets/stylesheets/grades.scss - &lt;br /&gt;
&lt;br /&gt;
7. app/views/grades/_add_icon_to_name.html.erb - &lt;br /&gt;
&lt;br /&gt;
8. spec/factories/factories.rb -&lt;br /&gt;
&lt;br /&gt;
== Design Patterns ==&lt;br /&gt;
&lt;br /&gt;
Existing code does not use any design patterns, apart from if-else. It uses if-else conditional statements to check what type of questionnaire is present in the viewmodel `VmQuestionResponse`, and based on that, it renders the appropriate content.&lt;br /&gt;
&lt;br /&gt;
We decided to continue with this approach since to change the present coding style, there were required many changes (refactoring) to many files which were out of the scope of the present project. To complete the project in the assigned time, we followed the if-else approach.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== User Stories ==&lt;br /&gt;
&lt;br /&gt;
1. As an instructor, I can view what reviews one teammate has given to other teammates.&lt;br /&gt;
&lt;br /&gt;
2. As a student, I can view what reviews my teammates have given to me.&lt;br /&gt;
&lt;br /&gt;
3. As an instructor, I can select if a student's reviews are anonymously shown to their teammates.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
'''CURRENT STATUS'''&lt;br /&gt;
&lt;br /&gt;
1. Presently, the tests only cover if the view_team is page is rendered when it is asked for.&lt;br /&gt;
&lt;br /&gt;
[[File:current_testing_status.png|border|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''OUR PROPOSAL'''&lt;br /&gt;
&lt;br /&gt;
- When show_team is set as false by the professor, the student should not be able to see his scores.&lt;br /&gt;
&lt;br /&gt;
- When show_team is set as true by the professor, the student should be able to see his.&lt;br /&gt;
&lt;br /&gt;
- An instructor can select which student's scores he/she wants to see. If no student's name is selected then the professor can see the scores of all the students.&lt;br /&gt;
- The instructor can decide whether to show the names of the reviewer to the reviewer in teammate reviews, by selecting a checkbox for the same.&lt;br /&gt;
[[File:Untitled Diagram.drawio.png|border|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;https://expertiza.ncsu.edu/&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Agarg25</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141734</id>
		<title>CSC/ECE 517 Fall 2021 - E2165. Fix teammate-review view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141734"/>
		<updated>2021-11-28T17:22:31Z</updated>

		<summary type="html">&lt;p&gt;Agarg25: /* Proposed changes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Introduction ==&lt;br /&gt;
&lt;br /&gt;
Dr. Edward Gehringer (instructor), Parimal Mehta (mentor)&lt;br /&gt;
&lt;br /&gt;
1. Anjali Garg (unity ID : agarg25)&lt;br /&gt;
&lt;br /&gt;
2. Arvasu Chikara (unity ID: achikar2)&lt;br /&gt;
&lt;br /&gt;
3. Lalit Bangad (unity ID: llbangad)&lt;br /&gt;
&lt;br /&gt;
4. Vinay Deshmukh (unity ID: vdeshmu)&lt;br /&gt;
&lt;br /&gt;
== Problems to be addressed ==&lt;br /&gt;
&lt;br /&gt;
After a project is submitted and reviewed, both the team members (students) and instructors should be able to view the teammate reviews. Students should be able to view the reviews by going to a particular assignment's -&amp;gt; your scores, at the bottom of the page. An instructor can view the teammate reviews by going to assignments -&amp;gt; assignment -&amp;gt; particular team's submission -&amp;gt; view submission -&amp;gt; assign grades -&amp;gt; view scores. &lt;br /&gt;
&lt;br /&gt;
In the case of the instructor, a single heat grid is shown whereas in the case of a team member, we cant view the scores. In the heat grid, it is not clear if the scores visible are for the reviews that the student has *written* for their teammates or the scores that the student has *received* from their teammates. Additionally, for instructors can choose from a list of the students on the team, but they have no way to tell whether the heat grid shows the reviews done *by* that student or done *for* that student.&lt;br /&gt;
&lt;br /&gt;
== Methodology Overview ==&lt;br /&gt;
&lt;br /&gt;
We have divided our work in the following tasks to address the above problems:&lt;br /&gt;
&lt;br /&gt;
1. Distinguish reviews done for a student by rendering separates heatgrids for each student&lt;br /&gt;
&lt;br /&gt;
2. For instructors, the table will have sections based on the students&lt;br /&gt;
&lt;br /&gt;
3. Include a checkbox on the edit assignment page that enables/disables visibility of heat grid to students&lt;br /&gt;
&lt;br /&gt;
4. Fix the average column for a table (which breaks for some reviews)&lt;br /&gt;
&lt;br /&gt;
5. Show a composite score derived from all reviews.  Make this code generalized, so other kinds of heat grid views could use it.&lt;br /&gt;
&lt;br /&gt;
6. Changes should work even in an anonymized view&lt;br /&gt;
&lt;br /&gt;
== Motivations ==&lt;br /&gt;
&lt;br /&gt;
1. Enable users to clearly tell which reviews are done by them, and which reviews are done for them.&lt;br /&gt;
&lt;br /&gt;
2. Code should be generic so it can be used for different types of heat grids as well.&lt;br /&gt;
&lt;br /&gt;
== Control Flow to access the concerned screens ==&lt;br /&gt;
'''1. For instructor (Log in as an instructor):-'''&lt;br /&gt;
&lt;br /&gt;
Screen after logging in by the instructor&lt;br /&gt;
[[File:ss1.png |border|1000px|center]]&lt;br /&gt;
Got to assignments on the Manage menu &lt;br /&gt;
[[File:ss2.png |border|1000px|center]]&lt;br /&gt;
Go to assignments&lt;br /&gt;
[[File:ss3.png |border|1000px|center]]&lt;br /&gt;
Go to submissions for any assignment&lt;br /&gt;
[[File:ss4a.png |border|1000px|center]]&lt;br /&gt;
Go to Assign Grade&lt;br /&gt;
[[File:ss5a.png |border|1000px|center]]&lt;br /&gt;
You will land on the page where the changes are made and can be reviewed&lt;br /&gt;
[[File:ss7a.png |border|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
'''2. Student:- (Logged in as an instructor)'''&lt;br /&gt;
&lt;br /&gt;
After landing on the assignments page, select any student from an assignment as shown below&lt;br /&gt;
[[File:ss6a.png |border|1000px|center]]&lt;br /&gt;
Go to/Select any assignment&lt;br /&gt;
[[File:ss9a.png |border|1000px|center]]&lt;br /&gt;
Go to your scores&lt;br /&gt;
[[File:ss10a.png |border|1000px|center]]&lt;br /&gt;
You will land on the page where the changes are made and can be reviewed&lt;br /&gt;
[[File:ss11a.png |border|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
== Old Status of the application ==&lt;br /&gt;
&lt;br /&gt;
'''1. Instructor's view of teammate review''': This is the current screen given to the instructor. Here we see that the instructor can not determine who has given which review to which student in a team.&lt;br /&gt;
&lt;br /&gt;
[[File:Instructor-view-1.png|border| 700px |center|alt=The proposed expanded student display.|The proposed expanded student display.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2. Student's view of teammate review''': Currently, a student is not able to see what grades were given by their teammates. We need to implement that functionality so that the student is able to view those grades.&lt;br /&gt;
&lt;br /&gt;
[[File:Student-view-2.png|border| 700px |center|alt=The current instructor view.|The current review display for instructors.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Error in existing UI for student''': In the existing UI for a student, the highlighted block should not be rendered. This part of the screen is meant for the instructors/TAs. &lt;br /&gt;
&lt;br /&gt;
[[File:Wrong render for student.png|border|700px|center|alt=Existing UI for student|Existing UI for student.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Proposed changes ==&lt;br /&gt;
&lt;br /&gt;
''' 1) Proposed UI for instructor ''': The instructor is able to see the score for all teammates. In the existing code, only one teammate's scores are being shown. But, we are planning to change the way the (VmQuestionResponse array is populated)[https://github.com/expertiza/expertiza/blob/master/app/controllers/grades_controller.rb#L114], so that the scores for all teammates are appended to it so it correctly shows what should have already been shown in this screen for the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Proposed_screen.png|border|700px|center|alt=Proposed UI for instructor|Proposed UI for instructor.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: When a student visits this screen, they will only be shown the reviews received by them, assuming the instructor has allowed visibility of teammate reviews to students.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' 2) Show detailed review for a particular question''': The instructor can see detailed review given to a student by their teammates by clicking on a particular question number in the table.&lt;br /&gt;
&lt;br /&gt;
[[File:ss12a.png|border|700px|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' 3) Show teammate review to student UI ''': The existing code doesn't render a student's teammate review scores at all. We are planning to render the scores to a student (as shown below) when they visit this screen. However, the visibility of this screen is contingent on whether the instructor has allowed visibility of the teammate review screen to students. If the instructor has disabled this feature, then the heatgrid will not be displayed at all.&lt;br /&gt;
&lt;br /&gt;
[[File:UI_for_student.png|border|700px|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
== Models used / Explanation of fixes ==&lt;br /&gt;
&lt;br /&gt;
The below diagram illustrates the proposed code change for showing all team members with the teammate review data to an instructor. The existing code only iterated on the `Participant` whose ID is present in the URL of the page. To fix this, we will iterate over all teammates of the given participant so that all teammate reviews for all team members are shown to the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Logic e2165.png|border|center|alt=Flow diagram of proposed changes for showing team review data to instructor]]&lt;br /&gt;
&lt;br /&gt;
===Changes made to the code are shown below. Every change is shown and explained separately===&lt;br /&gt;
&lt;br /&gt;
====A. Added the following to app/assets/stylesheets/grades.scss:====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    .teammate_table.hidden {&lt;br /&gt;
      display: none;&lt;br /&gt;
      }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====B. In app/controllers/grades_controller.rb: ====&lt;br /&gt;
&lt;br /&gt;
'''B.1:'''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
  @vmlist &amp;lt;&amp;lt; populate_view_model(questionnaire)&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
     if questionnaire.type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
        # as teammate review will be different for each participant&lt;br /&gt;
        # we need to create a separate table for each teammate&lt;br /&gt;
        @participant.team.participants.each do |team_participant|&lt;br /&gt;
          @vmlist &amp;lt;&amp;lt; populate_view_model(team_participant, questionnaire, @team)&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        # only one participant needs iterating, as apart from teammatereview&lt;br /&gt;
        # all other reviews are at &amp;quot;team&amp;quot; level&lt;br /&gt;
        @vmlist &amp;lt;&amp;lt; populate_view_model(@participant, questionnaire, @team)&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
'''B.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
    def populate_view_model(questionnaire)&lt;br /&gt;
      vm = VmQuestionResponse.new(questionnaire, @assignment, @round)&lt;br /&gt;
      vmquestions = questionnaire.questions&lt;br /&gt;
      vm.add_questions(vmquestions)&lt;br /&gt;
      vm.add_team_members(@team)&lt;br /&gt;
      vm.add_reviews(@participant, @team, @assignment.vary_by_round)&lt;br /&gt;
      vm.number_of_comments_greater_than_10_words&lt;br /&gt;
      vm &lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
    def populate_view_model(participant, questionnaire, team)&lt;br /&gt;
      vm = VmQuestionResponse.new(questionnaire, @assignment, @round)&lt;br /&gt;
      vmquestions = questionnaire.questions&lt;br /&gt;
      vm.add_questions(vmquestions)&lt;br /&gt;
      vm.add_team_members(team)&lt;br /&gt;
      vm.add_reviews(participant, team, @assignment.vary_by_round)&lt;br /&gt;
      vm.number_of_comments_greater_than_10_words&lt;br /&gt;
      vm&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====C. In app/models/vm_question_response.rb:====&lt;br /&gt;
&lt;br /&gt;
'''C.1: '''Added the reviewee_id method&lt;br /&gt;
&lt;br /&gt;
    def reviewee_id&lt;br /&gt;
      @participant_who_is_reviewee.user_id&lt;br /&gt;
    end &lt;br /&gt;
&lt;br /&gt;
'''C.2: '''Added the reviewee_name method&lt;br /&gt;
&lt;br /&gt;
    def reviewee_name(ip_address = nil)&lt;br /&gt;
      part = @participant_who_is_reviewee&lt;br /&gt;
      User.find_by(id: part.user_id).fullname(ip_address)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''C.3: '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
    elsif @questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
      reviews = participant.teammate_reviews&lt;br /&gt;
      reviews.each do |review|&lt;br /&gt;
        review_mapping = TeammateReviewResponseMap.find_by(id: review.map_id)&lt;br /&gt;
        participant = Participant.find(review_mapping.reviewer_id)&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
    elsif @questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
      reviews = participant.teammate_reviews&lt;br /&gt;
      @participant_who_is_reviewee = participant&lt;br /&gt;
      reviews.each do |review|&lt;br /&gt;
        review_mapping = TeammateReviewResponseMap.find_by(id: review.map_id)&lt;br /&gt;
        participant = Participant.find(review_mapping.reviewer_id)&lt;br /&gt;
&lt;br /&gt;
'''C.4: '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
    row.score_row.push(VmQuestionResponseScoreCell.new(answer.answer, color_code, answer.comments, vm_tag_prompts))&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
    &lt;br /&gt;
    row.score_row.push(VmQuestionResponseScoreCell.new(answer.answer, color_code, answer.comments, vm_tag_prompts, answer.response_id))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====D. In app/models/vm_question_response_score_cell.rb:====&lt;br /&gt;
&lt;br /&gt;
'''D.1: '''In the method initialize of class VmQuestionResponseScoreCell&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
    def initialize(score_value, color_code, comments, vmprompts = nil)&lt;br /&gt;
      @score_value = score_value&lt;br /&gt;
      @color_code = color_code&lt;br /&gt;
      @comment = comments&lt;br /&gt;
      @vm_prompts = vmprompts&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&lt;br /&gt;
    def initialize(score_value, color_code, comments, vmprompts = nil, response_id)&lt;br /&gt;
      @score_value = score_value&lt;br /&gt;
      @color_code = color_code&lt;br /&gt;
      @comment = comments&lt;br /&gt;
      @vm_prompts = vmprompts&lt;br /&gt;
      @response_id = response_id&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''D.2: '''Added a method reviewer_id to the class VmQuestionResponseScoreCell&lt;br /&gt;
&lt;br /&gt;
    def reviewer_id&lt;br /&gt;
      resp = Response.find(@response_id)&lt;br /&gt;
      map = ResponseMap.find(resp.map_id)&lt;br /&gt;
      map.reviewer_id&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====E. In app/views/grades/_add_icon_to_name.html.erb:====&lt;br /&gt;
&lt;br /&gt;
'''E.1 '''Added the following code to the file:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;%# Determine the content of the reviewed by text %&amp;gt;&lt;br /&gt;
    &amp;lt;% review_text = &amp;quot;&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% if @current_role_name.eql?'Student' or questionnaire_type != &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
      &amp;lt;%# Use Review {{index}} format for student view, and when questionnaire_type is not teammatereview %&amp;gt;&lt;br /&gt;
      &amp;lt;% review_text = &amp;quot;Review #{i + 1}&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;% resp = Response.find(review.id) %&amp;gt;&lt;br /&gt;
      &amp;lt;% map = ResponseMap.find(resp.map_id) %&amp;gt;&lt;br /&gt;
      &amp;lt;% reviewer_id = map.reviewer_id %&amp;gt;&lt;br /&gt;
      &amp;lt;% fullname = Participant.find_by(id: reviewer_id).fullname(session[:ip]) %&amp;gt;&lt;br /&gt;
      &amp;lt;% review_text = &amp;quot;Review by #{fullname}&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% end%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''E.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;% if review.done_by_staff_participant? %&amp;gt;&lt;br /&gt;
      &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt; &amp;lt;img data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Icon indicates this review was done by course staff&amp;quot; class=&amp;quot;img_icon&amp;quot; src=&amp;quot;/assets/staff.png&amp;quot;&amp;gt; &amp;lt;a target=&amp;quot;_blank&amp;quot; href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Click to see details&amp;quot;&amp;gt;&amp;lt;%= &amp;quot;Review &amp;quot; + i.to_s  %&amp;gt;&amp;lt;/a&amp;gt; &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt; &amp;lt;a target=&amp;quot;_blank&amp;quot; href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Click to see details&amp;quot;&amp;gt;&amp;lt;%= &amp;quot;Review &amp;quot; + i.to_s %&amp;gt;&amp;lt;/a&amp;gt;  &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;% if review.done_by_staff_participant? %&amp;gt;&lt;br /&gt;
    &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;img&lt;br /&gt;
      data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
      data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
      title=&amp;quot;Icon indicates this review was done by course staff&amp;quot; class=&amp;quot;img_icon&amp;quot;&lt;br /&gt;
      src=&amp;quot;/assets/staff.png&amp;quot;&lt;br /&gt;
      &amp;gt;&lt;br /&gt;
    &amp;lt;a&lt;br /&gt;
      target=&amp;quot;_blank&amp;quot;&lt;br /&gt;
      href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;&lt;br /&gt;
      data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
      data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
      title=&amp;quot;Click to see details&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;%= review_text %&amp;gt;&lt;br /&gt;
    &amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
    &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;a&lt;br /&gt;
            target=&amp;quot;_blank&amp;quot; &lt;br /&gt;
            href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  &lt;br /&gt;
            data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
            data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
            title=&amp;quot;Click to see details&amp;quot;&lt;br /&gt;
        &amp;gt;&lt;br /&gt;
        &amp;lt;%= review_text %&amp;gt;&lt;br /&gt;
        &amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====F.In app/views/grades/view_team.html.erb:====&lt;br /&gt;
&lt;br /&gt;
'''F.1: '''Added function teammateSelectOnChange:&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  function teammateSelectOnChange(selectNode) {&lt;br /&gt;
      const revieweeIdToShow= selectNode.value;&lt;br /&gt;
      const tableSelector = &amp;quot;.teammate_table&amp;quot;;&lt;br /&gt;
      if(revieweeIdToShow == &amp;quot;all&amp;quot;) {&lt;br /&gt;
        document.querySelectorAll(tableSelector).forEach((tableNode) =&amp;gt; {&lt;br /&gt;
          tableNode.classList.remove(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
        });&lt;br /&gt;
        return;&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
  document.querySelectorAll(tableSelector).forEach((tableNode) =&amp;gt; {&lt;br /&gt;
    const tableRevieweeId = tableNode.getAttribute('data-reviewee_id');&lt;br /&gt;
    if(tableRevieweeId == revieweeIdToShow) {&lt;br /&gt;
      tableNode.classList.remove(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
    } else {&lt;br /&gt;
      tableNode.classList.add(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    });&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;% @vmlist.each do |vm| %&amp;gt;&lt;br /&gt;
        &amp;lt;% if (vm.questionnaire_display_type == &amp;quot;Metareview&amp;quot; or vm.questionnaire_display_type == &amp;quot;Author Feedback&amp;quot; or vm.questionnaire_display_type == &amp;quot;Teammate Review&amp;quot;) and @current_role_name.eql?'Student' %&amp;gt;&lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
        &amp;lt;% if vm.list_of_reviewers.length &amp;gt; 0 %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
​      &amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  @@ -87,6 +131,8 @@&lt;br /&gt;
              &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
                &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                    (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
        &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;%# This boolean is used to render a dropdown just before the first teammate review heat grid %&amp;gt;&lt;br /&gt;
&amp;lt;% first_teammate_review_appeared = false %&amp;gt;&lt;br /&gt;
&amp;lt;% @vmlist.each do |vm| %&amp;gt;&lt;br /&gt;
    &amp;lt;% if not @current_role_name.eql?'Student' and not first_teammate_review_appeared and vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        &amp;lt;select onchange=&amp;quot;teammateSelectOnChange(this)&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;all&amp;quot;&amp;gt;All&amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;% @vmlist.select { |tm_vm| tm_vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; }.each do |tm_vm| %&amp;gt;&lt;br /&gt;
            &amp;lt;option value=&amp;quot;&amp;lt;%= tm_vm.reviewee_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;%= tm_vm.reviewee_name(session[:ip]) %&amp;gt;&lt;br /&gt;
            &amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
        &amp;lt;/select&amp;gt;&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;% first_teammate_review_appeared = true %&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;% if (vm.questionnaire_display_type == &amp;quot;Metareview&amp;quot; or vm.questionnaire_display_type == &amp;quot;Author Feedback&amp;quot;) and @current_role_name.eql?'Student' %&amp;gt;&lt;br /&gt;
    &amp;lt;% elsif (vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; and @current_role_name.eql?'Student' and !@assignment.show_teammate_reviews)%&amp;gt;&lt;br /&gt;
    &amp;lt;% elsif (vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; and @current_role_name.eql?'Student' and @assignment.show_teammate_reviews and current_user.id != vm.reviewee_id )%&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
        &amp;lt;% if vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
          &amp;lt;div class=&amp;quot;teammate_table&amp;quot; data-reviewee_id=&amp;quot;&amp;lt;%= vm.reviewee_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
        &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.3  '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
@@ -87,6 +131,8 @@&lt;br /&gt;
          &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
            &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
@@ -87,6 +131,8 @@&lt;br /&gt;
          &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
            &amp;lt;% elsif vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (For: &amp;lt;%= vm.reviewee_name(session[:ip]) %&amp;gt;)&lt;br /&gt;
            &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.4 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_reviews.each do |review| %&amp;gt;&lt;br /&gt;
              &amp;lt;!-- instructors (or higher level users) see reviewer name, students see anonymized string --&amp;gt;&lt;br /&gt;
              &amp;lt;% if (['Student'].include? @current_role_name) &amp;amp;&amp;amp; @assignment.is_anonymous%&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i} %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                  &amp;lt;% user_name = User.find(Participant.find(ResponseMap.find(Response.find(review.id).map_id).reviewer_id).user_id).fullname(session[:ip]).to_s %&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i} %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% i += 1 %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-true&amp;quot; align=&amp;quot;right&amp;quot; &amp;gt;&lt;br /&gt;
            Avg&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;span  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;A count of comments, for the respective question, which have word count &amp;gt; 10. The purpose of this metric is to represent how many comments for the question are of a substantial length to provide quality feedback.&amp;quot;&amp;gt;metric-1&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/thead&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_reviews.each do |review| %&amp;gt;&lt;br /&gt;
              &amp;lt;!-- instructors (or higher level users) see reviewer name, students see anonymized string --&amp;gt;&lt;br /&gt;
              &amp;lt;% if (['Student'].include? @current_role_name) &amp;amp;&amp;amp; @assignment.is_anonymous%&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i, questionnaire_type: vm.questionnaire_type } %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                &amp;lt;% user_name = User.find(Participant.find(ResponseMap.find(Response.find(review.id).map_id).reviewer_id).user_id).fullname(session[:ip]).to_s %&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i, questionnaire_type: vm.questionnaire_type } %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% i += 1 %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-true&amp;quot; align=&amp;quot;right&amp;quot; &amp;gt;&lt;br /&gt;
            Avg&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/thead&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.5 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_rows.each do |row| %&amp;gt;&lt;br /&gt;
            &amp;lt;!-- notice the data-target. because we're toggling via looped code, we need to dynamically generate the identifier. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr data-toggle=&amp;quot;collapse&amp;quot; class=&amp;quot;accordion-toggle&amp;quot; data-target=&amp;quot;#hid&amp;lt;%= row.question_id.to_s + vm.round.to_s %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;td class = 'cf' data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= row.question_text %&amp;gt;&amp;quot;&amp;gt; &amp;lt;div style='float: left'&amp;gt;&amp;lt;%= j.to_s %&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div style='float: right'&amp;gt; &amp;amp;#&amp;lt;%= type_and_max(row) %&amp;gt;;&amp;lt;/div&amp;gt;  &amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
              &amp;lt;!-- actual cells with scores and colored background. --&amp;gt;&lt;br /&gt;
              &amp;lt;% row.score_row.each do |score| %&amp;gt;&lt;br /&gt;
                  &amp;lt;% score_comment = score.comment.nil? ? '' : score.comment %&amp;gt; &amp;lt;!-- changing nil to null string to avoid Null Pointer Exception --&amp;gt;&lt;br /&gt;
                  &amp;lt;td class=&amp;quot;&amp;lt;%= score.color_code %&amp;gt;&amp;quot; align=&amp;quot;center&amp;quot; data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= strip_tags(score.comment).html_safe%&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;&amp;lt;%=  underlined?(score) %&amp;gt;&amp;quot;&amp;gt;&amp;lt;%= score.score_value.to_s %&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
                  &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_rows.each do |row| %&amp;gt;&lt;br /&gt;
            &amp;lt;% target_id = &amp;quot;hid__#{row.question_id}__#{vm.round}&amp;quot; %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
              &amp;lt;%# Since we render different heatgrids with the same questions for each&lt;br /&gt;
              teammember, we need to distinguish the ID, based on the user for whom,&lt;br /&gt;
              the reviews have been created. %&amp;gt;&lt;br /&gt;
              &amp;lt;% target_id += &amp;quot;__#{vm.reviewee_id}&amp;quot; %&amp;gt;&lt;br /&gt;
            &amp;lt;% end%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;!-- notice the data-target. because we're toggling via looped code, we need to dynamically generate the identifier. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr data-toggle=&amp;quot;collapse&amp;quot; class=&amp;quot;accordion-toggle&amp;quot; data-target=&amp;quot;&amp;lt;%= &amp;quot;#&amp;quot; + target_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;td class = 'cf' data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= row.question_text %&amp;gt;&amp;quot;&amp;gt; &amp;lt;div style='float: left'&amp;gt;&amp;lt;%= j.to_s %&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div style='float: right'&amp;gt; &amp;amp;#&amp;lt;%= type_and_max(row) %&amp;gt;;&amp;lt;/div&amp;gt;  &amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
              &amp;lt;!-- actual cells with scores and colored background. --&amp;gt;&lt;br /&gt;
              &amp;lt;% row.score_row.each do |score| %&amp;gt;&lt;br /&gt;
                  &amp;lt;% score_comment = score.comment.nil? ? '' : score.comment %&amp;gt;&lt;br /&gt;
                  &amp;lt;!-- changing nil to null string to avoid Null Pointer Exception --&amp;gt;&lt;br /&gt;
                  &amp;lt;td class=&amp;quot;&amp;lt;%= score.color_code %&amp;gt;&amp;quot; align=&amp;quot;center&amp;quot; data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= strip_tags(score.comment).html_safe%&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;&amp;lt;%=  underlined?(score) %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                      &amp;lt;%= score.score_value.to_s %&amp;gt;&lt;br /&gt;
                    &amp;lt;/span&amp;gt;&lt;br /&gt;
                  &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.6 '''Removed the following code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 &amp;lt;td  class = 'cf' align=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;%= row.countofcomments.to_s %&amp;gt;&lt;br /&gt;
              &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.7 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!--loop that creates the collapsed-by-default row, which lists all comments. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr class=&amp;quot;tablesorter-childRow&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;td colspan=&amp;quot;&amp;lt;%= (i+1).to_s %&amp;gt;&amp;quot; class=&amp;quot;hiddenRow&amp;quot; &amp;gt;&amp;lt;div id=&amp;quot;hid&amp;lt;%= row.question_id.to_s + vm.round.to_s %&amp;gt;&amp;quot; class=&amp;quot;accordion-body collapse&amp;quot; style=&amp;quot;margin-left:10px;&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;div style=&amp;quot;padding-top: 10px; padding-bottom: 10px;&amp;quot;&amp;gt;&amp;lt;%=  sanitize row.question_text %&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;div&amp;gt;&lt;br /&gt;
                  &amp;lt;table class=&amp;quot;table tbl_questlist&amp;quot;&amp;gt;&lt;br /&gt;
@@ -181,7 +233,17 @@&lt;br /&gt;
                    &amp;lt;/thead&amp;gt;&lt;br /&gt;
                    &amp;lt;% for index in 0 .. row.score_row.length - 1 %&amp;gt;&lt;br /&gt;
                        &amp;lt;tr&amp;gt;&lt;br /&gt;
                          &amp;lt;td&amp;gt;Review &amp;lt;%=index + 1%&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!--loop that creates the collapsed-by-default row, which lists all comments. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr class=&amp;quot;tablesorter-childRow&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;td colspan=&amp;quot;&amp;lt;%= (i+1).to_s %&amp;gt;&amp;quot; class=&amp;quot;hiddenRow&amp;quot; &amp;gt;&amp;lt;div id=&amp;quot;&amp;lt;%= target_id %&amp;gt;&amp;quot; class=&amp;quot;accordion-body collapse&amp;quot; style=&amp;quot;margin-left:10px;&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;div style=&amp;quot;padding-top: 10px; padding-bottom: 10px;&amp;quot;&amp;gt;&amp;lt;%=  sanitize row.question_text %&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;div&amp;gt;&lt;br /&gt;
                  &amp;lt;table class=&amp;quot;table tbl_questlist&amp;quot;&amp;gt;&lt;br /&gt;
@@ -181,7 +233,17 @@&lt;br /&gt;
                    &amp;lt;/thead&amp;gt;&lt;br /&gt;
                    &amp;lt;% for index in 0 .. row.score_row.length - 1 %&amp;gt;&lt;br /&gt;
                        &amp;lt;tr&amp;gt;&lt;br /&gt;
                          &amp;lt;% if @current_role_name.eql?'Student' or vm.questionnaire_type != &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                            &amp;lt;%# Use Review {{index}} format for student view, and&lt;br /&gt;
                            when questionnaire_type is not teammatereview %&amp;gt;&lt;br /&gt;
                            &amp;lt;td&amp;gt;Review &amp;lt;%=index + 1%&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
                          &amp;lt;% else %&amp;gt;&lt;br /&gt;
                            &amp;lt;td&amp;gt;&lt;br /&gt;
                              &amp;lt;% reviewer_id = row.score_row[index].reviewer_id %&amp;gt;&lt;br /&gt;
                              &amp;lt;% fullname = Participant.find_by(id: reviewer_id).fullname(session[:ip]) %&amp;gt;&lt;br /&gt;
                              Review by &amp;lt;%= fullname %&amp;gt;&lt;br /&gt;
                            &amp;lt;/td&amp;gt;&lt;br /&gt;
                          &amp;lt;% end%&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====G. In spec/controllers/grades_controller_spec.rb:====&lt;br /&gt;
&lt;br /&gt;
'''G.1 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
before(:each) do&lt;br /&gt;
  allow(AssignmentParticipant).to receive(:find).with('1').and_return(participant)&lt;br /&gt;
  allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
  stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
@@ -91,29 +90,106 @@&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
before(:each) do&lt;br /&gt;
  allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
  stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
@@ -91,29 +90,106 @@&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''G.2 '''Remove xdescribe '#view_team' and change describe '#view_team' as follows.&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#view_team' do&lt;br /&gt;
render_views&lt;br /&gt;
context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
  it 'renders grades#view_team page' do&lt;br /&gt;
    allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
    allow(AssignmentQuestionnaire).to receive(:find_by).with(assignment_id: 1, questionnaire_id: 1).and_return(assignment_questionnaire)&lt;br /&gt;
    allow(AssignmentQuestionnaire).to receive(:where).with(any_args).and_return([assignment_questionnaire])&lt;br /&gt;
    allow(assignment).to receive(:late_policy_id).and_return(false)&lt;br /&gt;
    allow(assignment).to receive(:calculate_penalty).and_return(false)&lt;br /&gt;
    allow(assignment).to receive(:compute_total_score).with(any_args).and_return(100)&lt;br /&gt;
    allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
    allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
    params = {id: 1}&lt;br /&gt;
    allow(TaMapping).to receive(:exists?).with(ta_id: 1, course_id: 1).and_return(true)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#view_team' do&lt;br /&gt;
render_views&lt;br /&gt;
&lt;br /&gt;
# All stubs and factories are instantiated within this scope so as to not &lt;br /&gt;
# clash with other broken test.&lt;br /&gt;
# The names of the factories created for testing view_team&lt;br /&gt;
# have `_vt` suffix ```where necessary``` to differentiate them from &lt;br /&gt;
# the above declared factories&lt;br /&gt;
&lt;br /&gt;
let(:student1_vt) { create(:student, name: &amp;quot;barry&amp;quot;, id: 12) }&lt;br /&gt;
let(:student2_vt) { create(:student, name: &amp;quot;iris&amp;quot;, id: 13) }&lt;br /&gt;
&lt;br /&gt;
let(:tm_questionnaire) {&lt;br /&gt;
  build(&lt;br /&gt;
    :teammate_review_questionnaire,&lt;br /&gt;
    id: 12,&lt;br /&gt;
    questions: [question],&lt;br /&gt;
    max_question_score: 5&lt;br /&gt;
  )&lt;br /&gt;
}&lt;br /&gt;
let(:assignment_vt) {&lt;br /&gt;
  create(:assignment, id: 6, max_team_size: 2,&lt;br /&gt;
  questionnaires: [tm_questionnaire])&lt;br /&gt;
}&lt;br /&gt;
let(:assignment_questionnaire_vt) {&lt;br /&gt;
  create(:tm_assignment_questionnaire, id: 12, used_in_round: nil,&lt;br /&gt;
  assignment: assignment_vt, questionnaire: tm_questionnaire) }&lt;br /&gt;
let(:team_vt) { create(:assignment_team, id: 12,&lt;br /&gt;
assignment: assignment_vt) }&lt;br /&gt;
let(:participant_vt) { create(:participant, id: 12,&lt;br /&gt;
  assignment: assignment_vt, user_id: student1_vt.id) }&lt;br /&gt;
let(:participant2_vt) { create(:participant, id: 13,&lt;br /&gt;
  assignment: assignment_vt, user_id: student2_vt.id) }&lt;br /&gt;
&lt;br /&gt;
before(:each) do&lt;br /&gt;
  # Need to stub this method so the factory instance with&lt;br /&gt;
  # the stubbed :team method is returned by :find&lt;br /&gt;
  # instead of a separate instance with the same data&lt;br /&gt;
  allow(AssignmentParticipant)&lt;br /&gt;
    .to receive(:find)&lt;br /&gt;
    .with(participant_vt.id.to_s)&lt;br /&gt;
    .and_return(participant_vt)&lt;br /&gt;
  allow(participant_vt).to receive(:team).and_return(team_vt)&lt;br /&gt;
  allow(team_vt).to receive(:participants).and_return([participant_vt, participant2_vt])&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:find_by)&lt;br /&gt;
    .with(assignment_id: assignment_vt.id, questionnaire_id: tm_questionnaire.id)&lt;br /&gt;
    .and_return(assignment_questionnaire_vt)&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:find_by)&lt;br /&gt;
    .with(assignment_id: assignment.id, questionnaire_id: review_questionnaire.id)&lt;br /&gt;
    .and_return(assignment_questionnaire_vt)&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:where)&lt;br /&gt;
    .with(any_args)&lt;br /&gt;
    .and_return([assignment_questionnaire_vt])&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:late_policy_id)&lt;br /&gt;
    .and_return(false)&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:calculate_penalty)&lt;br /&gt;
    .and_return(false)&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:compute_total_score)&lt;br /&gt;
    .with(any_args)&lt;br /&gt;
    .and_return(100)&lt;br /&gt;
  allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
  allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
 it 'renders grades#view_team page' do&lt;br /&gt;
  params = {id: participant_vt.id}&lt;br /&gt;
  get :view_team, params&lt;br /&gt;
  expect(response).to render_template(:view_team)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is opened by student' do&lt;br /&gt;
  it 'dropdown is not rendered' do&lt;br /&gt;
    session = { user: student1_vt }&lt;br /&gt;
    params = {id: participant_vt.id}&lt;br /&gt;
    stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
    get :view_team, params&lt;br /&gt;
    expect(response.body).to_not have_selector('select')&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is opened by instructor' do&lt;br /&gt;
  it 'dropdown is rendered' do&lt;br /&gt;
    session = { user: instructor }&lt;br /&gt;
    params = {id: participant_vt.id}&lt;br /&gt;
    get :view_team, params&lt;br /&gt;
    expect(response.body).to have_selector('select')&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
  it 'renders grades#view_team page' do&lt;br /&gt;
    params = { id: participant_vt.id }&lt;br /&gt;
    allow(TaMapping).to receive(:exists?).with(ta_id: participant_vt.user_id, course_id: 1).and_return(true)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====H. In spec/factories/factories.rb:====&lt;br /&gt;
&lt;br /&gt;
'''H.1 '''Add the following factory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
factory :teammate_review_questionnaire, class: TeammateReviewQuestionnaire do&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''H.2 '''Add another factory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
factory :tm_assignment_questionnaire, class: AssignmentQuestionnaire do&lt;br /&gt;
  user_id 1&lt;br /&gt;
  questionnaire { association(:teammate_review_questionnaire) }&lt;br /&gt;
  questionnaire_weight 100&lt;br /&gt;
  used_in_round nil&lt;br /&gt;
  topic_id nil&lt;br /&gt;
  dropdown 1&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Summary of file changes ===&lt;br /&gt;
&lt;br /&gt;
The following files are modified:&lt;br /&gt;
&lt;br /&gt;
1. app/controllers/grades_controller.rb - Controller file which changed how the view model is populated&lt;br /&gt;
&lt;br /&gt;
2. app/views/grades/view_team.html.erb - View file, which  conditionally rendered the teammate name, for a teammate review heatgrid&lt;br /&gt;
&lt;br /&gt;
3. spec/controllers/grades_controller_spec.rb - For tests verifying the proposed changes&lt;br /&gt;
&lt;br /&gt;
4. app/models/vm_question_response.rb - To modify the view-model so it can tell us the name of the person being reviewed for the current heatgrid&lt;br /&gt;
&lt;br /&gt;
5. app/models/vm_question_response_score_cell.rb - &lt;br /&gt;
&lt;br /&gt;
6. app/assets/stylesheets/grades.scss - &lt;br /&gt;
&lt;br /&gt;
7. app/views/grades/_add_icon_to_name.html.erb - &lt;br /&gt;
&lt;br /&gt;
8. spec/factories/factories.rb - &lt;br /&gt;
&lt;br /&gt;
== Design Patterns ==&lt;br /&gt;
&lt;br /&gt;
Existing code does not use any design patterns, apart from if-else. It uses if-else conditional statements to check what type of questionnaire is present in the viewmodel `VmQuestionResponse`, and based on that, it renders the appropriate content.&lt;br /&gt;
&lt;br /&gt;
We decided to continue with this approach since to change the present coding style, there were required many changes (refactoring) to many files which were out of the scope of the present project. To complete the project in the assigned time, we followed the if-else approach.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== User Stories ==&lt;br /&gt;
&lt;br /&gt;
1. As an instructor, I can view what reviews one teammate has given to other teammates.&lt;br /&gt;
&lt;br /&gt;
2. As a student, I can view what reviews my teammates have given to me.&lt;br /&gt;
&lt;br /&gt;
3. As an instructor, I can select if a student's reviews are anonymously shown to their teammates.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
'''CURRENT STATUS'''&lt;br /&gt;
&lt;br /&gt;
1. Presently, the tests only cover if the view_team is page is rendered when it is asked for.&lt;br /&gt;
&lt;br /&gt;
[[File:current_testing_status.png|border|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''OUR PROPOSAL'''&lt;br /&gt;
&lt;br /&gt;
- When show_team is set as false by the professor, the student should not be able to see his scores.&lt;br /&gt;
&lt;br /&gt;
- When show_team is set as true by the professor, the student should be able to see his.&lt;br /&gt;
&lt;br /&gt;
- An instructor can select which student's scores he/she wants to see. If no student's name is selected then the professor can see the scores of all the students.&lt;br /&gt;
- The instructor can decide whether to show the names of the reviewer to the reviewer in teammate reviews, by selecting a checkbox for the same.&lt;br /&gt;
[[File:Untitled Diagram.drawio.png|border|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;https://expertiza.ncsu.edu/&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Agarg25</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141733</id>
		<title>CSC/ECE 517 Fall 2021 - E2165. Fix teammate-review view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141733"/>
		<updated>2021-11-28T17:20:12Z</updated>

		<summary type="html">&lt;p&gt;Agarg25: /* Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Introduction ==&lt;br /&gt;
&lt;br /&gt;
Dr. Edward Gehringer (instructor), Parimal Mehta (mentor)&lt;br /&gt;
&lt;br /&gt;
1. Anjali Garg (unity ID : agarg25)&lt;br /&gt;
&lt;br /&gt;
2. Arvasu Chikara (unity ID: achikar2)&lt;br /&gt;
&lt;br /&gt;
3. Lalit Bangad (unity ID: llbangad)&lt;br /&gt;
&lt;br /&gt;
4. Vinay Deshmukh (unity ID: vdeshmu)&lt;br /&gt;
&lt;br /&gt;
== Problems to be addressed ==&lt;br /&gt;
&lt;br /&gt;
After a project is submitted and reviewed, both the team members (students) and instructors should be able to view the teammate reviews. Students should be able to view the reviews by going to a particular assignment's -&amp;gt; your scores, at the bottom of the page. An instructor can view the teammate reviews by going to assignments -&amp;gt; assignment -&amp;gt; particular team's submission -&amp;gt; view submission -&amp;gt; assign grades -&amp;gt; view scores. &lt;br /&gt;
&lt;br /&gt;
In the case of the instructor, a single heat grid is shown whereas in the case of a team member, we cant view the scores. In the heat grid, it is not clear if the scores visible are for the reviews that the student has *written* for their teammates or the scores that the student has *received* from their teammates. Additionally, for instructors can choose from a list of the students on the team, but they have no way to tell whether the heat grid shows the reviews done *by* that student or done *for* that student.&lt;br /&gt;
&lt;br /&gt;
== Methodology Overview ==&lt;br /&gt;
&lt;br /&gt;
We have divided our work in the following tasks to address the above problems:&lt;br /&gt;
&lt;br /&gt;
1. Distinguish reviews done for a student by rendering separates heatgrids for each student&lt;br /&gt;
&lt;br /&gt;
2. For instructors, the table will have sections based on the students&lt;br /&gt;
&lt;br /&gt;
3. Include a checkbox on the edit assignment page that enables/disables visibility of heat grid to students&lt;br /&gt;
&lt;br /&gt;
4. Fix the average column for a table (which breaks for some reviews)&lt;br /&gt;
&lt;br /&gt;
5. Show a composite score derived from all reviews.  Make this code generalized, so other kinds of heat grid views could use it.&lt;br /&gt;
&lt;br /&gt;
6. Changes should work even in an anonymized view&lt;br /&gt;
&lt;br /&gt;
== Motivations ==&lt;br /&gt;
&lt;br /&gt;
1. Enable users to clearly tell which reviews are done by them, and which reviews are done for them.&lt;br /&gt;
&lt;br /&gt;
2. Code should be generic so it can be used for different types of heat grids as well.&lt;br /&gt;
&lt;br /&gt;
== Control Flow to access the concerned screens ==&lt;br /&gt;
'''1. For instructor (Log in as an instructor):-'''&lt;br /&gt;
&lt;br /&gt;
Screen after logging in by the instructor&lt;br /&gt;
[[File:ss1.png |border|1000px|center]]&lt;br /&gt;
Got to assignments on the Manage menu &lt;br /&gt;
[[File:ss2.png |border|1000px|center]]&lt;br /&gt;
Go to assignments&lt;br /&gt;
[[File:ss3.png |border|1000px|center]]&lt;br /&gt;
Go to submissions for any assignment&lt;br /&gt;
[[File:ss4a.png |border|1000px|center]]&lt;br /&gt;
Go to Assign Grade&lt;br /&gt;
[[File:ss5a.png |border|1000px|center]]&lt;br /&gt;
You will land on the page where the changes are made and can be reviewed&lt;br /&gt;
[[File:ss7a.png |border|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
'''2. Student:- (Logged in as an instructor)'''&lt;br /&gt;
&lt;br /&gt;
After landing on the assignments page, select any student from an assignment as shown below&lt;br /&gt;
[[File:ss6a.png |border|1000px|center]]&lt;br /&gt;
Go to/Select any assignment&lt;br /&gt;
[[File:ss9a.png |border|1000px|center]]&lt;br /&gt;
Go to your scores&lt;br /&gt;
[[File:ss10a.png |border|1000px|center]]&lt;br /&gt;
You will land on the page where the changes are made and can be reviewed&lt;br /&gt;
[[File:ss11a.png |border|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
== Old Status of the application ==&lt;br /&gt;
&lt;br /&gt;
'''1. Instructor's view of teammate review''': This is the current screen given to the instructor. Here we see that the instructor can not determine who has given which review to which student in a team.&lt;br /&gt;
&lt;br /&gt;
[[File:Instructor-view-1.png|border| 700px |center|alt=The proposed expanded student display.|The proposed expanded student display.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2. Student's view of teammate review''': Currently, a student is not able to see what grades were given by their teammates. We need to implement that functionality so that the student is able to view those grades.&lt;br /&gt;
&lt;br /&gt;
[[File:Student-view-2.png|border| 700px |center|alt=The current instructor view.|The current review display for instructors.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Error in existing UI for student''': In the existing UI for a student, the highlighted block should not be rendered. This part of the screen is meant for the instructors/TAs. &lt;br /&gt;
&lt;br /&gt;
[[File:Wrong render for student.png|border|700px|center|alt=Existing UI for student|Existing UI for student.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Proposed changes ==&lt;br /&gt;
&lt;br /&gt;
''' 1) Proposed UI for instructor ''': The instructor is able to see the score for all teammates. In the existing code, only one teammate's scores are being shown. But, we are planning to change the way the (VmQuestionResponse array is populated)[https://github.com/expertiza/expertiza/blob/master/app/controllers/grades_controller.rb#L114], so that the scores for all teammates are appended to it so it correctly shows what should have already been shown in this screen for the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Proposed_screen.png|border|700px|center|alt=Proposed UI for instructor|Proposed UI for instructor.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: When a student visits this screen, they will only be shown the reviews received by them, assuming the instructor has allowed visibility of teammate reviews to students.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' 2) Show detailed review for a particular question''': Int the existing UI, even if we select to see the detailed review for student 2 for example, student 1's detailed reviews expand. We proposed to correct this:   &lt;br /&gt;
&lt;br /&gt;
[[File:ss12a.png|border|700px|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' 3) Show teammate review to student UI ''': The existing code doesn't render a student's teammate review scores at all. We are planning to render the scores to a student (as shown below) when they visit this screen. However, the visibility of this screen is contingent on whether the instructor has allowed visibility of the teammate review screen to students. If the instructor has disabled this feature, then the heatgrid will not be displayed at all.&lt;br /&gt;
&lt;br /&gt;
[[File:UI_for_student.png|border|700px|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
== Models used / Explanation of fixes ==&lt;br /&gt;
&lt;br /&gt;
The below diagram illustrates the proposed code change for showing all team members with the teammate review data to an instructor. The existing code only iterated on the `Participant` whose ID is present in the URL of the page. To fix this, we will iterate over all teammates of the given participant so that all teammate reviews for all team members are shown to the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Logic e2165.png|border|center|alt=Flow diagram of proposed changes for showing team review data to instructor]]&lt;br /&gt;
&lt;br /&gt;
===Changes made to the code are shown below. Every change is shown and explained separately===&lt;br /&gt;
&lt;br /&gt;
====A. Added the following to app/assets/stylesheets/grades.scss:====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    .teammate_table.hidden {&lt;br /&gt;
      display: none;&lt;br /&gt;
      }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====B. In app/controllers/grades_controller.rb: ====&lt;br /&gt;
&lt;br /&gt;
'''B.1:'''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
  @vmlist &amp;lt;&amp;lt; populate_view_model(questionnaire)&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
     if questionnaire.type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
        # as teammate review will be different for each participant&lt;br /&gt;
        # we need to create a separate table for each teammate&lt;br /&gt;
        @participant.team.participants.each do |team_participant|&lt;br /&gt;
          @vmlist &amp;lt;&amp;lt; populate_view_model(team_participant, questionnaire, @team)&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        # only one participant needs iterating, as apart from teammatereview&lt;br /&gt;
        # all other reviews are at &amp;quot;team&amp;quot; level&lt;br /&gt;
        @vmlist &amp;lt;&amp;lt; populate_view_model(@participant, questionnaire, @team)&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
'''B.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
    def populate_view_model(questionnaire)&lt;br /&gt;
      vm = VmQuestionResponse.new(questionnaire, @assignment, @round)&lt;br /&gt;
      vmquestions = questionnaire.questions&lt;br /&gt;
      vm.add_questions(vmquestions)&lt;br /&gt;
      vm.add_team_members(@team)&lt;br /&gt;
      vm.add_reviews(@participant, @team, @assignment.vary_by_round)&lt;br /&gt;
      vm.number_of_comments_greater_than_10_words&lt;br /&gt;
      vm &lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
    def populate_view_model(participant, questionnaire, team)&lt;br /&gt;
      vm = VmQuestionResponse.new(questionnaire, @assignment, @round)&lt;br /&gt;
      vmquestions = questionnaire.questions&lt;br /&gt;
      vm.add_questions(vmquestions)&lt;br /&gt;
      vm.add_team_members(team)&lt;br /&gt;
      vm.add_reviews(participant, team, @assignment.vary_by_round)&lt;br /&gt;
      vm.number_of_comments_greater_than_10_words&lt;br /&gt;
      vm&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====C. In app/models/vm_question_response.rb:====&lt;br /&gt;
&lt;br /&gt;
'''C.1: '''Added the reviewee_id method&lt;br /&gt;
&lt;br /&gt;
    def reviewee_id&lt;br /&gt;
      @participant_who_is_reviewee.user_id&lt;br /&gt;
    end &lt;br /&gt;
&lt;br /&gt;
'''C.2: '''Added the reviewee_name method&lt;br /&gt;
&lt;br /&gt;
    def reviewee_name(ip_address = nil)&lt;br /&gt;
      part = @participant_who_is_reviewee&lt;br /&gt;
      User.find_by(id: part.user_id).fullname(ip_address)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''C.3: '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
    elsif @questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
      reviews = participant.teammate_reviews&lt;br /&gt;
      reviews.each do |review|&lt;br /&gt;
        review_mapping = TeammateReviewResponseMap.find_by(id: review.map_id)&lt;br /&gt;
        participant = Participant.find(review_mapping.reviewer_id)&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
    elsif @questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
      reviews = participant.teammate_reviews&lt;br /&gt;
      @participant_who_is_reviewee = participant&lt;br /&gt;
      reviews.each do |review|&lt;br /&gt;
        review_mapping = TeammateReviewResponseMap.find_by(id: review.map_id)&lt;br /&gt;
        participant = Participant.find(review_mapping.reviewer_id)&lt;br /&gt;
&lt;br /&gt;
'''C.4: '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
    row.score_row.push(VmQuestionResponseScoreCell.new(answer.answer, color_code, answer.comments, vm_tag_prompts))&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
    &lt;br /&gt;
    row.score_row.push(VmQuestionResponseScoreCell.new(answer.answer, color_code, answer.comments, vm_tag_prompts, answer.response_id))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====D. In app/models/vm_question_response_score_cell.rb:====&lt;br /&gt;
&lt;br /&gt;
'''D.1: '''In the method initialize of class VmQuestionResponseScoreCell&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
    def initialize(score_value, color_code, comments, vmprompts = nil)&lt;br /&gt;
      @score_value = score_value&lt;br /&gt;
      @color_code = color_code&lt;br /&gt;
      @comment = comments&lt;br /&gt;
      @vm_prompts = vmprompts&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&lt;br /&gt;
    def initialize(score_value, color_code, comments, vmprompts = nil, response_id)&lt;br /&gt;
      @score_value = score_value&lt;br /&gt;
      @color_code = color_code&lt;br /&gt;
      @comment = comments&lt;br /&gt;
      @vm_prompts = vmprompts&lt;br /&gt;
      @response_id = response_id&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''D.2: '''Added a method reviewer_id to the class VmQuestionResponseScoreCell&lt;br /&gt;
&lt;br /&gt;
    def reviewer_id&lt;br /&gt;
      resp = Response.find(@response_id)&lt;br /&gt;
      map = ResponseMap.find(resp.map_id)&lt;br /&gt;
      map.reviewer_id&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====E. In app/views/grades/_add_icon_to_name.html.erb:====&lt;br /&gt;
&lt;br /&gt;
'''E.1 '''Added the following code to the file:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;%# Determine the content of the reviewed by text %&amp;gt;&lt;br /&gt;
    &amp;lt;% review_text = &amp;quot;&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% if @current_role_name.eql?'Student' or questionnaire_type != &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
      &amp;lt;%# Use Review {{index}} format for student view, and when questionnaire_type is not teammatereview %&amp;gt;&lt;br /&gt;
      &amp;lt;% review_text = &amp;quot;Review #{i + 1}&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;% resp = Response.find(review.id) %&amp;gt;&lt;br /&gt;
      &amp;lt;% map = ResponseMap.find(resp.map_id) %&amp;gt;&lt;br /&gt;
      &amp;lt;% reviewer_id = map.reviewer_id %&amp;gt;&lt;br /&gt;
      &amp;lt;% fullname = Participant.find_by(id: reviewer_id).fullname(session[:ip]) %&amp;gt;&lt;br /&gt;
      &amp;lt;% review_text = &amp;quot;Review by #{fullname}&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% end%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''E.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;% if review.done_by_staff_participant? %&amp;gt;&lt;br /&gt;
      &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt; &amp;lt;img data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Icon indicates this review was done by course staff&amp;quot; class=&amp;quot;img_icon&amp;quot; src=&amp;quot;/assets/staff.png&amp;quot;&amp;gt; &amp;lt;a target=&amp;quot;_blank&amp;quot; href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Click to see details&amp;quot;&amp;gt;&amp;lt;%= &amp;quot;Review &amp;quot; + i.to_s  %&amp;gt;&amp;lt;/a&amp;gt; &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt; &amp;lt;a target=&amp;quot;_blank&amp;quot; href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Click to see details&amp;quot;&amp;gt;&amp;lt;%= &amp;quot;Review &amp;quot; + i.to_s %&amp;gt;&amp;lt;/a&amp;gt;  &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;% if review.done_by_staff_participant? %&amp;gt;&lt;br /&gt;
    &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;img&lt;br /&gt;
      data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
      data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
      title=&amp;quot;Icon indicates this review was done by course staff&amp;quot; class=&amp;quot;img_icon&amp;quot;&lt;br /&gt;
      src=&amp;quot;/assets/staff.png&amp;quot;&lt;br /&gt;
      &amp;gt;&lt;br /&gt;
    &amp;lt;a&lt;br /&gt;
      target=&amp;quot;_blank&amp;quot;&lt;br /&gt;
      href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;&lt;br /&gt;
      data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
      data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
      title=&amp;quot;Click to see details&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;%= review_text %&amp;gt;&lt;br /&gt;
    &amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
    &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;a&lt;br /&gt;
            target=&amp;quot;_blank&amp;quot; &lt;br /&gt;
            href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  &lt;br /&gt;
            data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
            data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
            title=&amp;quot;Click to see details&amp;quot;&lt;br /&gt;
        &amp;gt;&lt;br /&gt;
        &amp;lt;%= review_text %&amp;gt;&lt;br /&gt;
        &amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====F.In app/views/grades/view_team.html.erb:====&lt;br /&gt;
&lt;br /&gt;
'''F.1: '''Added function teammateSelectOnChange:&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  function teammateSelectOnChange(selectNode) {&lt;br /&gt;
      const revieweeIdToShow= selectNode.value;&lt;br /&gt;
      const tableSelector = &amp;quot;.teammate_table&amp;quot;;&lt;br /&gt;
      if(revieweeIdToShow == &amp;quot;all&amp;quot;) {&lt;br /&gt;
        document.querySelectorAll(tableSelector).forEach((tableNode) =&amp;gt; {&lt;br /&gt;
          tableNode.classList.remove(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
        });&lt;br /&gt;
        return;&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
  document.querySelectorAll(tableSelector).forEach((tableNode) =&amp;gt; {&lt;br /&gt;
    const tableRevieweeId = tableNode.getAttribute('data-reviewee_id');&lt;br /&gt;
    if(tableRevieweeId == revieweeIdToShow) {&lt;br /&gt;
      tableNode.classList.remove(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
    } else {&lt;br /&gt;
      tableNode.classList.add(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    });&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;% @vmlist.each do |vm| %&amp;gt;&lt;br /&gt;
        &amp;lt;% if (vm.questionnaire_display_type == &amp;quot;Metareview&amp;quot; or vm.questionnaire_display_type == &amp;quot;Author Feedback&amp;quot; or vm.questionnaire_display_type == &amp;quot;Teammate Review&amp;quot;) and @current_role_name.eql?'Student' %&amp;gt;&lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
        &amp;lt;% if vm.list_of_reviewers.length &amp;gt; 0 %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
​      &amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  @@ -87,6 +131,8 @@&lt;br /&gt;
              &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
                &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                    (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
        &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;%# This boolean is used to render a dropdown just before the first teammate review heat grid %&amp;gt;&lt;br /&gt;
&amp;lt;% first_teammate_review_appeared = false %&amp;gt;&lt;br /&gt;
&amp;lt;% @vmlist.each do |vm| %&amp;gt;&lt;br /&gt;
    &amp;lt;% if not @current_role_name.eql?'Student' and not first_teammate_review_appeared and vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        &amp;lt;select onchange=&amp;quot;teammateSelectOnChange(this)&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;all&amp;quot;&amp;gt;All&amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;% @vmlist.select { |tm_vm| tm_vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; }.each do |tm_vm| %&amp;gt;&lt;br /&gt;
            &amp;lt;option value=&amp;quot;&amp;lt;%= tm_vm.reviewee_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;%= tm_vm.reviewee_name(session[:ip]) %&amp;gt;&lt;br /&gt;
            &amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
        &amp;lt;/select&amp;gt;&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;% first_teammate_review_appeared = true %&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;% if (vm.questionnaire_display_type == &amp;quot;Metareview&amp;quot; or vm.questionnaire_display_type == &amp;quot;Author Feedback&amp;quot;) and @current_role_name.eql?'Student' %&amp;gt;&lt;br /&gt;
    &amp;lt;% elsif (vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; and @current_role_name.eql?'Student' and !@assignment.show_teammate_reviews)%&amp;gt;&lt;br /&gt;
    &amp;lt;% elsif (vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; and @current_role_name.eql?'Student' and @assignment.show_teammate_reviews and current_user.id != vm.reviewee_id )%&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
        &amp;lt;% if vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
          &amp;lt;div class=&amp;quot;teammate_table&amp;quot; data-reviewee_id=&amp;quot;&amp;lt;%= vm.reviewee_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
        &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.3  '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
@@ -87,6 +131,8 @@&lt;br /&gt;
          &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
            &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
@@ -87,6 +131,8 @@&lt;br /&gt;
          &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
            &amp;lt;% elsif vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (For: &amp;lt;%= vm.reviewee_name(session[:ip]) %&amp;gt;)&lt;br /&gt;
            &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.4 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_reviews.each do |review| %&amp;gt;&lt;br /&gt;
              &amp;lt;!-- instructors (or higher level users) see reviewer name, students see anonymized string --&amp;gt;&lt;br /&gt;
              &amp;lt;% if (['Student'].include? @current_role_name) &amp;amp;&amp;amp; @assignment.is_anonymous%&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i} %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                  &amp;lt;% user_name = User.find(Participant.find(ResponseMap.find(Response.find(review.id).map_id).reviewer_id).user_id).fullname(session[:ip]).to_s %&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i} %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% i += 1 %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-true&amp;quot; align=&amp;quot;right&amp;quot; &amp;gt;&lt;br /&gt;
            Avg&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;span  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;A count of comments, for the respective question, which have word count &amp;gt; 10. The purpose of this metric is to represent how many comments for the question are of a substantial length to provide quality feedback.&amp;quot;&amp;gt;metric-1&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/thead&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_reviews.each do |review| %&amp;gt;&lt;br /&gt;
              &amp;lt;!-- instructors (or higher level users) see reviewer name, students see anonymized string --&amp;gt;&lt;br /&gt;
              &amp;lt;% if (['Student'].include? @current_role_name) &amp;amp;&amp;amp; @assignment.is_anonymous%&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i, questionnaire_type: vm.questionnaire_type } %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                &amp;lt;% user_name = User.find(Participant.find(ResponseMap.find(Response.find(review.id).map_id).reviewer_id).user_id).fullname(session[:ip]).to_s %&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i, questionnaire_type: vm.questionnaire_type } %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% i += 1 %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-true&amp;quot; align=&amp;quot;right&amp;quot; &amp;gt;&lt;br /&gt;
            Avg&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/thead&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.5 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_rows.each do |row| %&amp;gt;&lt;br /&gt;
            &amp;lt;!-- notice the data-target. because we're toggling via looped code, we need to dynamically generate the identifier. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr data-toggle=&amp;quot;collapse&amp;quot; class=&amp;quot;accordion-toggle&amp;quot; data-target=&amp;quot;#hid&amp;lt;%= row.question_id.to_s + vm.round.to_s %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;td class = 'cf' data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= row.question_text %&amp;gt;&amp;quot;&amp;gt; &amp;lt;div style='float: left'&amp;gt;&amp;lt;%= j.to_s %&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div style='float: right'&amp;gt; &amp;amp;#&amp;lt;%= type_and_max(row) %&amp;gt;;&amp;lt;/div&amp;gt;  &amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
              &amp;lt;!-- actual cells with scores and colored background. --&amp;gt;&lt;br /&gt;
              &amp;lt;% row.score_row.each do |score| %&amp;gt;&lt;br /&gt;
                  &amp;lt;% score_comment = score.comment.nil? ? '' : score.comment %&amp;gt; &amp;lt;!-- changing nil to null string to avoid Null Pointer Exception --&amp;gt;&lt;br /&gt;
                  &amp;lt;td class=&amp;quot;&amp;lt;%= score.color_code %&amp;gt;&amp;quot; align=&amp;quot;center&amp;quot; data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= strip_tags(score.comment).html_safe%&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;&amp;lt;%=  underlined?(score) %&amp;gt;&amp;quot;&amp;gt;&amp;lt;%= score.score_value.to_s %&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
                  &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_rows.each do |row| %&amp;gt;&lt;br /&gt;
            &amp;lt;% target_id = &amp;quot;hid__#{row.question_id}__#{vm.round}&amp;quot; %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
              &amp;lt;%# Since we render different heatgrids with the same questions for each&lt;br /&gt;
              teammember, we need to distinguish the ID, based on the user for whom,&lt;br /&gt;
              the reviews have been created. %&amp;gt;&lt;br /&gt;
              &amp;lt;% target_id += &amp;quot;__#{vm.reviewee_id}&amp;quot; %&amp;gt;&lt;br /&gt;
            &amp;lt;% end%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;!-- notice the data-target. because we're toggling via looped code, we need to dynamically generate the identifier. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr data-toggle=&amp;quot;collapse&amp;quot; class=&amp;quot;accordion-toggle&amp;quot; data-target=&amp;quot;&amp;lt;%= &amp;quot;#&amp;quot; + target_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;td class = 'cf' data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= row.question_text %&amp;gt;&amp;quot;&amp;gt; &amp;lt;div style='float: left'&amp;gt;&amp;lt;%= j.to_s %&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div style='float: right'&amp;gt; &amp;amp;#&amp;lt;%= type_and_max(row) %&amp;gt;;&amp;lt;/div&amp;gt;  &amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
              &amp;lt;!-- actual cells with scores and colored background. --&amp;gt;&lt;br /&gt;
              &amp;lt;% row.score_row.each do |score| %&amp;gt;&lt;br /&gt;
                  &amp;lt;% score_comment = score.comment.nil? ? '' : score.comment %&amp;gt;&lt;br /&gt;
                  &amp;lt;!-- changing nil to null string to avoid Null Pointer Exception --&amp;gt;&lt;br /&gt;
                  &amp;lt;td class=&amp;quot;&amp;lt;%= score.color_code %&amp;gt;&amp;quot; align=&amp;quot;center&amp;quot; data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= strip_tags(score.comment).html_safe%&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;&amp;lt;%=  underlined?(score) %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                      &amp;lt;%= score.score_value.to_s %&amp;gt;&lt;br /&gt;
                    &amp;lt;/span&amp;gt;&lt;br /&gt;
                  &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.6 '''Removed the following code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 &amp;lt;td  class = 'cf' align=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;%= row.countofcomments.to_s %&amp;gt;&lt;br /&gt;
              &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.7 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!--loop that creates the collapsed-by-default row, which lists all comments. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr class=&amp;quot;tablesorter-childRow&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;td colspan=&amp;quot;&amp;lt;%= (i+1).to_s %&amp;gt;&amp;quot; class=&amp;quot;hiddenRow&amp;quot; &amp;gt;&amp;lt;div id=&amp;quot;hid&amp;lt;%= row.question_id.to_s + vm.round.to_s %&amp;gt;&amp;quot; class=&amp;quot;accordion-body collapse&amp;quot; style=&amp;quot;margin-left:10px;&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;div style=&amp;quot;padding-top: 10px; padding-bottom: 10px;&amp;quot;&amp;gt;&amp;lt;%=  sanitize row.question_text %&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;div&amp;gt;&lt;br /&gt;
                  &amp;lt;table class=&amp;quot;table tbl_questlist&amp;quot;&amp;gt;&lt;br /&gt;
@@ -181,7 +233,17 @@&lt;br /&gt;
                    &amp;lt;/thead&amp;gt;&lt;br /&gt;
                    &amp;lt;% for index in 0 .. row.score_row.length - 1 %&amp;gt;&lt;br /&gt;
                        &amp;lt;tr&amp;gt;&lt;br /&gt;
                          &amp;lt;td&amp;gt;Review &amp;lt;%=index + 1%&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!--loop that creates the collapsed-by-default row, which lists all comments. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr class=&amp;quot;tablesorter-childRow&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;td colspan=&amp;quot;&amp;lt;%= (i+1).to_s %&amp;gt;&amp;quot; class=&amp;quot;hiddenRow&amp;quot; &amp;gt;&amp;lt;div id=&amp;quot;&amp;lt;%= target_id %&amp;gt;&amp;quot; class=&amp;quot;accordion-body collapse&amp;quot; style=&amp;quot;margin-left:10px;&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;div style=&amp;quot;padding-top: 10px; padding-bottom: 10px;&amp;quot;&amp;gt;&amp;lt;%=  sanitize row.question_text %&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;div&amp;gt;&lt;br /&gt;
                  &amp;lt;table class=&amp;quot;table tbl_questlist&amp;quot;&amp;gt;&lt;br /&gt;
@@ -181,7 +233,17 @@&lt;br /&gt;
                    &amp;lt;/thead&amp;gt;&lt;br /&gt;
                    &amp;lt;% for index in 0 .. row.score_row.length - 1 %&amp;gt;&lt;br /&gt;
                        &amp;lt;tr&amp;gt;&lt;br /&gt;
                          &amp;lt;% if @current_role_name.eql?'Student' or vm.questionnaire_type != &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                            &amp;lt;%# Use Review {{index}} format for student view, and&lt;br /&gt;
                            when questionnaire_type is not teammatereview %&amp;gt;&lt;br /&gt;
                            &amp;lt;td&amp;gt;Review &amp;lt;%=index + 1%&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
                          &amp;lt;% else %&amp;gt;&lt;br /&gt;
                            &amp;lt;td&amp;gt;&lt;br /&gt;
                              &amp;lt;% reviewer_id = row.score_row[index].reviewer_id %&amp;gt;&lt;br /&gt;
                              &amp;lt;% fullname = Participant.find_by(id: reviewer_id).fullname(session[:ip]) %&amp;gt;&lt;br /&gt;
                              Review by &amp;lt;%= fullname %&amp;gt;&lt;br /&gt;
                            &amp;lt;/td&amp;gt;&lt;br /&gt;
                          &amp;lt;% end%&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====G. In spec/controllers/grades_controller_spec.rb:====&lt;br /&gt;
&lt;br /&gt;
'''G.1 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
before(:each) do&lt;br /&gt;
  allow(AssignmentParticipant).to receive(:find).with('1').and_return(participant)&lt;br /&gt;
  allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
  stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
@@ -91,29 +90,106 @@&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
before(:each) do&lt;br /&gt;
  allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
  stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
@@ -91,29 +90,106 @@&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''G.2 '''Remove xdescribe '#view_team' and change describe '#view_team' as follows.&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#view_team' do&lt;br /&gt;
render_views&lt;br /&gt;
context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
  it 'renders grades#view_team page' do&lt;br /&gt;
    allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
    allow(AssignmentQuestionnaire).to receive(:find_by).with(assignment_id: 1, questionnaire_id: 1).and_return(assignment_questionnaire)&lt;br /&gt;
    allow(AssignmentQuestionnaire).to receive(:where).with(any_args).and_return([assignment_questionnaire])&lt;br /&gt;
    allow(assignment).to receive(:late_policy_id).and_return(false)&lt;br /&gt;
    allow(assignment).to receive(:calculate_penalty).and_return(false)&lt;br /&gt;
    allow(assignment).to receive(:compute_total_score).with(any_args).and_return(100)&lt;br /&gt;
    allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
    allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
    params = {id: 1}&lt;br /&gt;
    allow(TaMapping).to receive(:exists?).with(ta_id: 1, course_id: 1).and_return(true)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#view_team' do&lt;br /&gt;
render_views&lt;br /&gt;
&lt;br /&gt;
# All stubs and factories are instantiated within this scope so as to not &lt;br /&gt;
# clash with other broken test.&lt;br /&gt;
# The names of the factories created for testing view_team&lt;br /&gt;
# have `_vt` suffix ```where necessary``` to differentiate them from &lt;br /&gt;
# the above declared factories&lt;br /&gt;
&lt;br /&gt;
let(:student1_vt) { create(:student, name: &amp;quot;barry&amp;quot;, id: 12) }&lt;br /&gt;
let(:student2_vt) { create(:student, name: &amp;quot;iris&amp;quot;, id: 13) }&lt;br /&gt;
&lt;br /&gt;
let(:tm_questionnaire) {&lt;br /&gt;
  build(&lt;br /&gt;
    :teammate_review_questionnaire,&lt;br /&gt;
    id: 12,&lt;br /&gt;
    questions: [question],&lt;br /&gt;
    max_question_score: 5&lt;br /&gt;
  )&lt;br /&gt;
}&lt;br /&gt;
let(:assignment_vt) {&lt;br /&gt;
  create(:assignment, id: 6, max_team_size: 2,&lt;br /&gt;
  questionnaires: [tm_questionnaire])&lt;br /&gt;
}&lt;br /&gt;
let(:assignment_questionnaire_vt) {&lt;br /&gt;
  create(:tm_assignment_questionnaire, id: 12, used_in_round: nil,&lt;br /&gt;
  assignment: assignment_vt, questionnaire: tm_questionnaire) }&lt;br /&gt;
let(:team_vt) { create(:assignment_team, id: 12,&lt;br /&gt;
assignment: assignment_vt) }&lt;br /&gt;
let(:participant_vt) { create(:participant, id: 12,&lt;br /&gt;
  assignment: assignment_vt, user_id: student1_vt.id) }&lt;br /&gt;
let(:participant2_vt) { create(:participant, id: 13,&lt;br /&gt;
  assignment: assignment_vt, user_id: student2_vt.id) }&lt;br /&gt;
&lt;br /&gt;
before(:each) do&lt;br /&gt;
  # Need to stub this method so the factory instance with&lt;br /&gt;
  # the stubbed :team method is returned by :find&lt;br /&gt;
  # instead of a separate instance with the same data&lt;br /&gt;
  allow(AssignmentParticipant)&lt;br /&gt;
    .to receive(:find)&lt;br /&gt;
    .with(participant_vt.id.to_s)&lt;br /&gt;
    .and_return(participant_vt)&lt;br /&gt;
  allow(participant_vt).to receive(:team).and_return(team_vt)&lt;br /&gt;
  allow(team_vt).to receive(:participants).and_return([participant_vt, participant2_vt])&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:find_by)&lt;br /&gt;
    .with(assignment_id: assignment_vt.id, questionnaire_id: tm_questionnaire.id)&lt;br /&gt;
    .and_return(assignment_questionnaire_vt)&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:find_by)&lt;br /&gt;
    .with(assignment_id: assignment.id, questionnaire_id: review_questionnaire.id)&lt;br /&gt;
    .and_return(assignment_questionnaire_vt)&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:where)&lt;br /&gt;
    .with(any_args)&lt;br /&gt;
    .and_return([assignment_questionnaire_vt])&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:late_policy_id)&lt;br /&gt;
    .and_return(false)&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:calculate_penalty)&lt;br /&gt;
    .and_return(false)&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:compute_total_score)&lt;br /&gt;
    .with(any_args)&lt;br /&gt;
    .and_return(100)&lt;br /&gt;
  allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
  allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
 it 'renders grades#view_team page' do&lt;br /&gt;
  params = {id: participant_vt.id}&lt;br /&gt;
  get :view_team, params&lt;br /&gt;
  expect(response).to render_template(:view_team)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is opened by student' do&lt;br /&gt;
  it 'dropdown is not rendered' do&lt;br /&gt;
    session = { user: student1_vt }&lt;br /&gt;
    params = {id: participant_vt.id}&lt;br /&gt;
    stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
    get :view_team, params&lt;br /&gt;
    expect(response.body).to_not have_selector('select')&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is opened by instructor' do&lt;br /&gt;
  it 'dropdown is rendered' do&lt;br /&gt;
    session = { user: instructor }&lt;br /&gt;
    params = {id: participant_vt.id}&lt;br /&gt;
    get :view_team, params&lt;br /&gt;
    expect(response.body).to have_selector('select')&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
  it 'renders grades#view_team page' do&lt;br /&gt;
    params = { id: participant_vt.id }&lt;br /&gt;
    allow(TaMapping).to receive(:exists?).with(ta_id: participant_vt.user_id, course_id: 1).and_return(true)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====H. In spec/factories/factories.rb:====&lt;br /&gt;
&lt;br /&gt;
'''H.1 '''Add the following factory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
factory :teammate_review_questionnaire, class: TeammateReviewQuestionnaire do&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''H.2 '''Add another factory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
factory :tm_assignment_questionnaire, class: AssignmentQuestionnaire do&lt;br /&gt;
  user_id 1&lt;br /&gt;
  questionnaire { association(:teammate_review_questionnaire) }&lt;br /&gt;
  questionnaire_weight 100&lt;br /&gt;
  used_in_round nil&lt;br /&gt;
  topic_id nil&lt;br /&gt;
  dropdown 1&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Summary of file changes ===&lt;br /&gt;
&lt;br /&gt;
The following files are modified:&lt;br /&gt;
&lt;br /&gt;
1. app/controllers/grades_controller.rb - Controller file which changed how the view model is populated&lt;br /&gt;
&lt;br /&gt;
2. app/views/grades/view_team.html.erb - View file, which  conditionally rendered the teammate name, for a teammate review heatgrid&lt;br /&gt;
&lt;br /&gt;
3. spec/controllers/grades_controller_spec.rb - For tests verifying the proposed changes&lt;br /&gt;
&lt;br /&gt;
4. app/models/vm_question_response.rb - To modify the view-model so it can tell us the name of the person being reviewed for the current heatgrid&lt;br /&gt;
&lt;br /&gt;
5. app/models/vm_question_response_score_cell.rb - &lt;br /&gt;
&lt;br /&gt;
6. app/assets/stylesheets/grades.scss - &lt;br /&gt;
&lt;br /&gt;
7. app/views/grades/_add_icon_to_name.html.erb - &lt;br /&gt;
&lt;br /&gt;
8. spec/factories/factories.rb - &lt;br /&gt;
&lt;br /&gt;
== Design Patterns ==&lt;br /&gt;
&lt;br /&gt;
Existing code does not use any design patterns, apart from if-else. It uses if-else conditional statements to check what type of questionnaire is present in the viewmodel `VmQuestionResponse`, and based on that, it renders the appropriate content.&lt;br /&gt;
&lt;br /&gt;
We decided to continue with this approach since to change the present coding style, there were required many changes (refactoring) to many files which were out of the scope of the present project. To complete the project in the assigned time, we followed the if-else approach.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== User Stories ==&lt;br /&gt;
&lt;br /&gt;
1. As an instructor, I can view what reviews one teammate has given to other teammates.&lt;br /&gt;
&lt;br /&gt;
2. As a student, I can view what reviews my teammates have given to me.&lt;br /&gt;
&lt;br /&gt;
3. As an instructor, I can select if a student's reviews are anonymously shown to their teammates.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
'''CURRENT STATUS'''&lt;br /&gt;
&lt;br /&gt;
1. Presently, the tests only cover if the view_team is page is rendered when it is asked for.&lt;br /&gt;
&lt;br /&gt;
[[File:current_testing_status.png|border|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''OUR PROPOSAL'''&lt;br /&gt;
&lt;br /&gt;
- When show_team is set as false by the professor, the student should not be able to see his scores.&lt;br /&gt;
&lt;br /&gt;
- When show_team is set as true by the professor, the student should be able to see his.&lt;br /&gt;
&lt;br /&gt;
- An instructor can select which student's scores he/she wants to see. If no student's name is selected then the professor can see the scores of all the students.&lt;br /&gt;
- The instructor can decide whether to show the names of the reviewer to the reviewer in teammate reviews, by selecting a checkbox for the same.&lt;br /&gt;
[[File:Untitled Diagram.drawio.png|border|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;https://expertiza.ncsu.edu/&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Agarg25</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141732</id>
		<title>CSC/ECE 517 Fall 2021 - E2165. Fix teammate-review view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141732"/>
		<updated>2021-11-28T17:17:05Z</updated>

		<summary type="html">&lt;p&gt;Agarg25: /* Proposed changes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Introduction ==&lt;br /&gt;
&lt;br /&gt;
Dr. Edward Gehringer (instructor), Parimal Mehta (mentor)&lt;br /&gt;
&lt;br /&gt;
1. Anjali Garg (unity ID : agarg25)&lt;br /&gt;
&lt;br /&gt;
2. Arvasu Chikara (unity ID: achikar2)&lt;br /&gt;
&lt;br /&gt;
3. Lalit Bangad (unity ID: llbangad)&lt;br /&gt;
&lt;br /&gt;
4. Vinay Deshmukh (unity ID: vdeshmu)&lt;br /&gt;
&lt;br /&gt;
== Problems to be addressed ==&lt;br /&gt;
&lt;br /&gt;
After a project is submitted and reviewed, both the team members (students) and instructors should be able to view the teammate reviews. Students should be able to view the reviews by going to a particular assignment's -&amp;gt; your scores, at the bottom of the page. An instructor can view the teammate reviews by going to assignments -&amp;gt; assignment -&amp;gt; particular team's submission -&amp;gt; view submission -&amp;gt; assign grades -&amp;gt; view scores. &lt;br /&gt;
&lt;br /&gt;
In the case of the instructor, a single heat grid is shown whereas in the case of a team member, we cant view the scores. In the heat grid, it is not clear if the scores visible are for the reviews that the student has *written* for their teammates or the scores that the student has *received* from their teammates. Additionally, for instructors can choose from a list of the students on the team, but they have no way to tell whether the heat grid shows the reviews done *by* that student or done *for* that student.&lt;br /&gt;
&lt;br /&gt;
== Methodology Overview ==&lt;br /&gt;
&lt;br /&gt;
We have divided our work in the following tasks to address the above problems:&lt;br /&gt;
&lt;br /&gt;
1. Distinguish reviews done for a student by rendering separates heatgrids for each student&lt;br /&gt;
&lt;br /&gt;
2. For instructors, the table will have sections based on the students&lt;br /&gt;
&lt;br /&gt;
3. Include a checkbox on the edit assignment page that enables/disables visibility of heat grid to students&lt;br /&gt;
&lt;br /&gt;
4. Fix the average column for a table (which breaks for some reviews)&lt;br /&gt;
&lt;br /&gt;
5. Show a composite score derived from all reviews.  Make this code generalized, so other kinds of heat grid views could use it.&lt;br /&gt;
&lt;br /&gt;
6. Changes should work even in an anonymized view&lt;br /&gt;
&lt;br /&gt;
== Motivations ==&lt;br /&gt;
&lt;br /&gt;
1. Enable users to clearly tell which reviews are done by them, and which reviews are done for them.&lt;br /&gt;
&lt;br /&gt;
2. Code should be generic so it can be used for different types of heat grids as well.&lt;br /&gt;
&lt;br /&gt;
== Control Flow to access the concerned screens ==&lt;br /&gt;
'''1. For instructor (Log in as an instructor):-'''&lt;br /&gt;
&lt;br /&gt;
Screen after logging in by the instructor&lt;br /&gt;
[[File:ss1.png |border|1000px|center]]&lt;br /&gt;
Got to assignments on the Manage menu &lt;br /&gt;
[[File:ss2.png |border|1000px|center]]&lt;br /&gt;
Go to assignments&lt;br /&gt;
[[File:ss3.png |border|1000px|center]]&lt;br /&gt;
Go to submissions for any assignment&lt;br /&gt;
[[File:ss4a.png |border|1000px|center]]&lt;br /&gt;
Go to Assign Grade&lt;br /&gt;
[[File:ss5a.png |border|1000px|center]]&lt;br /&gt;
You will land on the page where the changes are made and can be reviewed&lt;br /&gt;
[[File:ss7a.png |border|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
'''2. Student:- (Logged in as an instructor)'''&lt;br /&gt;
&lt;br /&gt;
After landing on the assignments page, select any student from an assignment as shown below&lt;br /&gt;
[[File:ss6a.png |border|1000px|center]]&lt;br /&gt;
Go to/Select any assignment&lt;br /&gt;
[[File:ss9a.png |border|1000px|center]]&lt;br /&gt;
Go to your scores&lt;br /&gt;
[[File:ss10a.png |border|1000px|center]]&lt;br /&gt;
You will land on the page where the changes are made and can be reviewed&lt;br /&gt;
[[File:ss11a.png |border|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
== Old Status of the application ==&lt;br /&gt;
&lt;br /&gt;
'''1. Instructor's view of teammate review''': This is the current screen given to the instructor. Here we see that the instructor can not determine who has given which review to which student in a team.&lt;br /&gt;
&lt;br /&gt;
[[File:Instructor-view-1.png|border| 700px |center|alt=The proposed expanded student display.|The proposed expanded student display.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2. Student's view of teammate review''': Currently, a student is not able to see what grades were given by their teammates. We need to implement that functionality so that the student is able to view those grades.&lt;br /&gt;
&lt;br /&gt;
[[File:Student-view-2.png|border| 700px |center|alt=The current instructor view.|The current review display for instructors.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Error in existing UI for student''': In the existing UI for a student, the highlighted block should not be rendered. This part of the screen is meant for the instructors/TAs. &lt;br /&gt;
&lt;br /&gt;
[[File:Wrong render for student.png|border|700px|center|alt=Existing UI for student|Existing UI for student.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Proposed changes ==&lt;br /&gt;
&lt;br /&gt;
''' 1) Proposed UI for instructor ''': The instructor is able to see the score for all teammates. In the existing code, only one teammate's scores are being shown. But, we are planning to change the way the (VmQuestionResponse array is populated)[https://github.com/expertiza/expertiza/blob/master/app/controllers/grades_controller.rb#L114], so that the scores for all teammates are appended to it so it correctly shows what should have already been shown in this screen for the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Proposed_screen.png|border|700px|center|alt=Proposed UI for instructor|Proposed UI for instructor.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: When a student visits this screen, they will only be shown the reviews received by them, assuming the instructor has allowed visibility of teammate reviews to students.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' 2) Show detailed review for a particular question''': Int the existing UI, even if we select to see the detailed review for student 2 for example, student 1's detailed reviews expand. We proposed to correct this:   &lt;br /&gt;
&lt;br /&gt;
[[File:ss12a.png|border|700px|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' 3) Show teammate review to student UI ''': The existing code doesn't render a student's teammate review scores at all. We are planning to render the scores to a student (as shown below) when they visit this screen. However, the visibility of this screen is contingent on whether the instructor has allowed visibility of the teammate review screen to students. If the instructor has disabled this feature, then the heatgrid will not be displayed at all.&lt;br /&gt;
&lt;br /&gt;
[[File:UI_for_student.png|border|700px|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
== Models used / Explanation of fixes ==&lt;br /&gt;
&lt;br /&gt;
The below diagram illustrates the proposed code change for showing all team members with the teammate review data to an instructor. The existing code only iterated on the `Participant` whose ID is present in the URL of the page. To fix this, we will iterate over all teammates of the given participant so that all teammate reviews for all team members are shown to the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Logic e2165.png|border|center|alt=Flow diagram of proposed changes for showing team review data to instructor]]&lt;br /&gt;
&lt;br /&gt;
===Changes made to the code are shown below. Every change is shown and explained separately===&lt;br /&gt;
&lt;br /&gt;
====A. Added the following to app/assets/stylesheets/grades.scss:====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    .teammate_table.hidden {&lt;br /&gt;
      display: none;&lt;br /&gt;
      }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====B. In app/controllers/grades_controller.rb: ====&lt;br /&gt;
&lt;br /&gt;
'''B.1:'''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
  @vmlist &amp;lt;&amp;lt; populate_view_model(questionnaire)&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
     if questionnaire.type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
        # as teammate review will be different for each participant&lt;br /&gt;
        # we need to create a separate table for each teammate&lt;br /&gt;
        @participant.team.participants.each do |team_participant|&lt;br /&gt;
          @vmlist &amp;lt;&amp;lt; populate_view_model(team_participant, questionnaire, @team)&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        # only one participant needs iterating, as apart from teammatereview&lt;br /&gt;
        # all other reviews are at &amp;quot;team&amp;quot; level&lt;br /&gt;
        @vmlist &amp;lt;&amp;lt; populate_view_model(@participant, questionnaire, @team)&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
'''B.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
    def populate_view_model(questionnaire)&lt;br /&gt;
      vm = VmQuestionResponse.new(questionnaire, @assignment, @round)&lt;br /&gt;
      vmquestions = questionnaire.questions&lt;br /&gt;
      vm.add_questions(vmquestions)&lt;br /&gt;
      vm.add_team_members(@team)&lt;br /&gt;
      vm.add_reviews(@participant, @team, @assignment.vary_by_round)&lt;br /&gt;
      vm.number_of_comments_greater_than_10_words&lt;br /&gt;
      vm &lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
    def populate_view_model(participant, questionnaire, team)&lt;br /&gt;
      vm = VmQuestionResponse.new(questionnaire, @assignment, @round)&lt;br /&gt;
      vmquestions = questionnaire.questions&lt;br /&gt;
      vm.add_questions(vmquestions)&lt;br /&gt;
      vm.add_team_members(team)&lt;br /&gt;
      vm.add_reviews(participant, team, @assignment.vary_by_round)&lt;br /&gt;
      vm.number_of_comments_greater_than_10_words&lt;br /&gt;
      vm&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====C. In app/models/vm_question_response.rb:====&lt;br /&gt;
&lt;br /&gt;
'''C.1: '''Added the reviewee_id method&lt;br /&gt;
&lt;br /&gt;
    def reviewee_id&lt;br /&gt;
      @participant_who_is_reviewee.user_id&lt;br /&gt;
    end &lt;br /&gt;
&lt;br /&gt;
'''C.2: '''Added the reviewee_name method&lt;br /&gt;
&lt;br /&gt;
    def reviewee_name(ip_address = nil)&lt;br /&gt;
      part = @participant_who_is_reviewee&lt;br /&gt;
      User.find_by(id: part.user_id).fullname(ip_address)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''C.3: '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
    elsif @questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
      reviews = participant.teammate_reviews&lt;br /&gt;
      reviews.each do |review|&lt;br /&gt;
        review_mapping = TeammateReviewResponseMap.find_by(id: review.map_id)&lt;br /&gt;
        participant = Participant.find(review_mapping.reviewer_id)&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
    elsif @questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
      reviews = participant.teammate_reviews&lt;br /&gt;
      @participant_who_is_reviewee = participant&lt;br /&gt;
      reviews.each do |review|&lt;br /&gt;
        review_mapping = TeammateReviewResponseMap.find_by(id: review.map_id)&lt;br /&gt;
        participant = Participant.find(review_mapping.reviewer_id)&lt;br /&gt;
&lt;br /&gt;
'''C.4: '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
    row.score_row.push(VmQuestionResponseScoreCell.new(answer.answer, color_code, answer.comments, vm_tag_prompts))&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
    &lt;br /&gt;
    row.score_row.push(VmQuestionResponseScoreCell.new(answer.answer, color_code, answer.comments, vm_tag_prompts, answer.response_id))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====D. In app/models/vm_question_response_score_cell.rb:====&lt;br /&gt;
&lt;br /&gt;
'''D.1: '''In the method initialize of class VmQuestionResponseScoreCell&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
    def initialize(score_value, color_code, comments, vmprompts = nil)&lt;br /&gt;
      @score_value = score_value&lt;br /&gt;
      @color_code = color_code&lt;br /&gt;
      @comment = comments&lt;br /&gt;
      @vm_prompts = vmprompts&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&lt;br /&gt;
    def initialize(score_value, color_code, comments, vmprompts = nil, response_id)&lt;br /&gt;
      @score_value = score_value&lt;br /&gt;
      @color_code = color_code&lt;br /&gt;
      @comment = comments&lt;br /&gt;
      @vm_prompts = vmprompts&lt;br /&gt;
      @response_id = response_id&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''D.2: '''Added a method reviewer_id to the class VmQuestionResponseScoreCell&lt;br /&gt;
&lt;br /&gt;
    def reviewer_id&lt;br /&gt;
      resp = Response.find(@response_id)&lt;br /&gt;
      map = ResponseMap.find(resp.map_id)&lt;br /&gt;
      map.reviewer_id&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====E. In app/views/grades/_add_icon_to_name.html.erb:====&lt;br /&gt;
&lt;br /&gt;
'''E.1 '''Added the following code to the file:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;%# Determine the content of the reviewed by text %&amp;gt;&lt;br /&gt;
    &amp;lt;% review_text = &amp;quot;&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% if @current_role_name.eql?'Student' or questionnaire_type != &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
      &amp;lt;%# Use Review {{index}} format for student view, and when questionnaire_type is not teammatereview %&amp;gt;&lt;br /&gt;
      &amp;lt;% review_text = &amp;quot;Review #{i + 1}&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;% resp = Response.find(review.id) %&amp;gt;&lt;br /&gt;
      &amp;lt;% map = ResponseMap.find(resp.map_id) %&amp;gt;&lt;br /&gt;
      &amp;lt;% reviewer_id = map.reviewer_id %&amp;gt;&lt;br /&gt;
      &amp;lt;% fullname = Participant.find_by(id: reviewer_id).fullname(session[:ip]) %&amp;gt;&lt;br /&gt;
      &amp;lt;% review_text = &amp;quot;Review by #{fullname}&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% end%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''E.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;% if review.done_by_staff_participant? %&amp;gt;&lt;br /&gt;
      &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt; &amp;lt;img data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Icon indicates this review was done by course staff&amp;quot; class=&amp;quot;img_icon&amp;quot; src=&amp;quot;/assets/staff.png&amp;quot;&amp;gt; &amp;lt;a target=&amp;quot;_blank&amp;quot; href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Click to see details&amp;quot;&amp;gt;&amp;lt;%= &amp;quot;Review &amp;quot; + i.to_s  %&amp;gt;&amp;lt;/a&amp;gt; &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt; &amp;lt;a target=&amp;quot;_blank&amp;quot; href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Click to see details&amp;quot;&amp;gt;&amp;lt;%= &amp;quot;Review &amp;quot; + i.to_s %&amp;gt;&amp;lt;/a&amp;gt;  &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;% if review.done_by_staff_participant? %&amp;gt;&lt;br /&gt;
    &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;img&lt;br /&gt;
      data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
      data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
      title=&amp;quot;Icon indicates this review was done by course staff&amp;quot; class=&amp;quot;img_icon&amp;quot;&lt;br /&gt;
      src=&amp;quot;/assets/staff.png&amp;quot;&lt;br /&gt;
      &amp;gt;&lt;br /&gt;
    &amp;lt;a&lt;br /&gt;
      target=&amp;quot;_blank&amp;quot;&lt;br /&gt;
      href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;&lt;br /&gt;
      data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
      data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
      title=&amp;quot;Click to see details&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;%= review_text %&amp;gt;&lt;br /&gt;
    &amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
    &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;a&lt;br /&gt;
            target=&amp;quot;_blank&amp;quot; &lt;br /&gt;
            href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  &lt;br /&gt;
            data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
            data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
            title=&amp;quot;Click to see details&amp;quot;&lt;br /&gt;
        &amp;gt;&lt;br /&gt;
        &amp;lt;%= review_text %&amp;gt;&lt;br /&gt;
        &amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====F.In app/views/grades/view_team.html.erb:====&lt;br /&gt;
&lt;br /&gt;
'''F.1: '''Added function teammateSelectOnChange:&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  function teammateSelectOnChange(selectNode) {&lt;br /&gt;
      const revieweeIdToShow= selectNode.value;&lt;br /&gt;
      const tableSelector = &amp;quot;.teammate_table&amp;quot;;&lt;br /&gt;
      if(revieweeIdToShow == &amp;quot;all&amp;quot;) {&lt;br /&gt;
        document.querySelectorAll(tableSelector).forEach((tableNode) =&amp;gt; {&lt;br /&gt;
          tableNode.classList.remove(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
        });&lt;br /&gt;
        return;&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
  document.querySelectorAll(tableSelector).forEach((tableNode) =&amp;gt; {&lt;br /&gt;
    const tableRevieweeId = tableNode.getAttribute('data-reviewee_id');&lt;br /&gt;
    if(tableRevieweeId == revieweeIdToShow) {&lt;br /&gt;
      tableNode.classList.remove(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
    } else {&lt;br /&gt;
      tableNode.classList.add(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    });&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;% @vmlist.each do |vm| %&amp;gt;&lt;br /&gt;
        &amp;lt;% if (vm.questionnaire_display_type == &amp;quot;Metareview&amp;quot; or vm.questionnaire_display_type == &amp;quot;Author Feedback&amp;quot; or vm.questionnaire_display_type == &amp;quot;Teammate Review&amp;quot;) and @current_role_name.eql?'Student' %&amp;gt;&lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
        &amp;lt;% if vm.list_of_reviewers.length &amp;gt; 0 %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
​      &amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  @@ -87,6 +131,8 @@&lt;br /&gt;
              &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
                &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                    (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
        &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;%# This boolean is used to render a dropdown just before the first teammate review heat grid %&amp;gt;&lt;br /&gt;
&amp;lt;% first_teammate_review_appeared = false %&amp;gt;&lt;br /&gt;
&amp;lt;% @vmlist.each do |vm| %&amp;gt;&lt;br /&gt;
    &amp;lt;% if not @current_role_name.eql?'Student' and not first_teammate_review_appeared and vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        &amp;lt;select onchange=&amp;quot;teammateSelectOnChange(this)&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;all&amp;quot;&amp;gt;All&amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;% @vmlist.select { |tm_vm| tm_vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; }.each do |tm_vm| %&amp;gt;&lt;br /&gt;
            &amp;lt;option value=&amp;quot;&amp;lt;%= tm_vm.reviewee_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;%= tm_vm.reviewee_name(session[:ip]) %&amp;gt;&lt;br /&gt;
            &amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
        &amp;lt;/select&amp;gt;&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;% first_teammate_review_appeared = true %&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;% if (vm.questionnaire_display_type == &amp;quot;Metareview&amp;quot; or vm.questionnaire_display_type == &amp;quot;Author Feedback&amp;quot;) and @current_role_name.eql?'Student' %&amp;gt;&lt;br /&gt;
    &amp;lt;% elsif (vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; and @current_role_name.eql?'Student' and !@assignment.show_teammate_reviews)%&amp;gt;&lt;br /&gt;
    &amp;lt;% elsif (vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; and @current_role_name.eql?'Student' and @assignment.show_teammate_reviews and current_user.id != vm.reviewee_id )%&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
        &amp;lt;% if vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
          &amp;lt;div class=&amp;quot;teammate_table&amp;quot; data-reviewee_id=&amp;quot;&amp;lt;%= vm.reviewee_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
        &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.3  '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
@@ -87,6 +131,8 @@&lt;br /&gt;
          &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
            &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
@@ -87,6 +131,8 @@&lt;br /&gt;
          &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
            &amp;lt;% elsif vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (For: &amp;lt;%= vm.reviewee_name(session[:ip]) %&amp;gt;)&lt;br /&gt;
            &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.4 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_reviews.each do |review| %&amp;gt;&lt;br /&gt;
              &amp;lt;!-- instructors (or higher level users) see reviewer name, students see anonymized string --&amp;gt;&lt;br /&gt;
              &amp;lt;% if (['Student'].include? @current_role_name) &amp;amp;&amp;amp; @assignment.is_anonymous%&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i} %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                  &amp;lt;% user_name = User.find(Participant.find(ResponseMap.find(Response.find(review.id).map_id).reviewer_id).user_id).fullname(session[:ip]).to_s %&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i} %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% i += 1 %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-true&amp;quot; align=&amp;quot;right&amp;quot; &amp;gt;&lt;br /&gt;
            Avg&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;span  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;A count of comments, for the respective question, which have word count &amp;gt; 10. The purpose of this metric is to represent how many comments for the question are of a substantial length to provide quality feedback.&amp;quot;&amp;gt;metric-1&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/thead&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_reviews.each do |review| %&amp;gt;&lt;br /&gt;
              &amp;lt;!-- instructors (or higher level users) see reviewer name, students see anonymized string --&amp;gt;&lt;br /&gt;
              &amp;lt;% if (['Student'].include? @current_role_name) &amp;amp;&amp;amp; @assignment.is_anonymous%&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i, questionnaire_type: vm.questionnaire_type } %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                &amp;lt;% user_name = User.find(Participant.find(ResponseMap.find(Response.find(review.id).map_id).reviewer_id).user_id).fullname(session[:ip]).to_s %&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i, questionnaire_type: vm.questionnaire_type } %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% i += 1 %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-true&amp;quot; align=&amp;quot;right&amp;quot; &amp;gt;&lt;br /&gt;
            Avg&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/thead&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.5 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_rows.each do |row| %&amp;gt;&lt;br /&gt;
            &amp;lt;!-- notice the data-target. because we're toggling via looped code, we need to dynamically generate the identifier. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr data-toggle=&amp;quot;collapse&amp;quot; class=&amp;quot;accordion-toggle&amp;quot; data-target=&amp;quot;#hid&amp;lt;%= row.question_id.to_s + vm.round.to_s %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;td class = 'cf' data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= row.question_text %&amp;gt;&amp;quot;&amp;gt; &amp;lt;div style='float: left'&amp;gt;&amp;lt;%= j.to_s %&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div style='float: right'&amp;gt; &amp;amp;#&amp;lt;%= type_and_max(row) %&amp;gt;;&amp;lt;/div&amp;gt;  &amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
              &amp;lt;!-- actual cells with scores and colored background. --&amp;gt;&lt;br /&gt;
              &amp;lt;% row.score_row.each do |score| %&amp;gt;&lt;br /&gt;
                  &amp;lt;% score_comment = score.comment.nil? ? '' : score.comment %&amp;gt; &amp;lt;!-- changing nil to null string to avoid Null Pointer Exception --&amp;gt;&lt;br /&gt;
                  &amp;lt;td class=&amp;quot;&amp;lt;%= score.color_code %&amp;gt;&amp;quot; align=&amp;quot;center&amp;quot; data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= strip_tags(score.comment).html_safe%&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;&amp;lt;%=  underlined?(score) %&amp;gt;&amp;quot;&amp;gt;&amp;lt;%= score.score_value.to_s %&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
                  &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_rows.each do |row| %&amp;gt;&lt;br /&gt;
            &amp;lt;% target_id = &amp;quot;hid__#{row.question_id}__#{vm.round}&amp;quot; %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
              &amp;lt;%# Since we render different heatgrids with the same questions for each&lt;br /&gt;
              teammember, we need to distinguish the ID, based on the user for whom,&lt;br /&gt;
              the reviews have been created. %&amp;gt;&lt;br /&gt;
              &amp;lt;% target_id += &amp;quot;__#{vm.reviewee_id}&amp;quot; %&amp;gt;&lt;br /&gt;
            &amp;lt;% end%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;!-- notice the data-target. because we're toggling via looped code, we need to dynamically generate the identifier. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr data-toggle=&amp;quot;collapse&amp;quot; class=&amp;quot;accordion-toggle&amp;quot; data-target=&amp;quot;&amp;lt;%= &amp;quot;#&amp;quot; + target_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;td class = 'cf' data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= row.question_text %&amp;gt;&amp;quot;&amp;gt; &amp;lt;div style='float: left'&amp;gt;&amp;lt;%= j.to_s %&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div style='float: right'&amp;gt; &amp;amp;#&amp;lt;%= type_and_max(row) %&amp;gt;;&amp;lt;/div&amp;gt;  &amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
              &amp;lt;!-- actual cells with scores and colored background. --&amp;gt;&lt;br /&gt;
              &amp;lt;% row.score_row.each do |score| %&amp;gt;&lt;br /&gt;
                  &amp;lt;% score_comment = score.comment.nil? ? '' : score.comment %&amp;gt;&lt;br /&gt;
                  &amp;lt;!-- changing nil to null string to avoid Null Pointer Exception --&amp;gt;&lt;br /&gt;
                  &amp;lt;td class=&amp;quot;&amp;lt;%= score.color_code %&amp;gt;&amp;quot; align=&amp;quot;center&amp;quot; data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= strip_tags(score.comment).html_safe%&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;&amp;lt;%=  underlined?(score) %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                      &amp;lt;%= score.score_value.to_s %&amp;gt;&lt;br /&gt;
                    &amp;lt;/span&amp;gt;&lt;br /&gt;
                  &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.6 '''Removed the following code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 &amp;lt;td  class = 'cf' align=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;%= row.countofcomments.to_s %&amp;gt;&lt;br /&gt;
              &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.7 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!--loop that creates the collapsed-by-default row, which lists all comments. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr class=&amp;quot;tablesorter-childRow&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;td colspan=&amp;quot;&amp;lt;%= (i+1).to_s %&amp;gt;&amp;quot; class=&amp;quot;hiddenRow&amp;quot; &amp;gt;&amp;lt;div id=&amp;quot;hid&amp;lt;%= row.question_id.to_s + vm.round.to_s %&amp;gt;&amp;quot; class=&amp;quot;accordion-body collapse&amp;quot; style=&amp;quot;margin-left:10px;&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;div style=&amp;quot;padding-top: 10px; padding-bottom: 10px;&amp;quot;&amp;gt;&amp;lt;%=  sanitize row.question_text %&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;div&amp;gt;&lt;br /&gt;
                  &amp;lt;table class=&amp;quot;table tbl_questlist&amp;quot;&amp;gt;&lt;br /&gt;
@@ -181,7 +233,17 @@&lt;br /&gt;
                    &amp;lt;/thead&amp;gt;&lt;br /&gt;
                    &amp;lt;% for index in 0 .. row.score_row.length - 1 %&amp;gt;&lt;br /&gt;
                        &amp;lt;tr&amp;gt;&lt;br /&gt;
                          &amp;lt;td&amp;gt;Review &amp;lt;%=index + 1%&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!--loop that creates the collapsed-by-default row, which lists all comments. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr class=&amp;quot;tablesorter-childRow&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;td colspan=&amp;quot;&amp;lt;%= (i+1).to_s %&amp;gt;&amp;quot; class=&amp;quot;hiddenRow&amp;quot; &amp;gt;&amp;lt;div id=&amp;quot;&amp;lt;%= target_id %&amp;gt;&amp;quot; class=&amp;quot;accordion-body collapse&amp;quot; style=&amp;quot;margin-left:10px;&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;div style=&amp;quot;padding-top: 10px; padding-bottom: 10px;&amp;quot;&amp;gt;&amp;lt;%=  sanitize row.question_text %&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;div&amp;gt;&lt;br /&gt;
                  &amp;lt;table class=&amp;quot;table tbl_questlist&amp;quot;&amp;gt;&lt;br /&gt;
@@ -181,7 +233,17 @@&lt;br /&gt;
                    &amp;lt;/thead&amp;gt;&lt;br /&gt;
                    &amp;lt;% for index in 0 .. row.score_row.length - 1 %&amp;gt;&lt;br /&gt;
                        &amp;lt;tr&amp;gt;&lt;br /&gt;
                          &amp;lt;% if @current_role_name.eql?'Student' or vm.questionnaire_type != &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                            &amp;lt;%# Use Review {{index}} format for student view, and&lt;br /&gt;
                            when questionnaire_type is not teammatereview %&amp;gt;&lt;br /&gt;
                            &amp;lt;td&amp;gt;Review &amp;lt;%=index + 1%&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
                          &amp;lt;% else %&amp;gt;&lt;br /&gt;
                            &amp;lt;td&amp;gt;&lt;br /&gt;
                              &amp;lt;% reviewer_id = row.score_row[index].reviewer_id %&amp;gt;&lt;br /&gt;
                              &amp;lt;% fullname = Participant.find_by(id: reviewer_id).fullname(session[:ip]) %&amp;gt;&lt;br /&gt;
                              Review by &amp;lt;%= fullname %&amp;gt;&lt;br /&gt;
                            &amp;lt;/td&amp;gt;&lt;br /&gt;
                          &amp;lt;% end%&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====G. In spec/controllers/grades_controller_spec.rb:====&lt;br /&gt;
&lt;br /&gt;
'''G.1 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
before(:each) do&lt;br /&gt;
  allow(AssignmentParticipant).to receive(:find).with('1').and_return(participant)&lt;br /&gt;
  allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
  stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
@@ -91,29 +90,106 @@&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
before(:each) do&lt;br /&gt;
  allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
  stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
@@ -91,29 +90,106 @@&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''G.2 '''Remove xdescribe '#view_team' and change describe '#view_team' as follows.&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#view_team' do&lt;br /&gt;
render_views&lt;br /&gt;
context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
  it 'renders grades#view_team page' do&lt;br /&gt;
    allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
    allow(AssignmentQuestionnaire).to receive(:find_by).with(assignment_id: 1, questionnaire_id: 1).and_return(assignment_questionnaire)&lt;br /&gt;
    allow(AssignmentQuestionnaire).to receive(:where).with(any_args).and_return([assignment_questionnaire])&lt;br /&gt;
    allow(assignment).to receive(:late_policy_id).and_return(false)&lt;br /&gt;
    allow(assignment).to receive(:calculate_penalty).and_return(false)&lt;br /&gt;
    allow(assignment).to receive(:compute_total_score).with(any_args).and_return(100)&lt;br /&gt;
    allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
    allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
    params = {id: 1}&lt;br /&gt;
    allow(TaMapping).to receive(:exists?).with(ta_id: 1, course_id: 1).and_return(true)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#view_team' do&lt;br /&gt;
render_views&lt;br /&gt;
&lt;br /&gt;
# All stubs and factories are instantiated within this scope so as to not &lt;br /&gt;
# clash with other broken test.&lt;br /&gt;
# The names of the factories created for testing view_team&lt;br /&gt;
# have `_vt` suffix ```where necessary``` to differentiate them from &lt;br /&gt;
# the above declared factories&lt;br /&gt;
&lt;br /&gt;
let(:student1_vt) { create(:student, name: &amp;quot;barry&amp;quot;, id: 12) }&lt;br /&gt;
let(:student2_vt) { create(:student, name: &amp;quot;iris&amp;quot;, id: 13) }&lt;br /&gt;
&lt;br /&gt;
let(:tm_questionnaire) {&lt;br /&gt;
  build(&lt;br /&gt;
    :teammate_review_questionnaire,&lt;br /&gt;
    id: 12,&lt;br /&gt;
    questions: [question],&lt;br /&gt;
    max_question_score: 5&lt;br /&gt;
  )&lt;br /&gt;
}&lt;br /&gt;
let(:assignment_vt) {&lt;br /&gt;
  create(:assignment, id: 6, max_team_size: 2,&lt;br /&gt;
  questionnaires: [tm_questionnaire])&lt;br /&gt;
}&lt;br /&gt;
let(:assignment_questionnaire_vt) {&lt;br /&gt;
  create(:tm_assignment_questionnaire, id: 12, used_in_round: nil,&lt;br /&gt;
  assignment: assignment_vt, questionnaire: tm_questionnaire) }&lt;br /&gt;
let(:team_vt) { create(:assignment_team, id: 12,&lt;br /&gt;
assignment: assignment_vt) }&lt;br /&gt;
let(:participant_vt) { create(:participant, id: 12,&lt;br /&gt;
  assignment: assignment_vt, user_id: student1_vt.id) }&lt;br /&gt;
let(:participant2_vt) { create(:participant, id: 13,&lt;br /&gt;
  assignment: assignment_vt, user_id: student2_vt.id) }&lt;br /&gt;
&lt;br /&gt;
before(:each) do&lt;br /&gt;
  # Need to stub this method so the factory instance with&lt;br /&gt;
  # the stubbed :team method is returned by :find&lt;br /&gt;
  # instead of a separate instance with the same data&lt;br /&gt;
  allow(AssignmentParticipant)&lt;br /&gt;
    .to receive(:find)&lt;br /&gt;
    .with(participant_vt.id.to_s)&lt;br /&gt;
    .and_return(participant_vt)&lt;br /&gt;
  allow(participant_vt).to receive(:team).and_return(team_vt)&lt;br /&gt;
  allow(team_vt).to receive(:participants).and_return([participant_vt, participant2_vt])&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:find_by)&lt;br /&gt;
    .with(assignment_id: assignment_vt.id, questionnaire_id: tm_questionnaire.id)&lt;br /&gt;
    .and_return(assignment_questionnaire_vt)&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:find_by)&lt;br /&gt;
    .with(assignment_id: assignment.id, questionnaire_id: review_questionnaire.id)&lt;br /&gt;
    .and_return(assignment_questionnaire_vt)&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:where)&lt;br /&gt;
    .with(any_args)&lt;br /&gt;
    .and_return([assignment_questionnaire_vt])&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:late_policy_id)&lt;br /&gt;
    .and_return(false)&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:calculate_penalty)&lt;br /&gt;
    .and_return(false)&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:compute_total_score)&lt;br /&gt;
    .with(any_args)&lt;br /&gt;
    .and_return(100)&lt;br /&gt;
  allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
  allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
 it 'renders grades#view_team page' do&lt;br /&gt;
  params = {id: participant_vt.id}&lt;br /&gt;
  get :view_team, params&lt;br /&gt;
  expect(response).to render_template(:view_team)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is opened by student' do&lt;br /&gt;
  it 'dropdown is not rendered' do&lt;br /&gt;
    session = { user: student1_vt }&lt;br /&gt;
    params = {id: participant_vt.id}&lt;br /&gt;
    stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
    get :view_team, params&lt;br /&gt;
    expect(response.body).to_not have_selector('select')&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is opened by instructor' do&lt;br /&gt;
  it 'dropdown is rendered' do&lt;br /&gt;
    session = { user: instructor }&lt;br /&gt;
    params = {id: participant_vt.id}&lt;br /&gt;
    get :view_team, params&lt;br /&gt;
    expect(response.body).to have_selector('select')&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
  it 'renders grades#view_team page' do&lt;br /&gt;
    params = { id: participant_vt.id }&lt;br /&gt;
    allow(TaMapping).to receive(:exists?).with(ta_id: participant_vt.user_id, course_id: 1).and_return(true)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====H. In spec/factories/factories.rb:====&lt;br /&gt;
&lt;br /&gt;
'''H.1 '''Add the following factory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
factory :teammate_review_questionnaire, class: TeammateReviewQuestionnaire do&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''H.2 '''Add another factory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
factory :tm_assignment_questionnaire, class: AssignmentQuestionnaire do&lt;br /&gt;
  user_id 1&lt;br /&gt;
  questionnaire { association(:teammate_review_questionnaire) }&lt;br /&gt;
  questionnaire_weight 100&lt;br /&gt;
  used_in_round nil&lt;br /&gt;
  topic_id nil&lt;br /&gt;
  dropdown 1&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Summary of file changes ===&lt;br /&gt;
&lt;br /&gt;
The following files are modified:&lt;br /&gt;
&lt;br /&gt;
1. app/controllers/grades_controller.rb - Controller file which changed how the view model is populated&lt;br /&gt;
&lt;br /&gt;
2. app/views/grades/view_team.html.erb - View file, which  conditionally rendered the teammate name, for a teammate review heatgrid&lt;br /&gt;
&lt;br /&gt;
3. spec/controllers/grades_controller_spec.rb - For tests verifying the proposed changes&lt;br /&gt;
&lt;br /&gt;
4. app/models/vm_question_response.rb - To modify the view-model so it can tell us the name of the person being reviewed for the current heatgrid&lt;br /&gt;
&lt;br /&gt;
5. app/models/vm_question_response_score_cell.rb - &lt;br /&gt;
&lt;br /&gt;
6. app/assets/stylesheets/grades.scss - &lt;br /&gt;
&lt;br /&gt;
7. app/views/grades/_add_icon_to_name.html.erb - &lt;br /&gt;
&lt;br /&gt;
8. spec/factories/factories.rb - &lt;br /&gt;
&lt;br /&gt;
== Design Patterns ==&lt;br /&gt;
&lt;br /&gt;
Existing code does not use any design patterns, apart from if-else. It uses if-else conditional statements to check what type of questionnaire is present in the viewmodel `VmQuestionResponse`, and based on that, it renders the appropriate content.&lt;br /&gt;
&lt;br /&gt;
We decided to continue with this approach since to change the present coding style, there were required many changes (refactoring) to many files which were out of the scope of the present project. To complete the project in the assigned time, we followed the if-else approach.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== User Stories ==&lt;br /&gt;
&lt;br /&gt;
1. As an instructor, I can view what reviews one teammate has given to other teammates.&lt;br /&gt;
&lt;br /&gt;
2. As a student, I can view what reviews my teammates have given to me.&lt;br /&gt;
&lt;br /&gt;
3. As an instructor, I can select if a student's reviews are anonymously shown to their teammates.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
'''CURRENT STATUS'''&lt;br /&gt;
&lt;br /&gt;
1. Presently, the tests only cover if the view_team is page is rendered when it is asked for.&lt;br /&gt;
&lt;br /&gt;
[[File:current_testing_status.png|border|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''OUR PROPOSAL'''&lt;br /&gt;
&lt;br /&gt;
- When show_team is set as false by the professor, the student should not be able to see his scores.&lt;br /&gt;
&lt;br /&gt;
- When show_team is set as true by the professor, the student should be able to see his.&lt;br /&gt;
&lt;br /&gt;
- An instructor can select which student's scores he/she wants to see. If no student's name is selected then the professor can see the scores of all the students.&lt;br /&gt;
- The instructor can decide whether to show the names of the reviewer to the reviewer in teammate reviews, by selecting a checkbox for the same.&lt;br /&gt;
[[File:Untitled Diagram.drawio.png|border|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;https://expertiza.ncsu.edu/&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Agarg25</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Ss12a.png&amp;diff=141731</id>
		<title>File:Ss12a.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Ss12a.png&amp;diff=141731"/>
		<updated>2021-11-28T17:09:57Z</updated>

		<summary type="html">&lt;p&gt;Agarg25: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Agarg25</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141721</id>
		<title>CSC/ECE 517 Fall 2021 - E2165. Fix teammate-review view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141721"/>
		<updated>2021-11-28T05:58:22Z</updated>

		<summary type="html">&lt;p&gt;Agarg25: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Introduction ==&lt;br /&gt;
&lt;br /&gt;
Dr. Edward Gehringer (instructor), Parimal Mehta (mentor)&lt;br /&gt;
&lt;br /&gt;
1. Anjali Garg (unity ID : agarg25)&lt;br /&gt;
&lt;br /&gt;
2. Arvasu Chikara (unity ID: achikar2)&lt;br /&gt;
&lt;br /&gt;
3. Lalit Bangad (unity ID: llbangad)&lt;br /&gt;
&lt;br /&gt;
4. Vinay Deshmukh (unity ID: vdeshmu)&lt;br /&gt;
&lt;br /&gt;
== Problems to be addressed ==&lt;br /&gt;
&lt;br /&gt;
After a project is submitted and reviewed, both the team members (students) and instructors should be able to view the teammate reviews. Students should be able to view the reviews by going to a particular assignment's -&amp;gt; your scores, at the bottom of the page. An instructor can view the teammate reviews by going to assignments -&amp;gt; assignment -&amp;gt; particular team's submission -&amp;gt; view submission -&amp;gt; assign grades -&amp;gt; view scores. &lt;br /&gt;
&lt;br /&gt;
In the case of the instructor, a single heat grid is shown whereas in the case of a team member, we cant view the scores. In the heat grid, it is not clear if the scores visible are for the reviews that the student has *written* for their teammates or the scores that the student has *received* from their teammates. Additionally, for instructors can choose from a list of the students on the team, but they have no way to tell whether the heat grid shows the reviews done *by* that student or done *for* that student.&lt;br /&gt;
&lt;br /&gt;
== Methodology Overview ==&lt;br /&gt;
&lt;br /&gt;
We have divided our work in the following tasks to address the above problems:&lt;br /&gt;
&lt;br /&gt;
1. Distinguish reviews done for a student by rendering separates heatgrids for each student&lt;br /&gt;
&lt;br /&gt;
2. For instructors, the table will have sections based on the students&lt;br /&gt;
&lt;br /&gt;
3. Include a checkbox on the edit assignment page that enables/disables visibility of heat grid to students&lt;br /&gt;
&lt;br /&gt;
4. Fix the average column for a table (which breaks for some reviews)&lt;br /&gt;
&lt;br /&gt;
5. Show a composite score derived from all reviews.  Make this code generalized, so other kinds of heat grid views could use it.&lt;br /&gt;
&lt;br /&gt;
6. Changes should work even in an anonymized view&lt;br /&gt;
&lt;br /&gt;
== Motivations ==&lt;br /&gt;
&lt;br /&gt;
1. Enable users to clearly tell which reviews are done by them, and which reviews are done for them.&lt;br /&gt;
&lt;br /&gt;
2. Code should be generic so it can be used for different types of heat grids as well.&lt;br /&gt;
&lt;br /&gt;
== Control Flow to access the concerned screens ==&lt;br /&gt;
'''1. For instructor (Log in as an instructor):-'''&lt;br /&gt;
&lt;br /&gt;
Screen after logging in by the instructor&lt;br /&gt;
[[File:ss1.png |border|1000px|center]]&lt;br /&gt;
Got to assignments on the Manage menu &lt;br /&gt;
[[File:ss2.png |border|1000px|center]]&lt;br /&gt;
Go to assignments&lt;br /&gt;
[[File:ss3.png |border|1000px|center]]&lt;br /&gt;
Go to submissions for any assignment&lt;br /&gt;
[[File:ss4a.png |border|1000px|center]]&lt;br /&gt;
Go to Assign Grade&lt;br /&gt;
[[File:ss5a.png |border|1000px|center]]&lt;br /&gt;
You will land on the page where the changes are made and can be reviewed&lt;br /&gt;
[[File:ss7a.png |border|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
'''2. Student:- (Logged in as an instructor)'''&lt;br /&gt;
&lt;br /&gt;
After landing on the assignments page, select any student from an assignment as shown below&lt;br /&gt;
[[File:ss6a.png |border|1000px|center]]&lt;br /&gt;
Go to/Select any assignment&lt;br /&gt;
[[File:ss9a.png |border|1000px|center]]&lt;br /&gt;
Go to your scores&lt;br /&gt;
[[File:ss10a.png |border|1000px|center]]&lt;br /&gt;
You will land on the page where the changes are made and can be reviewed&lt;br /&gt;
[[File:ss11a.png |border|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
== Old Status of the application ==&lt;br /&gt;
&lt;br /&gt;
'''1. Instructor's view of teammate review''': This is the current screen given to the instructor. Here we see that the instructor can not determine who has given which review to which student in a team.&lt;br /&gt;
&lt;br /&gt;
[[File:Instructor-view-1.png|border| 700px |center|alt=The proposed expanded student display.|The proposed expanded student display.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2. Student's view of teammate review''': Currently, a student is not able to see what grades were given by their teammates. We need to implement that functionality so that the student is able to view those grades.&lt;br /&gt;
&lt;br /&gt;
[[File:Student-view-2.png|border| 700px |center|alt=The current instructor view.|The current review display for instructors.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Error in existing UI for student''': In the existing UI for a student, the highlighted block should not be rendered. This part of the screen is meant for the instructors/TAs. &lt;br /&gt;
&lt;br /&gt;
[[File:Wrong render for student.png|border|700px|center|alt=Existing UI for student|Existing UI for student.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Proposed changes ==&lt;br /&gt;
&lt;br /&gt;
''' 1) Proposed UI for instructor ''': The instructor is able to see the score for all teammates. In the existing code, only one teammate's scores are being shown. But, we are planning to change the way the (VmQuestionResponse array is populated)[https://github.com/expertiza/expertiza/blob/master/app/controllers/grades_controller.rb#L114], so that the scores for all teammates are appended to it so it correctly shows what should have already been shown in this screen for the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Proposed_screen.png|border|700px|center|alt=Proposed UI for instructor|Proposed UI for instructor.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: When a student visits this screen, they will only be shown the reviews received by them, assuming the instructor has allowed visibility of teammate reviews to students.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' 2) Show teammate review to student UI ''': The existing code doesn't render a student's teammate review scores at all. We are planning to render the scores to a student (as shown below) when they visit this screen. However, the visibility of this screen is contingent on whether the instructor has allowed visibility of the teammate review screen to students. If the instructor has disabled this feature, then the heatgrid will not be displayed at all.&lt;br /&gt;
&lt;br /&gt;
[[File:UI_for_student.png|border|700px|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Models used / Explanation of fixes ==&lt;br /&gt;
&lt;br /&gt;
The below diagram illustrates the proposed code change for showing all team members with the teammate review data to an instructor. The existing code only iterated on the `Participant` whose ID is present in the URL of the page. To fix this, we will iterate over all teammates of the given participant so that all teammate reviews for all team members are shown to the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Logic e2165.png|border|center|alt=Flow diagram of proposed changes for showing team review data to instructor]]&lt;br /&gt;
&lt;br /&gt;
===Changes made to the code are shown below. Every change is shown and explained separately===&lt;br /&gt;
&lt;br /&gt;
====A. Added the following to app/assets/stylesheets/grades.scss:====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    .teammate_table.hidden {&lt;br /&gt;
      display: none;&lt;br /&gt;
      }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====B. In app/controllers/grades_controller.rb: ====&lt;br /&gt;
&lt;br /&gt;
'''B.1:'''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
  @vmlist &amp;lt;&amp;lt; populate_view_model(questionnaire)&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
     if questionnaire.type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
        # as teammate review will be different for each participant&lt;br /&gt;
        # we need to create a separate table for each teammate&lt;br /&gt;
        @participant.team.participants.each do |team_participant|&lt;br /&gt;
          @vmlist &amp;lt;&amp;lt; populate_view_model(team_participant, questionnaire, @team)&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        # only one participant needs iterating, as apart from teammatereview&lt;br /&gt;
        # all other reviews are at &amp;quot;team&amp;quot; level&lt;br /&gt;
        @vmlist &amp;lt;&amp;lt; populate_view_model(@participant, questionnaire, @team)&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
'''B.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
    def populate_view_model(questionnaire)&lt;br /&gt;
      vm = VmQuestionResponse.new(questionnaire, @assignment, @round)&lt;br /&gt;
      vmquestions = questionnaire.questions&lt;br /&gt;
      vm.add_questions(vmquestions)&lt;br /&gt;
      vm.add_team_members(@team)&lt;br /&gt;
      vm.add_reviews(@participant, @team, @assignment.vary_by_round)&lt;br /&gt;
      vm.number_of_comments_greater_than_10_words&lt;br /&gt;
      vm &lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
    def populate_view_model(participant, questionnaire, team)&lt;br /&gt;
      vm = VmQuestionResponse.new(questionnaire, @assignment, @round)&lt;br /&gt;
      vmquestions = questionnaire.questions&lt;br /&gt;
      vm.add_questions(vmquestions)&lt;br /&gt;
      vm.add_team_members(team)&lt;br /&gt;
      vm.add_reviews(participant, team, @assignment.vary_by_round)&lt;br /&gt;
      vm.number_of_comments_greater_than_10_words&lt;br /&gt;
      vm&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====C. In app/models/vm_question_response.rb:====&lt;br /&gt;
&lt;br /&gt;
'''C.1: '''Added the reviewee_id method&lt;br /&gt;
&lt;br /&gt;
    def reviewee_id&lt;br /&gt;
      @participant_who_is_reviewee.user_id&lt;br /&gt;
    end &lt;br /&gt;
&lt;br /&gt;
'''C.2: '''Added the reviewee_name method&lt;br /&gt;
&lt;br /&gt;
    def reviewee_name(ip_address = nil)&lt;br /&gt;
      part = @participant_who_is_reviewee&lt;br /&gt;
      User.find_by(id: part.user_id).fullname(ip_address)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''C.3: '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
    elsif @questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
      reviews = participant.teammate_reviews&lt;br /&gt;
      reviews.each do |review|&lt;br /&gt;
        review_mapping = TeammateReviewResponseMap.find_by(id: review.map_id)&lt;br /&gt;
        participant = Participant.find(review_mapping.reviewer_id)&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
    elsif @questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
      reviews = participant.teammate_reviews&lt;br /&gt;
      @participant_who_is_reviewee = participant&lt;br /&gt;
      reviews.each do |review|&lt;br /&gt;
        review_mapping = TeammateReviewResponseMap.find_by(id: review.map_id)&lt;br /&gt;
        participant = Participant.find(review_mapping.reviewer_id)&lt;br /&gt;
&lt;br /&gt;
'''C.4: '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
    row.score_row.push(VmQuestionResponseScoreCell.new(answer.answer, color_code, answer.comments, vm_tag_prompts))&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
    &lt;br /&gt;
    row.score_row.push(VmQuestionResponseScoreCell.new(answer.answer, color_code, answer.comments, vm_tag_prompts, answer.response_id))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====D. In app/models/vm_question_response_score_cell.rb:====&lt;br /&gt;
&lt;br /&gt;
'''D.1: '''In the method initialize of class VmQuestionResponseScoreCell&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
    def initialize(score_value, color_code, comments, vmprompts = nil)&lt;br /&gt;
      @score_value = score_value&lt;br /&gt;
      @color_code = color_code&lt;br /&gt;
      @comment = comments&lt;br /&gt;
      @vm_prompts = vmprompts&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&lt;br /&gt;
    def initialize(score_value, color_code, comments, vmprompts = nil, response_id)&lt;br /&gt;
      @score_value = score_value&lt;br /&gt;
      @color_code = color_code&lt;br /&gt;
      @comment = comments&lt;br /&gt;
      @vm_prompts = vmprompts&lt;br /&gt;
      @response_id = response_id&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''D.2: '''Added a method reviewer_id to the class VmQuestionResponseScoreCell&lt;br /&gt;
&lt;br /&gt;
    def reviewer_id&lt;br /&gt;
      resp = Response.find(@response_id)&lt;br /&gt;
      map = ResponseMap.find(resp.map_id)&lt;br /&gt;
      map.reviewer_id&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====E. In app/views/grades/_add_icon_to_name.html.erb:====&lt;br /&gt;
&lt;br /&gt;
'''E.1 '''Added the following code to the file:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;%# Determine the content of the reviewed by text %&amp;gt;&lt;br /&gt;
    &amp;lt;% review_text = &amp;quot;&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% if @current_role_name.eql?'Student' or questionnaire_type != &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
      &amp;lt;%# Use Review {{index}} format for student view, and when questionnaire_type is not teammatereview %&amp;gt;&lt;br /&gt;
      &amp;lt;% review_text = &amp;quot;Review #{i + 1}&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;% resp = Response.find(review.id) %&amp;gt;&lt;br /&gt;
      &amp;lt;% map = ResponseMap.find(resp.map_id) %&amp;gt;&lt;br /&gt;
      &amp;lt;% reviewer_id = map.reviewer_id %&amp;gt;&lt;br /&gt;
      &amp;lt;% fullname = Participant.find_by(id: reviewer_id).fullname(session[:ip]) %&amp;gt;&lt;br /&gt;
      &amp;lt;% review_text = &amp;quot;Review by #{fullname}&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% end%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''E.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;% if review.done_by_staff_participant? %&amp;gt;&lt;br /&gt;
      &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt; &amp;lt;img data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Icon indicates this review was done by course staff&amp;quot; class=&amp;quot;img_icon&amp;quot; src=&amp;quot;/assets/staff.png&amp;quot;&amp;gt; &amp;lt;a target=&amp;quot;_blank&amp;quot; href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Click to see details&amp;quot;&amp;gt;&amp;lt;%= &amp;quot;Review &amp;quot; + i.to_s  %&amp;gt;&amp;lt;/a&amp;gt; &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt; &amp;lt;a target=&amp;quot;_blank&amp;quot; href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Click to see details&amp;quot;&amp;gt;&amp;lt;%= &amp;quot;Review &amp;quot; + i.to_s %&amp;gt;&amp;lt;/a&amp;gt;  &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;% if review.done_by_staff_participant? %&amp;gt;&lt;br /&gt;
    &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;img&lt;br /&gt;
      data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
      data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
      title=&amp;quot;Icon indicates this review was done by course staff&amp;quot; class=&amp;quot;img_icon&amp;quot;&lt;br /&gt;
      src=&amp;quot;/assets/staff.png&amp;quot;&lt;br /&gt;
      &amp;gt;&lt;br /&gt;
    &amp;lt;a&lt;br /&gt;
      target=&amp;quot;_blank&amp;quot;&lt;br /&gt;
      href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;&lt;br /&gt;
      data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
      data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
      title=&amp;quot;Click to see details&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;%= review_text %&amp;gt;&lt;br /&gt;
    &amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
    &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;a&lt;br /&gt;
            target=&amp;quot;_blank&amp;quot; &lt;br /&gt;
            href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  &lt;br /&gt;
            data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
            data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
            title=&amp;quot;Click to see details&amp;quot;&lt;br /&gt;
        &amp;gt;&lt;br /&gt;
        &amp;lt;%= review_text %&amp;gt;&lt;br /&gt;
        &amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====F.In app/views/grades/view_team.html.erb:====&lt;br /&gt;
&lt;br /&gt;
'''F.1: '''Added function teammateSelectOnChange:&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  function teammateSelectOnChange(selectNode) {&lt;br /&gt;
      const revieweeIdToShow= selectNode.value;&lt;br /&gt;
      const tableSelector = &amp;quot;.teammate_table&amp;quot;;&lt;br /&gt;
      if(revieweeIdToShow == &amp;quot;all&amp;quot;) {&lt;br /&gt;
        document.querySelectorAll(tableSelector).forEach((tableNode) =&amp;gt; {&lt;br /&gt;
          tableNode.classList.remove(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
        });&lt;br /&gt;
        return;&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
  document.querySelectorAll(tableSelector).forEach((tableNode) =&amp;gt; {&lt;br /&gt;
    const tableRevieweeId = tableNode.getAttribute('data-reviewee_id');&lt;br /&gt;
    if(tableRevieweeId == revieweeIdToShow) {&lt;br /&gt;
      tableNode.classList.remove(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
    } else {&lt;br /&gt;
      tableNode.classList.add(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    });&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;% @vmlist.each do |vm| %&amp;gt;&lt;br /&gt;
        &amp;lt;% if (vm.questionnaire_display_type == &amp;quot;Metareview&amp;quot; or vm.questionnaire_display_type == &amp;quot;Author Feedback&amp;quot; or vm.questionnaire_display_type == &amp;quot;Teammate Review&amp;quot;) and @current_role_name.eql?'Student' %&amp;gt;&lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
        &amp;lt;% if vm.list_of_reviewers.length &amp;gt; 0 %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
​      &amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  @@ -87,6 +131,8 @@&lt;br /&gt;
              &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
                &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                    (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
        &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;%# This boolean is used to render a dropdown just before the first teammate review heat grid %&amp;gt;&lt;br /&gt;
&amp;lt;% first_teammate_review_appeared = false %&amp;gt;&lt;br /&gt;
&amp;lt;% @vmlist.each do |vm| %&amp;gt;&lt;br /&gt;
    &amp;lt;% if not @current_role_name.eql?'Student' and not first_teammate_review_appeared and vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        &amp;lt;select onchange=&amp;quot;teammateSelectOnChange(this)&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;all&amp;quot;&amp;gt;All&amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;% @vmlist.select { |tm_vm| tm_vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; }.each do |tm_vm| %&amp;gt;&lt;br /&gt;
            &amp;lt;option value=&amp;quot;&amp;lt;%= tm_vm.reviewee_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;%= tm_vm.reviewee_name(session[:ip]) %&amp;gt;&lt;br /&gt;
            &amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
        &amp;lt;/select&amp;gt;&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;% first_teammate_review_appeared = true %&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;% if (vm.questionnaire_display_type == &amp;quot;Metareview&amp;quot; or vm.questionnaire_display_type == &amp;quot;Author Feedback&amp;quot;) and @current_role_name.eql?'Student' %&amp;gt;&lt;br /&gt;
    &amp;lt;% elsif (vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; and @current_role_name.eql?'Student' and !@assignment.show_teammate_reviews)%&amp;gt;&lt;br /&gt;
    &amp;lt;% elsif (vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; and @current_role_name.eql?'Student' and @assignment.show_teammate_reviews and current_user.id != vm.reviewee_id )%&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
        &amp;lt;% if vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
          &amp;lt;div class=&amp;quot;teammate_table&amp;quot; data-reviewee_id=&amp;quot;&amp;lt;%= vm.reviewee_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
        &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.3  '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
@@ -87,6 +131,8 @@&lt;br /&gt;
          &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
            &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
@@ -87,6 +131,8 @@&lt;br /&gt;
          &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
            &amp;lt;% elsif vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (For: &amp;lt;%= vm.reviewee_name(session[:ip]) %&amp;gt;)&lt;br /&gt;
            &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.4 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_reviews.each do |review| %&amp;gt;&lt;br /&gt;
              &amp;lt;!-- instructors (or higher level users) see reviewer name, students see anonymized string --&amp;gt;&lt;br /&gt;
              &amp;lt;% if (['Student'].include? @current_role_name) &amp;amp;&amp;amp; @assignment.is_anonymous%&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i} %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                  &amp;lt;% user_name = User.find(Participant.find(ResponseMap.find(Response.find(review.id).map_id).reviewer_id).user_id).fullname(session[:ip]).to_s %&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i} %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% i += 1 %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-true&amp;quot; align=&amp;quot;right&amp;quot; &amp;gt;&lt;br /&gt;
            Avg&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;span  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;A count of comments, for the respective question, which have word count &amp;gt; 10. The purpose of this metric is to represent how many comments for the question are of a substantial length to provide quality feedback.&amp;quot;&amp;gt;metric-1&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/thead&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_reviews.each do |review| %&amp;gt;&lt;br /&gt;
              &amp;lt;!-- instructors (or higher level users) see reviewer name, students see anonymized string --&amp;gt;&lt;br /&gt;
              &amp;lt;% if (['Student'].include? @current_role_name) &amp;amp;&amp;amp; @assignment.is_anonymous%&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i, questionnaire_type: vm.questionnaire_type } %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                &amp;lt;% user_name = User.find(Participant.find(ResponseMap.find(Response.find(review.id).map_id).reviewer_id).user_id).fullname(session[:ip]).to_s %&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i, questionnaire_type: vm.questionnaire_type } %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% i += 1 %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-true&amp;quot; align=&amp;quot;right&amp;quot; &amp;gt;&lt;br /&gt;
            Avg&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/thead&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.5 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_rows.each do |row| %&amp;gt;&lt;br /&gt;
            &amp;lt;!-- notice the data-target. because we're toggling via looped code, we need to dynamically generate the identifier. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr data-toggle=&amp;quot;collapse&amp;quot; class=&amp;quot;accordion-toggle&amp;quot; data-target=&amp;quot;#hid&amp;lt;%= row.question_id.to_s + vm.round.to_s %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;td class = 'cf' data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= row.question_text %&amp;gt;&amp;quot;&amp;gt; &amp;lt;div style='float: left'&amp;gt;&amp;lt;%= j.to_s %&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div style='float: right'&amp;gt; &amp;amp;#&amp;lt;%= type_and_max(row) %&amp;gt;;&amp;lt;/div&amp;gt;  &amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
              &amp;lt;!-- actual cells with scores and colored background. --&amp;gt;&lt;br /&gt;
              &amp;lt;% row.score_row.each do |score| %&amp;gt;&lt;br /&gt;
                  &amp;lt;% score_comment = score.comment.nil? ? '' : score.comment %&amp;gt; &amp;lt;!-- changing nil to null string to avoid Null Pointer Exception --&amp;gt;&lt;br /&gt;
                  &amp;lt;td class=&amp;quot;&amp;lt;%= score.color_code %&amp;gt;&amp;quot; align=&amp;quot;center&amp;quot; data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= strip_tags(score.comment).html_safe%&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;&amp;lt;%=  underlined?(score) %&amp;gt;&amp;quot;&amp;gt;&amp;lt;%= score.score_value.to_s %&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
                  &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_rows.each do |row| %&amp;gt;&lt;br /&gt;
            &amp;lt;% target_id = &amp;quot;hid__#{row.question_id}__#{vm.round}&amp;quot; %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
              &amp;lt;%# Since we render different heatgrids with the same questions for each&lt;br /&gt;
              teammember, we need to distinguish the ID, based on the user for whom,&lt;br /&gt;
              the reviews have been created. %&amp;gt;&lt;br /&gt;
              &amp;lt;% target_id += &amp;quot;__#{vm.reviewee_id}&amp;quot; %&amp;gt;&lt;br /&gt;
            &amp;lt;% end%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;!-- notice the data-target. because we're toggling via looped code, we need to dynamically generate the identifier. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr data-toggle=&amp;quot;collapse&amp;quot; class=&amp;quot;accordion-toggle&amp;quot; data-target=&amp;quot;&amp;lt;%= &amp;quot;#&amp;quot; + target_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;td class = 'cf' data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= row.question_text %&amp;gt;&amp;quot;&amp;gt; &amp;lt;div style='float: left'&amp;gt;&amp;lt;%= j.to_s %&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div style='float: right'&amp;gt; &amp;amp;#&amp;lt;%= type_and_max(row) %&amp;gt;;&amp;lt;/div&amp;gt;  &amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
              &amp;lt;!-- actual cells with scores and colored background. --&amp;gt;&lt;br /&gt;
              &amp;lt;% row.score_row.each do |score| %&amp;gt;&lt;br /&gt;
                  &amp;lt;% score_comment = score.comment.nil? ? '' : score.comment %&amp;gt;&lt;br /&gt;
                  &amp;lt;!-- changing nil to null string to avoid Null Pointer Exception --&amp;gt;&lt;br /&gt;
                  &amp;lt;td class=&amp;quot;&amp;lt;%= score.color_code %&amp;gt;&amp;quot; align=&amp;quot;center&amp;quot; data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= strip_tags(score.comment).html_safe%&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;&amp;lt;%=  underlined?(score) %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                      &amp;lt;%= score.score_value.to_s %&amp;gt;&lt;br /&gt;
                    &amp;lt;/span&amp;gt;&lt;br /&gt;
                  &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.6 '''Removed the following code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 &amp;lt;td  class = 'cf' align=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;%= row.countofcomments.to_s %&amp;gt;&lt;br /&gt;
              &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.7 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!--loop that creates the collapsed-by-default row, which lists all comments. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr class=&amp;quot;tablesorter-childRow&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;td colspan=&amp;quot;&amp;lt;%= (i+1).to_s %&amp;gt;&amp;quot; class=&amp;quot;hiddenRow&amp;quot; &amp;gt;&amp;lt;div id=&amp;quot;hid&amp;lt;%= row.question_id.to_s + vm.round.to_s %&amp;gt;&amp;quot; class=&amp;quot;accordion-body collapse&amp;quot; style=&amp;quot;margin-left:10px;&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;div style=&amp;quot;padding-top: 10px; padding-bottom: 10px;&amp;quot;&amp;gt;&amp;lt;%=  sanitize row.question_text %&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;div&amp;gt;&lt;br /&gt;
                  &amp;lt;table class=&amp;quot;table tbl_questlist&amp;quot;&amp;gt;&lt;br /&gt;
@@ -181,7 +233,17 @@&lt;br /&gt;
                    &amp;lt;/thead&amp;gt;&lt;br /&gt;
                    &amp;lt;% for index in 0 .. row.score_row.length - 1 %&amp;gt;&lt;br /&gt;
                        &amp;lt;tr&amp;gt;&lt;br /&gt;
                          &amp;lt;td&amp;gt;Review &amp;lt;%=index + 1%&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!--loop that creates the collapsed-by-default row, which lists all comments. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr class=&amp;quot;tablesorter-childRow&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;td colspan=&amp;quot;&amp;lt;%= (i+1).to_s %&amp;gt;&amp;quot; class=&amp;quot;hiddenRow&amp;quot; &amp;gt;&amp;lt;div id=&amp;quot;&amp;lt;%= target_id %&amp;gt;&amp;quot; class=&amp;quot;accordion-body collapse&amp;quot; style=&amp;quot;margin-left:10px;&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;div style=&amp;quot;padding-top: 10px; padding-bottom: 10px;&amp;quot;&amp;gt;&amp;lt;%=  sanitize row.question_text %&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;div&amp;gt;&lt;br /&gt;
                  &amp;lt;table class=&amp;quot;table tbl_questlist&amp;quot;&amp;gt;&lt;br /&gt;
@@ -181,7 +233,17 @@&lt;br /&gt;
                    &amp;lt;/thead&amp;gt;&lt;br /&gt;
                    &amp;lt;% for index in 0 .. row.score_row.length - 1 %&amp;gt;&lt;br /&gt;
                        &amp;lt;tr&amp;gt;&lt;br /&gt;
                          &amp;lt;% if @current_role_name.eql?'Student' or vm.questionnaire_type != &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                            &amp;lt;%# Use Review {{index}} format for student view, and&lt;br /&gt;
                            when questionnaire_type is not teammatereview %&amp;gt;&lt;br /&gt;
                            &amp;lt;td&amp;gt;Review &amp;lt;%=index + 1%&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
                          &amp;lt;% else %&amp;gt;&lt;br /&gt;
                            &amp;lt;td&amp;gt;&lt;br /&gt;
                              &amp;lt;% reviewer_id = row.score_row[index].reviewer_id %&amp;gt;&lt;br /&gt;
                              &amp;lt;% fullname = Participant.find_by(id: reviewer_id).fullname(session[:ip]) %&amp;gt;&lt;br /&gt;
                              Review by &amp;lt;%= fullname %&amp;gt;&lt;br /&gt;
                            &amp;lt;/td&amp;gt;&lt;br /&gt;
                          &amp;lt;% end%&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====G. In spec/controllers/grades_controller_spec.rb:====&lt;br /&gt;
&lt;br /&gt;
'''G.1 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
before(:each) do&lt;br /&gt;
  allow(AssignmentParticipant).to receive(:find).with('1').and_return(participant)&lt;br /&gt;
  allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
  stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
@@ -91,29 +90,106 @@&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
before(:each) do&lt;br /&gt;
  allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
  stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
@@ -91,29 +90,106 @@&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''G.2 '''Remove xdescribe '#view_team' and change describe '#view_team' as follows.&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#view_team' do&lt;br /&gt;
render_views&lt;br /&gt;
context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
  it 'renders grades#view_team page' do&lt;br /&gt;
    allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
    allow(AssignmentQuestionnaire).to receive(:find_by).with(assignment_id: 1, questionnaire_id: 1).and_return(assignment_questionnaire)&lt;br /&gt;
    allow(AssignmentQuestionnaire).to receive(:where).with(any_args).and_return([assignment_questionnaire])&lt;br /&gt;
    allow(assignment).to receive(:late_policy_id).and_return(false)&lt;br /&gt;
    allow(assignment).to receive(:calculate_penalty).and_return(false)&lt;br /&gt;
    allow(assignment).to receive(:compute_total_score).with(any_args).and_return(100)&lt;br /&gt;
    allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
    allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
    params = {id: 1}&lt;br /&gt;
    allow(TaMapping).to receive(:exists?).with(ta_id: 1, course_id: 1).and_return(true)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#view_team' do&lt;br /&gt;
render_views&lt;br /&gt;
&lt;br /&gt;
# All stubs and factories are instantiated within this scope so as to not &lt;br /&gt;
# clash with other broken test.&lt;br /&gt;
# The names of the factories created for testing view_team&lt;br /&gt;
# have `_vt` suffix ```where necessary``` to differentiate them from &lt;br /&gt;
# the above declared factories&lt;br /&gt;
&lt;br /&gt;
let(:student1_vt) { create(:student, name: &amp;quot;barry&amp;quot;, id: 12) }&lt;br /&gt;
let(:student2_vt) { create(:student, name: &amp;quot;iris&amp;quot;, id: 13) }&lt;br /&gt;
&lt;br /&gt;
let(:tm_questionnaire) {&lt;br /&gt;
  build(&lt;br /&gt;
    :teammate_review_questionnaire,&lt;br /&gt;
    id: 12,&lt;br /&gt;
    questions: [question],&lt;br /&gt;
    max_question_score: 5&lt;br /&gt;
  )&lt;br /&gt;
}&lt;br /&gt;
let(:assignment_vt) {&lt;br /&gt;
  create(:assignment, id: 6, max_team_size: 2,&lt;br /&gt;
  questionnaires: [tm_questionnaire])&lt;br /&gt;
}&lt;br /&gt;
let(:assignment_questionnaire_vt) {&lt;br /&gt;
  create(:tm_assignment_questionnaire, id: 12, used_in_round: nil,&lt;br /&gt;
  assignment: assignment_vt, questionnaire: tm_questionnaire) }&lt;br /&gt;
let(:team_vt) { create(:assignment_team, id: 12,&lt;br /&gt;
assignment: assignment_vt) }&lt;br /&gt;
let(:participant_vt) { create(:participant, id: 12,&lt;br /&gt;
  assignment: assignment_vt, user_id: student1_vt.id) }&lt;br /&gt;
let(:participant2_vt) { create(:participant, id: 13,&lt;br /&gt;
  assignment: assignment_vt, user_id: student2_vt.id) }&lt;br /&gt;
&lt;br /&gt;
before(:each) do&lt;br /&gt;
  # Need to stub this method so the factory instance with&lt;br /&gt;
  # the stubbed :team method is returned by :find&lt;br /&gt;
  # instead of a separate instance with the same data&lt;br /&gt;
  allow(AssignmentParticipant)&lt;br /&gt;
    .to receive(:find)&lt;br /&gt;
    .with(participant_vt.id.to_s)&lt;br /&gt;
    .and_return(participant_vt)&lt;br /&gt;
  allow(participant_vt).to receive(:team).and_return(team_vt)&lt;br /&gt;
  allow(team_vt).to receive(:participants).and_return([participant_vt, participant2_vt])&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:find_by)&lt;br /&gt;
    .with(assignment_id: assignment_vt.id, questionnaire_id: tm_questionnaire.id)&lt;br /&gt;
    .and_return(assignment_questionnaire_vt)&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:find_by)&lt;br /&gt;
    .with(assignment_id: assignment.id, questionnaire_id: review_questionnaire.id)&lt;br /&gt;
    .and_return(assignment_questionnaire_vt)&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:where)&lt;br /&gt;
    .with(any_args)&lt;br /&gt;
    .and_return([assignment_questionnaire_vt])&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:late_policy_id)&lt;br /&gt;
    .and_return(false)&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:calculate_penalty)&lt;br /&gt;
    .and_return(false)&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:compute_total_score)&lt;br /&gt;
    .with(any_args)&lt;br /&gt;
    .and_return(100)&lt;br /&gt;
  allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
  allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
 it 'renders grades#view_team page' do&lt;br /&gt;
  params = {id: participant_vt.id}&lt;br /&gt;
  get :view_team, params&lt;br /&gt;
  expect(response).to render_template(:view_team)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is opened by student' do&lt;br /&gt;
  it 'dropdown is not rendered' do&lt;br /&gt;
    session = { user: student1_vt }&lt;br /&gt;
    params = {id: participant_vt.id}&lt;br /&gt;
    stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
    get :view_team, params&lt;br /&gt;
    expect(response.body).to_not have_selector('select')&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is opened by instructor' do&lt;br /&gt;
  it 'dropdown is rendered' do&lt;br /&gt;
    session = { user: instructor }&lt;br /&gt;
    params = {id: participant_vt.id}&lt;br /&gt;
    get :view_team, params&lt;br /&gt;
    expect(response.body).to have_selector('select')&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
  it 'renders grades#view_team page' do&lt;br /&gt;
    params = { id: participant_vt.id }&lt;br /&gt;
    allow(TaMapping).to receive(:exists?).with(ta_id: participant_vt.user_id, course_id: 1).and_return(true)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====H. In spec/factories/factories.rb:====&lt;br /&gt;
&lt;br /&gt;
'''H.1 '''Add the following factory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
factory :teammate_review_questionnaire, class: TeammateReviewQuestionnaire do&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''H.2 '''Add another factory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
factory :tm_assignment_questionnaire, class: AssignmentQuestionnaire do&lt;br /&gt;
  user_id 1&lt;br /&gt;
  questionnaire { association(:teammate_review_questionnaire) }&lt;br /&gt;
  questionnaire_weight 100&lt;br /&gt;
  used_in_round nil&lt;br /&gt;
  topic_id nil&lt;br /&gt;
  dropdown 1&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Summary of file changes ===&lt;br /&gt;
&lt;br /&gt;
The following files are modified:&lt;br /&gt;
&lt;br /&gt;
1. app/controllers/grades_controller.rb - Controller file which changed how the view model is populated&lt;br /&gt;
&lt;br /&gt;
2. app/views/grades/view_team.html.erb - View file, which  conditionally rendered the teammate name, for a teammate review heatgrid&lt;br /&gt;
&lt;br /&gt;
3. spec/controllers/grades_controller_spec.rb - For tests verifying the proposed changes&lt;br /&gt;
&lt;br /&gt;
4. app/models/vm_question_response.rb - To modify the view-model so it can tell us the name of the person being reviewed for the current heatgrid&lt;br /&gt;
&lt;br /&gt;
5. app/models/vm_question_response_score_cell.rb - &lt;br /&gt;
&lt;br /&gt;
6. app/assets/stylesheets/grades.scss - &lt;br /&gt;
&lt;br /&gt;
7. app/views/grades/_add_icon_to_name.html.erb - &lt;br /&gt;
&lt;br /&gt;
8. spec/factories/factories.rb - &lt;br /&gt;
&lt;br /&gt;
== Design Patterns ==&lt;br /&gt;
&lt;br /&gt;
Existing code does not use any design patterns, apart from if-else. It uses if-else conditional statements to check what type of questionnaire is present in the viewmodel `VmQuestionResponse`, and based on that, it renders the appropriate content.&lt;br /&gt;
&lt;br /&gt;
We decided to continue with this approach since to change the present coding style, there were required many changes (refactoring) to many files which were out of the scope of the present project. To complete the project in the assigned time, we followed the if-else approach.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== User Stories ==&lt;br /&gt;
&lt;br /&gt;
1. As an instructor, I can view what reviews one teammate has given to other teammates.&lt;br /&gt;
&lt;br /&gt;
2. As a student, I can view what reviews my teammates have given to me.&lt;br /&gt;
&lt;br /&gt;
3. As an instructor, I can select if a student's reviews are anonymously shown to their teammates.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
'''CURRENT STATUS'''&lt;br /&gt;
&lt;br /&gt;
1. Presently, the tests only cover if the view_team is page is rendered when it is asked for.&lt;br /&gt;
&lt;br /&gt;
[[File:current_testing_status.png|border|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''OUR PROPOSAL'''&lt;br /&gt;
&lt;br /&gt;
- When show_team is set as false by the professor, the student should not be able to see his scores.&lt;br /&gt;
&lt;br /&gt;
- When show_team is set as true by the professor, the student should be able to see his.&lt;br /&gt;
&lt;br /&gt;
- An instructor can select which student's scores he/she wants to see. If no student's name is selected then the professor can see the scores of all the students.&lt;br /&gt;
- The instructor can decide whether to show the names of the reviewer to the reviewer in teammate reviews, by selecting a checkbox for the same.&lt;br /&gt;
[[File:Untitled Diagram.drawio.png|border|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;https://expertiza.ncsu.edu/&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Agarg25</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141720</id>
		<title>CSC/ECE 517 Fall 2021 - E2165. Fix teammate-review view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141720"/>
		<updated>2021-11-28T05:36:57Z</updated>

		<summary type="html">&lt;p&gt;Agarg25: /* Models used / Explanation of fixes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Introduction ==&lt;br /&gt;
&lt;br /&gt;
Dr. Edward Gehringer (instructor), Parimal Mehta (mentor)&lt;br /&gt;
&lt;br /&gt;
1. Anjali Garg (unity ID : agarg25)&lt;br /&gt;
&lt;br /&gt;
2. Arvasu Chikara (unity ID: achikar2)&lt;br /&gt;
&lt;br /&gt;
3. Lalit Bangad (unity ID: llbangad)&lt;br /&gt;
&lt;br /&gt;
4. Vinay Deshmukh (unity ID: vdeshmu)&lt;br /&gt;
&lt;br /&gt;
== Problems to be addressed ==&lt;br /&gt;
&lt;br /&gt;
After a project is submitted and reviewed, both the team members (students) and instructors should be able to view the teammate reviews. Students should be able to view the reviews by going to a particular assignment's -&amp;gt; your scores, at the bottom of the page. An instructor can view the teammate reviews by going to assignments -&amp;gt; assignment -&amp;gt; particular team's submission -&amp;gt; view submission -&amp;gt; assign grades -&amp;gt; view scores. &lt;br /&gt;
&lt;br /&gt;
In the case of the instructor, a single heat grid is shown whereas in the case of a team member, we cant view the scores. In the heat grid, it is not clear if the scores visible are for the reviews that the student has *written* for their teammates or the scores that the student has *received* from their teammates. Additionally, for instructors can choose from a list of the students on the team, but they have no way to tell whether the heat grid shows the reviews done *by* that student or done *for* that student.&lt;br /&gt;
&lt;br /&gt;
== Methodology Overview ==&lt;br /&gt;
&lt;br /&gt;
We have divided our work in the following tasks to address the above problems:&lt;br /&gt;
&lt;br /&gt;
1. Distinguish reviews done for a student by rendering separates heatgrids for each student&lt;br /&gt;
&lt;br /&gt;
2. For instructors, the table will have sections based on the students&lt;br /&gt;
&lt;br /&gt;
3. Include a checkbox on the edit assignment page that enables/disables visibility of heat grid to students&lt;br /&gt;
&lt;br /&gt;
4. Fix the average column for a table (which breaks for some reviews)&lt;br /&gt;
&lt;br /&gt;
5. Show a composite score derived from all reviews.  Make this code generalized, so other kinds of heat grid views could use it.&lt;br /&gt;
&lt;br /&gt;
6. Changes should work even in an anonymized view&lt;br /&gt;
&lt;br /&gt;
== Motivations ==&lt;br /&gt;
&lt;br /&gt;
1. Enable users to clearly tell which reviews are done by them, and which reviews are done for them.&lt;br /&gt;
&lt;br /&gt;
2. Code should be generic so it can be used for different types of heat grids as well.&lt;br /&gt;
&lt;br /&gt;
== Control Flow to access the concerned screens ==&lt;br /&gt;
'''1. For instructor (Log in as an instructor):-'''&lt;br /&gt;
&lt;br /&gt;
Screen after logging in by the instructor&lt;br /&gt;
[[File:ss1.png |border|1000px|center]]&lt;br /&gt;
Got to assignments on the Manage menu &lt;br /&gt;
[[File:ss2.png |border|1000px|center]]&lt;br /&gt;
Go to assignments&lt;br /&gt;
[[File:ss3.png |border|1000px|center]]&lt;br /&gt;
Go to submissions for any assignment&lt;br /&gt;
[[File:ss4a.png |border|1000px|center]]&lt;br /&gt;
Go to Assign Grade&lt;br /&gt;
[[File:ss5a.png |border|1000px|center]]&lt;br /&gt;
You will land on the page where the changes are made and can be reviewed&lt;br /&gt;
[[File:ss7a.png |border|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
'''2. Student:- (Logged in as an instructor)'''&lt;br /&gt;
&lt;br /&gt;
After landing on the assignments page, select any student from an assignment as shown below&lt;br /&gt;
[[File:ss6a.png |border|1000px|center]]&lt;br /&gt;
Go to/Select any assignment&lt;br /&gt;
[[File:ss9a.png |border|1000px|center]]&lt;br /&gt;
Go to your scores&lt;br /&gt;
[[File:ss10a.png |border|1000px|center]]&lt;br /&gt;
You will land on the page where the changes are made and can be reviewed&lt;br /&gt;
[[File:ss11a.png |border|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
== Models used / Explanation of fixes ==&lt;br /&gt;
&lt;br /&gt;
The below diagram illustrates the proposed code change for showing all team members with the teammate review data to an instructor. The existing code only iterated on the `Participant` whose ID is present in the URL of the page. To fix this, we will iterate over all teammates of the given participant so that all teammate reviews for all team members are shown to the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Logic e2165.png|border|center|alt=Flow diagram of proposed changes for showing team review data to instructor]]&lt;br /&gt;
&lt;br /&gt;
===Changes made to the code are shown below. Every change is shown and explained separately===&lt;br /&gt;
&lt;br /&gt;
====A. Added the following to app/assets/stylesheets/grades.scss:====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    .teammate_table.hidden {&lt;br /&gt;
      display: none;&lt;br /&gt;
      }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====B. In app/controllers/grades_controller.rb: ====&lt;br /&gt;
&lt;br /&gt;
'''B.1:'''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
  @vmlist &amp;lt;&amp;lt; populate_view_model(questionnaire)&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
     if questionnaire.type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
        # as teammate review will be different for each participant&lt;br /&gt;
        # we need to create a separate table for each teammate&lt;br /&gt;
        @participant.team.participants.each do |team_participant|&lt;br /&gt;
          @vmlist &amp;lt;&amp;lt; populate_view_model(team_participant, questionnaire, @team)&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        # only one participant needs iterating, as apart from teammatereview&lt;br /&gt;
        # all other reviews are at &amp;quot;team&amp;quot; level&lt;br /&gt;
        @vmlist &amp;lt;&amp;lt; populate_view_model(@participant, questionnaire, @team)&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
'''B.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
    def populate_view_model(questionnaire)&lt;br /&gt;
      vm = VmQuestionResponse.new(questionnaire, @assignment, @round)&lt;br /&gt;
      vmquestions = questionnaire.questions&lt;br /&gt;
      vm.add_questions(vmquestions)&lt;br /&gt;
      vm.add_team_members(@team)&lt;br /&gt;
      vm.add_reviews(@participant, @team, @assignment.vary_by_round)&lt;br /&gt;
      vm.number_of_comments_greater_than_10_words&lt;br /&gt;
      vm &lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
    def populate_view_model(participant, questionnaire, team)&lt;br /&gt;
      vm = VmQuestionResponse.new(questionnaire, @assignment, @round)&lt;br /&gt;
      vmquestions = questionnaire.questions&lt;br /&gt;
      vm.add_questions(vmquestions)&lt;br /&gt;
      vm.add_team_members(team)&lt;br /&gt;
      vm.add_reviews(participant, team, @assignment.vary_by_round)&lt;br /&gt;
      vm.number_of_comments_greater_than_10_words&lt;br /&gt;
      vm&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====C. In app/models/vm_question_response.rb:====&lt;br /&gt;
&lt;br /&gt;
'''C.1: '''Added the reviewee_id method&lt;br /&gt;
&lt;br /&gt;
    def reviewee_id&lt;br /&gt;
      @participant_who_is_reviewee.user_id&lt;br /&gt;
    end &lt;br /&gt;
&lt;br /&gt;
'''C.2: '''Added the reviewee_name method&lt;br /&gt;
&lt;br /&gt;
    def reviewee_name(ip_address = nil)&lt;br /&gt;
      part = @participant_who_is_reviewee&lt;br /&gt;
      User.find_by(id: part.user_id).fullname(ip_address)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''C.3: '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
    elsif @questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
      reviews = participant.teammate_reviews&lt;br /&gt;
      reviews.each do |review|&lt;br /&gt;
        review_mapping = TeammateReviewResponseMap.find_by(id: review.map_id)&lt;br /&gt;
        participant = Participant.find(review_mapping.reviewer_id)&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
    elsif @questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
      reviews = participant.teammate_reviews&lt;br /&gt;
      @participant_who_is_reviewee = participant&lt;br /&gt;
      reviews.each do |review|&lt;br /&gt;
        review_mapping = TeammateReviewResponseMap.find_by(id: review.map_id)&lt;br /&gt;
        participant = Participant.find(review_mapping.reviewer_id)&lt;br /&gt;
&lt;br /&gt;
'''C.4: '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
    row.score_row.push(VmQuestionResponseScoreCell.new(answer.answer, color_code, answer.comments, vm_tag_prompts))&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
    &lt;br /&gt;
    row.score_row.push(VmQuestionResponseScoreCell.new(answer.answer, color_code, answer.comments, vm_tag_prompts, answer.response_id))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====D. In app/models/vm_question_response_score_cell.rb:====&lt;br /&gt;
&lt;br /&gt;
'''D.1: '''In the method initialize of class VmQuestionResponseScoreCell&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
    def initialize(score_value, color_code, comments, vmprompts = nil)&lt;br /&gt;
      @score_value = score_value&lt;br /&gt;
      @color_code = color_code&lt;br /&gt;
      @comment = comments&lt;br /&gt;
      @vm_prompts = vmprompts&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&lt;br /&gt;
    def initialize(score_value, color_code, comments, vmprompts = nil, response_id)&lt;br /&gt;
      @score_value = score_value&lt;br /&gt;
      @color_code = color_code&lt;br /&gt;
      @comment = comments&lt;br /&gt;
      @vm_prompts = vmprompts&lt;br /&gt;
      @response_id = response_id&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''D.2: '''Added a method reviewer_id to the class VmQuestionResponseScoreCell&lt;br /&gt;
&lt;br /&gt;
    def reviewer_id&lt;br /&gt;
      resp = Response.find(@response_id)&lt;br /&gt;
      map = ResponseMap.find(resp.map_id)&lt;br /&gt;
      map.reviewer_id&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====E. In app/views/grades/_add_icon_to_name.html.erb:====&lt;br /&gt;
&lt;br /&gt;
'''E.1 '''Added the following code to the file:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;%# Determine the content of the reviewed by text %&amp;gt;&lt;br /&gt;
    &amp;lt;% review_text = &amp;quot;&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% if @current_role_name.eql?'Student' or questionnaire_type != &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
      &amp;lt;%# Use Review {{index}} format for student view, and when questionnaire_type is not teammatereview %&amp;gt;&lt;br /&gt;
      &amp;lt;% review_text = &amp;quot;Review #{i + 1}&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;% resp = Response.find(review.id) %&amp;gt;&lt;br /&gt;
      &amp;lt;% map = ResponseMap.find(resp.map_id) %&amp;gt;&lt;br /&gt;
      &amp;lt;% reviewer_id = map.reviewer_id %&amp;gt;&lt;br /&gt;
      &amp;lt;% fullname = Participant.find_by(id: reviewer_id).fullname(session[:ip]) %&amp;gt;&lt;br /&gt;
      &amp;lt;% review_text = &amp;quot;Review by #{fullname}&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% end%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''E.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;% if review.done_by_staff_participant? %&amp;gt;&lt;br /&gt;
      &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt; &amp;lt;img data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Icon indicates this review was done by course staff&amp;quot; class=&amp;quot;img_icon&amp;quot; src=&amp;quot;/assets/staff.png&amp;quot;&amp;gt; &amp;lt;a target=&amp;quot;_blank&amp;quot; href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Click to see details&amp;quot;&amp;gt;&amp;lt;%= &amp;quot;Review &amp;quot; + i.to_s  %&amp;gt;&amp;lt;/a&amp;gt; &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt; &amp;lt;a target=&amp;quot;_blank&amp;quot; href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Click to see details&amp;quot;&amp;gt;&amp;lt;%= &amp;quot;Review &amp;quot; + i.to_s %&amp;gt;&amp;lt;/a&amp;gt;  &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;% if review.done_by_staff_participant? %&amp;gt;&lt;br /&gt;
    &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;img&lt;br /&gt;
      data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
      data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
      title=&amp;quot;Icon indicates this review was done by course staff&amp;quot; class=&amp;quot;img_icon&amp;quot;&lt;br /&gt;
      src=&amp;quot;/assets/staff.png&amp;quot;&lt;br /&gt;
      &amp;gt;&lt;br /&gt;
    &amp;lt;a&lt;br /&gt;
      target=&amp;quot;_blank&amp;quot;&lt;br /&gt;
      href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;&lt;br /&gt;
      data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
      data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
      title=&amp;quot;Click to see details&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;%= review_text %&amp;gt;&lt;br /&gt;
    &amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
    &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;a&lt;br /&gt;
            target=&amp;quot;_blank&amp;quot; &lt;br /&gt;
            href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  &lt;br /&gt;
            data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
            data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
            title=&amp;quot;Click to see details&amp;quot;&lt;br /&gt;
        &amp;gt;&lt;br /&gt;
        &amp;lt;%= review_text %&amp;gt;&lt;br /&gt;
        &amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====F.In app/views/grades/view_team.html.erb:====&lt;br /&gt;
&lt;br /&gt;
'''F.1: '''Added function teammateSelectOnChange:&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  function teammateSelectOnChange(selectNode) {&lt;br /&gt;
      const revieweeIdToShow= selectNode.value;&lt;br /&gt;
      const tableSelector = &amp;quot;.teammate_table&amp;quot;;&lt;br /&gt;
      if(revieweeIdToShow == &amp;quot;all&amp;quot;) {&lt;br /&gt;
        document.querySelectorAll(tableSelector).forEach((tableNode) =&amp;gt; {&lt;br /&gt;
          tableNode.classList.remove(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
        });&lt;br /&gt;
        return;&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
  document.querySelectorAll(tableSelector).forEach((tableNode) =&amp;gt; {&lt;br /&gt;
    const tableRevieweeId = tableNode.getAttribute('data-reviewee_id');&lt;br /&gt;
    if(tableRevieweeId == revieweeIdToShow) {&lt;br /&gt;
      tableNode.classList.remove(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
    } else {&lt;br /&gt;
      tableNode.classList.add(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    });&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.2: '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;% @vmlist.each do |vm| %&amp;gt;&lt;br /&gt;
        &amp;lt;% if (vm.questionnaire_display_type == &amp;quot;Metareview&amp;quot; or vm.questionnaire_display_type == &amp;quot;Author Feedback&amp;quot; or vm.questionnaire_display_type == &amp;quot;Teammate Review&amp;quot;) and @current_role_name.eql?'Student' %&amp;gt;&lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
        &amp;lt;% if vm.list_of_reviewers.length &amp;gt; 0 %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
​      &amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  @@ -87,6 +131,8 @@&lt;br /&gt;
              &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
                &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                    (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
        &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;%# This boolean is used to render a dropdown just before the first teammate review heat grid %&amp;gt;&lt;br /&gt;
&amp;lt;% first_teammate_review_appeared = false %&amp;gt;&lt;br /&gt;
&amp;lt;% @vmlist.each do |vm| %&amp;gt;&lt;br /&gt;
    &amp;lt;% if not @current_role_name.eql?'Student' and not first_teammate_review_appeared and vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        &amp;lt;select onchange=&amp;quot;teammateSelectOnChange(this)&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;all&amp;quot;&amp;gt;All&amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;% @vmlist.select { |tm_vm| tm_vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; }.each do |tm_vm| %&amp;gt;&lt;br /&gt;
            &amp;lt;option value=&amp;quot;&amp;lt;%= tm_vm.reviewee_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;%= tm_vm.reviewee_name(session[:ip]) %&amp;gt;&lt;br /&gt;
            &amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
        &amp;lt;/select&amp;gt;&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;% first_teammate_review_appeared = true %&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;% if (vm.questionnaire_display_type == &amp;quot;Metareview&amp;quot; or vm.questionnaire_display_type == &amp;quot;Author Feedback&amp;quot;) and @current_role_name.eql?'Student' %&amp;gt;&lt;br /&gt;
    &amp;lt;% elsif (vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; and @current_role_name.eql?'Student' and !@assignment.show_teammate_reviews)%&amp;gt;&lt;br /&gt;
    &amp;lt;% elsif (vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; and @current_role_name.eql?'Student' and @assignment.show_teammate_reviews and current_user.id != vm.reviewee_id )%&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
        &amp;lt;% if vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
          &amp;lt;div class=&amp;quot;teammate_table&amp;quot; data-reviewee_id=&amp;quot;&amp;lt;%= vm.reviewee_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
        &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.3  '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
@@ -87,6 +131,8 @@&lt;br /&gt;
          &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
            &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
@@ -87,6 +131,8 @@&lt;br /&gt;
          &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
            &amp;lt;% elsif vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (For: &amp;lt;%= vm.reviewee_name(session[:ip]) %&amp;gt;)&lt;br /&gt;
            &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.4 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_reviews.each do |review| %&amp;gt;&lt;br /&gt;
              &amp;lt;!-- instructors (or higher level users) see reviewer name, students see anonymized string --&amp;gt;&lt;br /&gt;
              &amp;lt;% if (['Student'].include? @current_role_name) &amp;amp;&amp;amp; @assignment.is_anonymous%&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i} %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                  &amp;lt;% user_name = User.find(Participant.find(ResponseMap.find(Response.find(review.id).map_id).reviewer_id).user_id).fullname(session[:ip]).to_s %&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i} %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% i += 1 %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-true&amp;quot; align=&amp;quot;right&amp;quot; &amp;gt;&lt;br /&gt;
            Avg&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;span  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;A count of comments, for the respective question, which have word count &amp;gt; 10. The purpose of this metric is to represent how many comments for the question are of a substantial length to provide quality feedback.&amp;quot;&amp;gt;metric-1&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/thead&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_reviews.each do |review| %&amp;gt;&lt;br /&gt;
              &amp;lt;!-- instructors (or higher level users) see reviewer name, students see anonymized string --&amp;gt;&lt;br /&gt;
              &amp;lt;% if (['Student'].include? @current_role_name) &amp;amp;&amp;amp; @assignment.is_anonymous%&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i, questionnaire_type: vm.questionnaire_type } %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                &amp;lt;% user_name = User.find(Participant.find(ResponseMap.find(Response.find(review.id).map_id).reviewer_id).user_id).fullname(session[:ip]).to_s %&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i, questionnaire_type: vm.questionnaire_type } %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% i += 1 %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-true&amp;quot; align=&amp;quot;right&amp;quot; &amp;gt;&lt;br /&gt;
            Avg&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/thead&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.5 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_rows.each do |row| %&amp;gt;&lt;br /&gt;
            &amp;lt;!-- notice the data-target. because we're toggling via looped code, we need to dynamically generate the identifier. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr data-toggle=&amp;quot;collapse&amp;quot; class=&amp;quot;accordion-toggle&amp;quot; data-target=&amp;quot;#hid&amp;lt;%= row.question_id.to_s + vm.round.to_s %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;td class = 'cf' data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= row.question_text %&amp;gt;&amp;quot;&amp;gt; &amp;lt;div style='float: left'&amp;gt;&amp;lt;%= j.to_s %&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div style='float: right'&amp;gt; &amp;amp;#&amp;lt;%= type_and_max(row) %&amp;gt;;&amp;lt;/div&amp;gt;  &amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
              &amp;lt;!-- actual cells with scores and colored background. --&amp;gt;&lt;br /&gt;
              &amp;lt;% row.score_row.each do |score| %&amp;gt;&lt;br /&gt;
                  &amp;lt;% score_comment = score.comment.nil? ? '' : score.comment %&amp;gt; &amp;lt;!-- changing nil to null string to avoid Null Pointer Exception --&amp;gt;&lt;br /&gt;
                  &amp;lt;td class=&amp;quot;&amp;lt;%= score.color_code %&amp;gt;&amp;quot; align=&amp;quot;center&amp;quot; data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= strip_tags(score.comment).html_safe%&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;&amp;lt;%=  underlined?(score) %&amp;gt;&amp;quot;&amp;gt;&amp;lt;%= score.score_value.to_s %&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
                  &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_rows.each do |row| %&amp;gt;&lt;br /&gt;
            &amp;lt;% target_id = &amp;quot;hid__#{row.question_id}__#{vm.round}&amp;quot; %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
              &amp;lt;%# Since we render different heatgrids with the same questions for each&lt;br /&gt;
              teammember, we need to distinguish the ID, based on the user for whom,&lt;br /&gt;
              the reviews have been created. %&amp;gt;&lt;br /&gt;
              &amp;lt;% target_id += &amp;quot;__#{vm.reviewee_id}&amp;quot; %&amp;gt;&lt;br /&gt;
            &amp;lt;% end%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;!-- notice the data-target. because we're toggling via looped code, we need to dynamically generate the identifier. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr data-toggle=&amp;quot;collapse&amp;quot; class=&amp;quot;accordion-toggle&amp;quot; data-target=&amp;quot;&amp;lt;%= &amp;quot;#&amp;quot; + target_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;td class = 'cf' data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= row.question_text %&amp;gt;&amp;quot;&amp;gt; &amp;lt;div style='float: left'&amp;gt;&amp;lt;%= j.to_s %&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div style='float: right'&amp;gt; &amp;amp;#&amp;lt;%= type_and_max(row) %&amp;gt;;&amp;lt;/div&amp;gt;  &amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
              &amp;lt;!-- actual cells with scores and colored background. --&amp;gt;&lt;br /&gt;
              &amp;lt;% row.score_row.each do |score| %&amp;gt;&lt;br /&gt;
                  &amp;lt;% score_comment = score.comment.nil? ? '' : score.comment %&amp;gt;&lt;br /&gt;
                  &amp;lt;!-- changing nil to null string to avoid Null Pointer Exception --&amp;gt;&lt;br /&gt;
                  &amp;lt;td class=&amp;quot;&amp;lt;%= score.color_code %&amp;gt;&amp;quot; align=&amp;quot;center&amp;quot; data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= strip_tags(score.comment).html_safe%&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;&amp;lt;%=  underlined?(score) %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                      &amp;lt;%= score.score_value.to_s %&amp;gt;&lt;br /&gt;
                    &amp;lt;/span&amp;gt;&lt;br /&gt;
                  &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.6 '''Removed the following code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 &amp;lt;td  class = 'cf' align=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;%= row.countofcomments.to_s %&amp;gt;&lt;br /&gt;
              &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''F.7 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!--loop that creates the collapsed-by-default row, which lists all comments. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr class=&amp;quot;tablesorter-childRow&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;td colspan=&amp;quot;&amp;lt;%= (i+1).to_s %&amp;gt;&amp;quot; class=&amp;quot;hiddenRow&amp;quot; &amp;gt;&amp;lt;div id=&amp;quot;hid&amp;lt;%= row.question_id.to_s + vm.round.to_s %&amp;gt;&amp;quot; class=&amp;quot;accordion-body collapse&amp;quot; style=&amp;quot;margin-left:10px;&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;div style=&amp;quot;padding-top: 10px; padding-bottom: 10px;&amp;quot;&amp;gt;&amp;lt;%=  sanitize row.question_text %&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;div&amp;gt;&lt;br /&gt;
                  &amp;lt;table class=&amp;quot;table tbl_questlist&amp;quot;&amp;gt;&lt;br /&gt;
@@ -181,7 +233,17 @@&lt;br /&gt;
                    &amp;lt;/thead&amp;gt;&lt;br /&gt;
                    &amp;lt;% for index in 0 .. row.score_row.length - 1 %&amp;gt;&lt;br /&gt;
                        &amp;lt;tr&amp;gt;&lt;br /&gt;
                          &amp;lt;td&amp;gt;Review &amp;lt;%=index + 1%&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!--loop that creates the collapsed-by-default row, which lists all comments. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr class=&amp;quot;tablesorter-childRow&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;td colspan=&amp;quot;&amp;lt;%= (i+1).to_s %&amp;gt;&amp;quot; class=&amp;quot;hiddenRow&amp;quot; &amp;gt;&amp;lt;div id=&amp;quot;&amp;lt;%= target_id %&amp;gt;&amp;quot; class=&amp;quot;accordion-body collapse&amp;quot; style=&amp;quot;margin-left:10px;&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;div style=&amp;quot;padding-top: 10px; padding-bottom: 10px;&amp;quot;&amp;gt;&amp;lt;%=  sanitize row.question_text %&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;div&amp;gt;&lt;br /&gt;
                  &amp;lt;table class=&amp;quot;table tbl_questlist&amp;quot;&amp;gt;&lt;br /&gt;
@@ -181,7 +233,17 @@&lt;br /&gt;
                    &amp;lt;/thead&amp;gt;&lt;br /&gt;
                    &amp;lt;% for index in 0 .. row.score_row.length - 1 %&amp;gt;&lt;br /&gt;
                        &amp;lt;tr&amp;gt;&lt;br /&gt;
                          &amp;lt;% if @current_role_name.eql?'Student' or vm.questionnaire_type != &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                            &amp;lt;%# Use Review {{index}} format for student view, and&lt;br /&gt;
                            when questionnaire_type is not teammatereview %&amp;gt;&lt;br /&gt;
                            &amp;lt;td&amp;gt;Review &amp;lt;%=index + 1%&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
                          &amp;lt;% else %&amp;gt;&lt;br /&gt;
                            &amp;lt;td&amp;gt;&lt;br /&gt;
                              &amp;lt;% reviewer_id = row.score_row[index].reviewer_id %&amp;gt;&lt;br /&gt;
                              &amp;lt;% fullname = Participant.find_by(id: reviewer_id).fullname(session[:ip]) %&amp;gt;&lt;br /&gt;
                              Review by &amp;lt;%= fullname %&amp;gt;&lt;br /&gt;
                            &amp;lt;/td&amp;gt;&lt;br /&gt;
                          &amp;lt;% end%&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====G. In spec/controllers/grades_controller_spec.rb:====&lt;br /&gt;
&lt;br /&gt;
'''G.1 '''&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
before(:each) do&lt;br /&gt;
  allow(AssignmentParticipant).to receive(:find).with('1').and_return(participant)&lt;br /&gt;
  allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
  stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
@@ -91,29 +90,106 @@&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
before(:each) do&lt;br /&gt;
  allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
  stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
@@ -91,29 +90,106 @@&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''G.2 '''Remove xdescribe '#view_team' and change describe '#view_team' as follows.&lt;br /&gt;
&lt;br /&gt;
Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#view_team' do&lt;br /&gt;
render_views&lt;br /&gt;
context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
  it 'renders grades#view_team page' do&lt;br /&gt;
    allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
    allow(AssignmentQuestionnaire).to receive(:find_by).with(assignment_id: 1, questionnaire_id: 1).and_return(assignment_questionnaire)&lt;br /&gt;
    allow(AssignmentQuestionnaire).to receive(:where).with(any_args).and_return([assignment_questionnaire])&lt;br /&gt;
    allow(assignment).to receive(:late_policy_id).and_return(false)&lt;br /&gt;
    allow(assignment).to receive(:calculate_penalty).and_return(false)&lt;br /&gt;
    allow(assignment).to receive(:compute_total_score).with(any_args).and_return(100)&lt;br /&gt;
    allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
    allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
    params = {id: 1}&lt;br /&gt;
    allow(TaMapping).to receive(:exists?).with(ta_id: 1, course_id: 1).and_return(true)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#view_team' do&lt;br /&gt;
render_views&lt;br /&gt;
&lt;br /&gt;
# All stubs and factories are instantiated within this scope so as to not &lt;br /&gt;
# clash with other broken test.&lt;br /&gt;
# The names of the factories created for testing view_team&lt;br /&gt;
# have `_vt` suffix ```where necessary``` to differentiate them from &lt;br /&gt;
# the above declared factories&lt;br /&gt;
&lt;br /&gt;
let(:student1_vt) { create(:student, name: &amp;quot;barry&amp;quot;, id: 12) }&lt;br /&gt;
let(:student2_vt) { create(:student, name: &amp;quot;iris&amp;quot;, id: 13) }&lt;br /&gt;
&lt;br /&gt;
let(:tm_questionnaire) {&lt;br /&gt;
  build(&lt;br /&gt;
    :teammate_review_questionnaire,&lt;br /&gt;
    id: 12,&lt;br /&gt;
    questions: [question],&lt;br /&gt;
    max_question_score: 5&lt;br /&gt;
  )&lt;br /&gt;
}&lt;br /&gt;
let(:assignment_vt) {&lt;br /&gt;
  create(:assignment, id: 6, max_team_size: 2,&lt;br /&gt;
  questionnaires: [tm_questionnaire])&lt;br /&gt;
}&lt;br /&gt;
let(:assignment_questionnaire_vt) {&lt;br /&gt;
  create(:tm_assignment_questionnaire, id: 12, used_in_round: nil,&lt;br /&gt;
  assignment: assignment_vt, questionnaire: tm_questionnaire) }&lt;br /&gt;
let(:team_vt) { create(:assignment_team, id: 12,&lt;br /&gt;
assignment: assignment_vt) }&lt;br /&gt;
let(:participant_vt) { create(:participant, id: 12,&lt;br /&gt;
  assignment: assignment_vt, user_id: student1_vt.id) }&lt;br /&gt;
let(:participant2_vt) { create(:participant, id: 13,&lt;br /&gt;
  assignment: assignment_vt, user_id: student2_vt.id) }&lt;br /&gt;
&lt;br /&gt;
before(:each) do&lt;br /&gt;
  # Need to stub this method so the factory instance with&lt;br /&gt;
  # the stubbed :team method is returned by :find&lt;br /&gt;
  # instead of a separate instance with the same data&lt;br /&gt;
  allow(AssignmentParticipant)&lt;br /&gt;
    .to receive(:find)&lt;br /&gt;
    .with(participant_vt.id.to_s)&lt;br /&gt;
    .and_return(participant_vt)&lt;br /&gt;
  allow(participant_vt).to receive(:team).and_return(team_vt)&lt;br /&gt;
  allow(team_vt).to receive(:participants).and_return([participant_vt, participant2_vt])&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:find_by)&lt;br /&gt;
    .with(assignment_id: assignment_vt.id, questionnaire_id: tm_questionnaire.id)&lt;br /&gt;
    .and_return(assignment_questionnaire_vt)&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:find_by)&lt;br /&gt;
    .with(assignment_id: assignment.id, questionnaire_id: review_questionnaire.id)&lt;br /&gt;
    .and_return(assignment_questionnaire_vt)&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:where)&lt;br /&gt;
    .with(any_args)&lt;br /&gt;
    .and_return([assignment_questionnaire_vt])&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:late_policy_id)&lt;br /&gt;
    .and_return(false)&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:calculate_penalty)&lt;br /&gt;
    .and_return(false)&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:compute_total_score)&lt;br /&gt;
    .with(any_args)&lt;br /&gt;
    .and_return(100)&lt;br /&gt;
  allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
  allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
 it 'renders grades#view_team page' do&lt;br /&gt;
  params = {id: participant_vt.id}&lt;br /&gt;
  get :view_team, params&lt;br /&gt;
  expect(response).to render_template(:view_team)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is opened by student' do&lt;br /&gt;
  it 'dropdown is not rendered' do&lt;br /&gt;
    session = { user: student1_vt }&lt;br /&gt;
    params = {id: participant_vt.id}&lt;br /&gt;
    stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
    get :view_team, params&lt;br /&gt;
    expect(response.body).to_not have_selector('select')&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is opened by instructor' do&lt;br /&gt;
  it 'dropdown is rendered' do&lt;br /&gt;
    session = { user: instructor }&lt;br /&gt;
    params = {id: participant_vt.id}&lt;br /&gt;
    get :view_team, params&lt;br /&gt;
    expect(response.body).to have_selector('select')&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
  it 'renders grades#view_team page' do&lt;br /&gt;
    params = { id: participant_vt.id }&lt;br /&gt;
    allow(TaMapping).to receive(:exists?).with(ta_id: participant_vt.user_id, course_id: 1).and_return(true)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====H. In spec/factories/factories.rb:====&lt;br /&gt;
&lt;br /&gt;
'''H.1 '''Add the following factory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
factory :teammate_review_questionnaire, class: TeammateReviewQuestionnaire do&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''H.2 '''Add another factory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
factory :tm_assignment_questionnaire, class: AssignmentQuestionnaire do&lt;br /&gt;
  user_id 1&lt;br /&gt;
  questionnaire { association(:teammate_review_questionnaire) }&lt;br /&gt;
  questionnaire_weight 100&lt;br /&gt;
  used_in_round nil&lt;br /&gt;
  topic_id nil&lt;br /&gt;
  dropdown 1&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Present Status of the application ==&lt;br /&gt;
&lt;br /&gt;
'''Image 1. Instructor's view of teammate review''': This is the current screen given to the instructor. Here we see that the instructor can not determine who has given which review to which student in a team.&lt;br /&gt;
&lt;br /&gt;
[[File:Instructor-view-1.png|border| 700px |center|alt=The proposed expanded student display.|The proposed expanded student display.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Image 2. Student's view of teammate review''': Currently, a student is not able to see what grades were given by their teammates. We need to implement that functionality so that the student is able to view those grades.&lt;br /&gt;
&lt;br /&gt;
[[File:Student-view-2.png|border| 700px |center|alt=The current instructor view.|The current review display for instructors.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Image 3. UML Diagram''': We are planning to add two variables namely showTeammateReview and hideReviewerName. showTeammateReview will decide whether the students would be able to view the reviews given to them by their teammates. hideReviewerName will decide whether the student is able to view the reviewee's name or not.&lt;br /&gt;
[[File:Uml-assignment.png|border|center|alt=The proposed condensed student display.|The proposed condensed student display.]]&lt;br /&gt;
&lt;br /&gt;
== Proposed changes ==&lt;br /&gt;
&lt;br /&gt;
1)''' Proposed UI for instructor ''': The instructor is able to see the score for all teammates. In the existing code, only one teammate's scores are being shown. But, we are planning to change the way the (VmQuestionResponse array is populated)[https://github.com/expertiza/expertiza/blob/master/app/controllers/grades_controller.rb#L114], so that the scores for all teammates are appended to it so it correctly shows what should have already been shown in this screen for the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Proposed_screen.png|border|700px|center|alt=Proposed UI for instructor|Proposed UI for instructor.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: When a student visits this screen, they will only be shown the reviews received by them, assuming the instructor has allowed visibility of teammate reviews to students.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2)''' Error in existing UI for student ''': In the existing UI for a student, the highlighted block should not be rendered. This part of the screen is meant for the instructors/TAs. This portion of the screen being rendered to a student is a mistake, and we will remove this part of the screen from the student's screen as part of our proposed changes.&lt;br /&gt;
&lt;br /&gt;
[[File:Wrong render for student.png|border|700px|center|alt=Existing UI for student|Existing UI for student.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3)''' Show teammate review to student UI ''': The existing code doesn't render a student's teammate review scores at all. We are planning to render the scores to a student (as shown below) when they visit this screen. However, the visibility of this screen is contingent on whether the instructor has allowed visibility of the teammate review screen to students. If the instructor has disabled this feature, then the heatgrid will not be displayed at all.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:UI_for_student.png|border|700px|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
=== Files to be modified ===&lt;br /&gt;
&lt;br /&gt;
In the current design plan, the following files are planned to be edited:&lt;br /&gt;
&lt;br /&gt;
1. app/controllers/grades_controller.rb - Controller file which will change how the view model is populated&lt;br /&gt;
&lt;br /&gt;
2. app/views/grades/view_team.html.erb - View file, which will conditionally render the teammate name, for a teammate review heatgrid&lt;br /&gt;
&lt;br /&gt;
3. spec/controllers/grades_controller_spec.rb - For tests verifying the proposed changes&lt;br /&gt;
&lt;br /&gt;
4. app/models/vm_question_response.rb - We need to modify the view-model so it can tell us the name of the person being reviewed for the current heatgrid&lt;br /&gt;
&lt;br /&gt;
Apart from these, there will be a schema change for the `Assignment` model, as we need to add the appropriate boolean flags&lt;br /&gt;
&lt;br /&gt;
== Design Patterns ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Existing code does not use any design patterns, apart from if-else. It uses if-else conditional statements to check what type of questionnaire is present in the viewmodel `VmQuestionResponse`, and based on that, it renders the appropriate content.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can use decorator pattern, for handling the visibility of the heatgrid when rendering heatgrids for a student login.&lt;br /&gt;
&lt;br /&gt;
== User Stories ==&lt;br /&gt;
&lt;br /&gt;
1. As an instructor, I can view what reviews one teammate has given to other teammates.&lt;br /&gt;
&lt;br /&gt;
2. As a student, I can view what reviews my teammates have given to me.&lt;br /&gt;
&lt;br /&gt;
3. As an instructor, I can select if a student's reviews are anonymously shown to their teammates.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
'''CURRENT STATUS'''&lt;br /&gt;
&lt;br /&gt;
1. Presently, the tests only cover if the view_team is page is rendered when it is asked for.&lt;br /&gt;
&lt;br /&gt;
[[File:current_testing_status.png|border|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''OUR PROPOSAL'''&lt;br /&gt;
&lt;br /&gt;
- When show_team is set as false by the professor, the student should not be able to see his scores.&lt;br /&gt;
&lt;br /&gt;
- When show_team is set as true by the professor, the student should be able to see his.&lt;br /&gt;
&lt;br /&gt;
- An instructor can select which student's scores he/she wants to see. If no student's name is selected then the professor can see the scores of all the students.&lt;br /&gt;
- The instructor can decide whether to show the names of the reviewer to the reviewer in teammate reviews, by selecting a checkbox for the same.&lt;br /&gt;
[[File:Untitled Diagram.drawio.png|border|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;https://expertiza.ncsu.edu/&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Agarg25</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141717</id>
		<title>CSC/ECE 517 Fall 2021 - E2165. Fix teammate-review view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141717"/>
		<updated>2021-11-28T05:21:30Z</updated>

		<summary type="html">&lt;p&gt;Agarg25: /* Models used / Explanation of fixes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Introduction ==&lt;br /&gt;
&lt;br /&gt;
Dr. Edward Gehringer (instructor), Parimal Mehta (mentor)&lt;br /&gt;
&lt;br /&gt;
1. Anjali Garg (unity ID : agarg25)&lt;br /&gt;
&lt;br /&gt;
2. Arvasu Chikara (unity ID: achikar2)&lt;br /&gt;
&lt;br /&gt;
3. Lalit Bangad (unity ID: llbangad)&lt;br /&gt;
&lt;br /&gt;
4. Vinay Deshmukh (unity ID: vdeshmu)&lt;br /&gt;
&lt;br /&gt;
== Problems to be addressed ==&lt;br /&gt;
&lt;br /&gt;
After a project is submitted and reviewed, both the team members (students) and instructors should be able to view the teammate reviews. Students should be able to view the reviews by going to a particular assignment's -&amp;gt; your scores, at the bottom of the page. An instructor can view the teammate reviews by going to assignments -&amp;gt; assignment -&amp;gt; particular team's submission -&amp;gt; view submission -&amp;gt; assign grades -&amp;gt; view scores. &lt;br /&gt;
&lt;br /&gt;
In the case of the instructor, a single heat grid is shown whereas in the case of a team member, we cant view the scores. In the heat grid, it is not clear if the scores visible are for the reviews that the student has *written* for their teammates or the scores that the student has *received* from their teammates. Additionally, for instructors can choose from a list of the students on the team, but they have no way to tell whether the heat grid shows the reviews done *by* that student or done *for* that student.&lt;br /&gt;
&lt;br /&gt;
== Methodology Overview ==&lt;br /&gt;
&lt;br /&gt;
We have divided our work in the following tasks to address the above problems:&lt;br /&gt;
&lt;br /&gt;
1. Distinguish reviews done for a student by rendering separates heatgrids for each student&lt;br /&gt;
&lt;br /&gt;
2. For instructors, the table will have sections based on the students&lt;br /&gt;
&lt;br /&gt;
3. Include a checkbox on the edit assignment page that enables/disables visibility of heat grid to students&lt;br /&gt;
&lt;br /&gt;
4. Fix the average column for a table (which breaks for some reviews)&lt;br /&gt;
&lt;br /&gt;
5. Show a composite score derived from all reviews.  Make this code generalized, so other kinds of heat grid views could use it.&lt;br /&gt;
&lt;br /&gt;
6. Changes should work even in an anonymized view&lt;br /&gt;
&lt;br /&gt;
== Motivations ==&lt;br /&gt;
&lt;br /&gt;
1. Enable users to clearly tell which reviews are done by them, and which reviews are done for them.&lt;br /&gt;
&lt;br /&gt;
2. Code should be generic so it can be used for different types of heat grids as well.&lt;br /&gt;
&lt;br /&gt;
== Control Flow to access the concerned screens ==&lt;br /&gt;
'''1. For instructor (Log in as an instructor):-'''&lt;br /&gt;
&lt;br /&gt;
Screen after logging in by the instructor&lt;br /&gt;
[[File:ss1.png |border|1000px|center]]&lt;br /&gt;
Got to assignments on the Manage menu &lt;br /&gt;
[[File:ss2.png |border|1000px|center]]&lt;br /&gt;
Go to assignments&lt;br /&gt;
[[File:ss3.png |border|1000px|center]]&lt;br /&gt;
Go to submissions for any assignment&lt;br /&gt;
[[File:ss4a.png |border|1000px|center]]&lt;br /&gt;
Go to Assign Grade&lt;br /&gt;
[[File:ss5a.png |border|1000px|center]]&lt;br /&gt;
You will land on the page where the changes are made and can be reviewed&lt;br /&gt;
[[File:ss7a.png |border|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
'''2. Student:- (Logged in as an instructor)'''&lt;br /&gt;
&lt;br /&gt;
After landing on the assignments page, select any student from an assignment as shown below&lt;br /&gt;
[[File:ss6a.png |border|1000px|center]]&lt;br /&gt;
Go to/Select any assignment&lt;br /&gt;
[[File:ss9a.png |border|1000px|center]]&lt;br /&gt;
Go to your scores&lt;br /&gt;
[[File:ss10a.png |border|1000px|center]]&lt;br /&gt;
You will land on the page where the changes are made and can be reviewed&lt;br /&gt;
[[File:ss11a.png |border|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
== Models used / Explanation of fixes ==&lt;br /&gt;
&lt;br /&gt;
The below diagram illustrates the proposed code change for showing all team members with the teammate review data to an instructor. The existing code only iterated on the `Participant` whose ID is present in the URL of the page. To fix this, we will iterate over all teammates of the given participant so that all teammate reviews for all team members are shown to the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Logic e2165.png|border|center|alt=Flow diagram of proposed changes for showing team review data to instructor]]&lt;br /&gt;
&lt;br /&gt;
'''Changes made to the code are shown below. Every change is shown and explained separately'''&lt;br /&gt;
&lt;br /&gt;
'''A. Added the following to app/assets/stylesheets/grades.scss:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    .teammate_table.hidden {&lt;br /&gt;
      display: none;&lt;br /&gt;
      }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''B. In app/controllers/grades_controller.rb: '''&lt;br /&gt;
&lt;br /&gt;
B.1: Old code:&lt;br /&gt;
&lt;br /&gt;
  @vmlist &amp;lt;&amp;lt; populate_view_model(questionnaire)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
B.1: New code:&lt;br /&gt;
&lt;br /&gt;
     if questionnaire.type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
        # as teammate review will be different for each participant&lt;br /&gt;
        # we need to create a separate table for each teammate&lt;br /&gt;
        @participant.team.participants.each do |team_participant|&lt;br /&gt;
          @vmlist &amp;lt;&amp;lt; populate_view_model(team_participant, questionnaire, @team)&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        # only one participant needs iterating, as apart from teammatereview&lt;br /&gt;
        # all other reviews are at &amp;quot;team&amp;quot; level&lt;br /&gt;
        @vmlist &amp;lt;&amp;lt; populate_view_model(@participant, questionnaire, @team)&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
B.2: Old code:&lt;br /&gt;
&lt;br /&gt;
    def populate_view_model(questionnaire)&lt;br /&gt;
      vm = VmQuestionResponse.new(questionnaire, @assignment, @round)&lt;br /&gt;
      vmquestions = questionnaire.questions&lt;br /&gt;
      vm.add_questions(vmquestions)&lt;br /&gt;
      vm.add_team_members(@team)&lt;br /&gt;
      vm.add_reviews(@participant, @team, @assignment.vary_by_round)&lt;br /&gt;
      vm.number_of_comments_greater_than_10_words&lt;br /&gt;
      vm &lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
B.2: New code:&lt;br /&gt;
&lt;br /&gt;
    def populate_view_model(participant, questionnaire, team)&lt;br /&gt;
      vm = VmQuestionResponse.new(questionnaire, @assignment, @round)&lt;br /&gt;
      vmquestions = questionnaire.questions&lt;br /&gt;
      vm.add_questions(vmquestions)&lt;br /&gt;
      vm.add_team_members(team)&lt;br /&gt;
      vm.add_reviews(participant, team, @assignment.vary_by_round)&lt;br /&gt;
      vm.number_of_comments_greater_than_10_words&lt;br /&gt;
      vm&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''C. In app/models/vm_question_response.rb:'''&lt;br /&gt;
&lt;br /&gt;
C.1: Added the reviewee_id method&lt;br /&gt;
&lt;br /&gt;
    def reviewee_id&lt;br /&gt;
      @participant_who_is_reviewee.user_id&lt;br /&gt;
    end &lt;br /&gt;
&lt;br /&gt;
C.2: Added the reviewee_name method&lt;br /&gt;
&lt;br /&gt;
    def reviewee_name(ip_address = nil)&lt;br /&gt;
      part = @participant_who_is_reviewee&lt;br /&gt;
      User.find_by(id: part.user_id).fullname(ip_address)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
C.3: Old code&lt;br /&gt;
&lt;br /&gt;
    elsif @questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
      reviews = participant.teammate_reviews&lt;br /&gt;
      reviews.each do |review|&lt;br /&gt;
        review_mapping = TeammateReviewResponseMap.find_by(id: review.map_id)&lt;br /&gt;
        participant = Participant.find(review_mapping.reviewer_id)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
C.3: New code&lt;br /&gt;
&lt;br /&gt;
    elsif @questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot;&lt;br /&gt;
      reviews = participant.teammate_reviews&lt;br /&gt;
      @participant_who_is_reviewee = participant&lt;br /&gt;
      reviews.each do |review|&lt;br /&gt;
        review_mapping = TeammateReviewResponseMap.find_by(id: review.map_id)&lt;br /&gt;
        participant = Participant.find(review_mapping.reviewer_id)&lt;br /&gt;
&lt;br /&gt;
C.4: Old code&lt;br /&gt;
&lt;br /&gt;
    row.score_row.push(VmQuestionResponseScoreCell.new(answer.answer, color_code, answer.comments, vm_tag_prompts))&lt;br /&gt;
&lt;br /&gt;
C4: New code&lt;br /&gt;
    &lt;br /&gt;
    row.score_row.push(VmQuestionResponseScoreCell.new(answer.answer, color_code, answer.comments, vm_tag_prompts, answer.response_id))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''D. In app/models/vm_question_response_score_cell.rb:'''&lt;br /&gt;
&lt;br /&gt;
D.1: Old code - In the method initialize of class VmQuestionResponseScoreCell  &lt;br /&gt;
&lt;br /&gt;
    def initialize(score_value, color_code, comments, vmprompts = nil)&lt;br /&gt;
      @score_value = score_value&lt;br /&gt;
      @color_code = color_code&lt;br /&gt;
      @comment = comments&lt;br /&gt;
      @vm_prompts = vmprompts&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
D.1: New code - In the method initialize of class VmQuestionResponseScoreCell  &lt;br /&gt;
&lt;br /&gt;
    def initialize(score_value, color_code, comments, vmprompts = nil, response_id)&lt;br /&gt;
      @score_value = score_value&lt;br /&gt;
      @color_code = color_code&lt;br /&gt;
      @comment = comments&lt;br /&gt;
      @vm_prompts = vmprompts&lt;br /&gt;
      @response_id = response_id&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
D.2: Added a method reviewer_id to the class VmQuestionResponseScoreCell&lt;br /&gt;
&lt;br /&gt;
    def reviewer_id&lt;br /&gt;
      resp = Response.find(@response_id)&lt;br /&gt;
      map = ResponseMap.find(resp.map_id)&lt;br /&gt;
      map.reviewer_id&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''E. In app/views/grades/_add_icon_to_name.html.erb:'''&lt;br /&gt;
&lt;br /&gt;
E.1 Added the following code to the file:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;%# Determine the content of the reviewed by text %&amp;gt;&lt;br /&gt;
    &amp;lt;% review_text = &amp;quot;&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% if @current_role_name.eql?'Student' or questionnaire_type != &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
      &amp;lt;%# Use Review {{index}} format for student view, and when questionnaire_type is not teammatereview %&amp;gt;&lt;br /&gt;
      &amp;lt;% review_text = &amp;quot;Review #{i + 1}&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;% resp = Response.find(review.id) %&amp;gt;&lt;br /&gt;
      &amp;lt;% map = ResponseMap.find(resp.map_id) %&amp;gt;&lt;br /&gt;
      &amp;lt;% reviewer_id = map.reviewer_id %&amp;gt;&lt;br /&gt;
      &amp;lt;% fullname = Participant.find_by(id: reviewer_id).fullname(session[:ip]) %&amp;gt;&lt;br /&gt;
      &amp;lt;% review_text = &amp;quot;Review by #{fullname}&amp;quot; %&amp;gt;&lt;br /&gt;
    &amp;lt;% end%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
E.2: Old code&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;% if review.done_by_staff_participant? %&amp;gt;&lt;br /&gt;
      &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt; &amp;lt;img data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Icon indicates this review was done by course staff&amp;quot; class=&amp;quot;img_icon&amp;quot; src=&amp;quot;/assets/staff.png&amp;quot;&amp;gt; &amp;lt;a target=&amp;quot;_blank&amp;quot; href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Click to see details&amp;quot;&amp;gt;&amp;lt;%= &amp;quot;Review &amp;quot; + i.to_s  %&amp;gt;&amp;lt;/a&amp;gt; &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
      &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt; &amp;lt;a target=&amp;quot;_blank&amp;quot; href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;Click to see details&amp;quot;&amp;gt;&amp;lt;%= &amp;quot;Review &amp;quot; + i.to_s %&amp;gt;&amp;lt;/a&amp;gt;  &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
E.2: New code&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;% if review.done_by_staff_participant? %&amp;gt;&lt;br /&gt;
    &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;img&lt;br /&gt;
      data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
      data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
      title=&amp;quot;Icon indicates this review was done by course staff&amp;quot; class=&amp;quot;img_icon&amp;quot;&lt;br /&gt;
      src=&amp;quot;/assets/staff.png&amp;quot;&lt;br /&gt;
      &amp;gt;&lt;br /&gt;
    &amp;lt;a&lt;br /&gt;
      target=&amp;quot;_blank&amp;quot;&lt;br /&gt;
      href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;&lt;br /&gt;
      data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
      data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
      title=&amp;quot;Click to see details&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;%= review_text %&amp;gt;&lt;br /&gt;
    &amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
    &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;a&lt;br /&gt;
            target=&amp;quot;_blank&amp;quot; &lt;br /&gt;
            href=&amp;quot;../response/view?id=&amp;lt;%= review.id.to_s %&amp;gt;&amp;quot;  &lt;br /&gt;
            data-toggle=&amp;quot;tooltip&amp;quot;&lt;br /&gt;
            data-placement=&amp;quot;right&amp;quot;&lt;br /&gt;
            title=&amp;quot;Click to see details&amp;quot;&lt;br /&gt;
        &amp;gt;&lt;br /&gt;
        &amp;lt;%= review_text %&amp;gt;&lt;br /&gt;
        &amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''F.In app/views/grades/view_team.html.erb:'''&lt;br /&gt;
&lt;br /&gt;
F.1: Added function teammateSelectOnChange:&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  function teammateSelectOnChange(selectNode) {&lt;br /&gt;
      const revieweeIdToShow= selectNode.value;&lt;br /&gt;
      const tableSelector = &amp;quot;.teammate_table&amp;quot;;&lt;br /&gt;
      if(revieweeIdToShow == &amp;quot;all&amp;quot;) {&lt;br /&gt;
        document.querySelectorAll(tableSelector).forEach((tableNode) =&amp;gt; {&lt;br /&gt;
          tableNode.classList.remove(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
        });&lt;br /&gt;
        return;&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
  document.querySelectorAll(tableSelector).forEach((tableNode) =&amp;gt; {&lt;br /&gt;
    const tableRevieweeId = tableNode.getAttribute('data-reviewee_id');&lt;br /&gt;
    if(tableRevieweeId == revieweeIdToShow) {&lt;br /&gt;
      tableNode.classList.remove(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
    } else {&lt;br /&gt;
      tableNode.classList.add(&amp;quot;hidden&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    });&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
F.2: Old code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;% @vmlist.each do |vm| %&amp;gt;&lt;br /&gt;
        &amp;lt;% if (vm.questionnaire_display_type == &amp;quot;Metareview&amp;quot; or vm.questionnaire_display_type == &amp;quot;Author Feedback&amp;quot; or vm.questionnaire_display_type == &amp;quot;Teammate Review&amp;quot;) and @current_role_name.eql?'Student' %&amp;gt;&lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
        &amp;lt;% if vm.list_of_reviewers.length &amp;gt; 0 %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
​      &amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  @@ -87,6 +131,8 @@&lt;br /&gt;
              &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
                &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                    (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
        &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
F.2: New code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;%# This boolean is used to render a dropdown just before the first teammate review heat grid %&amp;gt;&lt;br /&gt;
&amp;lt;% first_teammate_review_appeared = false %&amp;gt;&lt;br /&gt;
&amp;lt;% @vmlist.each do |vm| %&amp;gt;&lt;br /&gt;
    &amp;lt;% if not @current_role_name.eql?'Student' and not first_teammate_review_appeared and vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        &amp;lt;select onchange=&amp;quot;teammateSelectOnChange(this)&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;option value=&amp;quot;all&amp;quot;&amp;gt;All&amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;% @vmlist.select { |tm_vm| tm_vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; }.each do |tm_vm| %&amp;gt;&lt;br /&gt;
            &amp;lt;option value=&amp;quot;&amp;lt;%= tm_vm.reviewee_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;%= tm_vm.reviewee_name(session[:ip]) %&amp;gt;&lt;br /&gt;
            &amp;lt;/option&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
        &amp;lt;/select&amp;gt;&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;% first_teammate_review_appeared = true %&amp;gt;&lt;br /&gt;
    &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;lt;% if (vm.questionnaire_display_type == &amp;quot;Metareview&amp;quot; or vm.questionnaire_display_type == &amp;quot;Author Feedback&amp;quot;) and @current_role_name.eql?'Student' %&amp;gt;&lt;br /&gt;
    &amp;lt;% elsif (vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; and @current_role_name.eql?'Student' and !@assignment.show_teammate_reviews)%&amp;gt;&lt;br /&gt;
    &amp;lt;% elsif (vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; and @current_role_name.eql?'Student' and @assignment.show_teammate_reviews and current_user.id != vm.reviewee_id )%&amp;gt;&lt;br /&gt;
    &amp;lt;% else %&amp;gt;&lt;br /&gt;
        &amp;lt;% if vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
          &amp;lt;div class=&amp;quot;teammate_table&amp;quot; data-reviewee_id=&amp;quot;&amp;lt;%= vm.reviewee_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
        &amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
F.3 Old code &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
@@ -87,6 +131,8 @@&lt;br /&gt;
          &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
            &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
F.3 New code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- display the list of questions for this questionnaire --&amp;gt;&lt;br /&gt;
@@ -87,6 +131,8 @@&lt;br /&gt;
          &amp;lt;h4 style=&amp;quot;display:inline-block;&amp;quot;&amp;gt;&amp;lt;%= vm.questionnaire_display_type %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (Round: &amp;lt;%= vm.round.to_s  %&amp;gt; of &amp;lt;%= vm.rounds.to_s  %&amp;gt;)&lt;br /&gt;
            &amp;lt;% elsif vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                (For: &amp;lt;%= vm.reviewee_name(session[:ip]) %&amp;gt;)&lt;br /&gt;
            &amp;lt;%end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
F.4 Old code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_reviews.each do |review| %&amp;gt;&lt;br /&gt;
              &amp;lt;!-- instructors (or higher level users) see reviewer name, students see anonymized string --&amp;gt;&lt;br /&gt;
              &amp;lt;% if (['Student'].include? @current_role_name) &amp;amp;&amp;amp; @assignment.is_anonymous%&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i} %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                  &amp;lt;% user_name = User.find(Participant.find(ResponseMap.find(Response.find(review.id).map_id).reviewer_id).user_id).fullname(session[:ip]).to_s %&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i} %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% i += 1 %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-true&amp;quot; align=&amp;quot;right&amp;quot; &amp;gt;&lt;br /&gt;
            Avg&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-false&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;span  data-toggle=&amp;quot;tooltip&amp;quot; data-placement=&amp;quot;right&amp;quot; title=&amp;quot;A count of comments, for the respective question, which have word count &amp;gt; 10. The purpose of this metric is to represent how many comments for the question are of a substantial length to provide quality feedback.&amp;quot;&amp;gt;metric-1&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/thead&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
F.4 New code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_reviews.each do |review| %&amp;gt;&lt;br /&gt;
              &amp;lt;!-- instructors (or higher level users) see reviewer name, students see anonymized string --&amp;gt;&lt;br /&gt;
              &amp;lt;% if (['Student'].include? @current_role_name) &amp;amp;&amp;amp; @assignment.is_anonymous%&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i, questionnaire_type: vm.questionnaire_type } %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                &amp;lt;% user_name = User.find(Participant.find(ResponseMap.find(Response.find(review.id).map_id).reviewer_id).user_id).fullname(session[:ip]).to_s %&amp;gt;&lt;br /&gt;
                &amp;lt;%= render :partial =&amp;gt; 'add_icon_to_name', :locals =&amp;gt; {review: review, i: i, questionnaire_type: vm.questionnaire_type } %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% i += 1 %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
          &amp;lt;th class=&amp;quot;sorter-true&amp;quot; align=&amp;quot;right&amp;quot; &amp;gt;&lt;br /&gt;
            Avg&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/thead&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
F.5 Old code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_rows.each do |row| %&amp;gt;&lt;br /&gt;
            &amp;lt;!-- notice the data-target. because we're toggling via looped code, we need to dynamically generate the identifier. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr data-toggle=&amp;quot;collapse&amp;quot; class=&amp;quot;accordion-toggle&amp;quot; data-target=&amp;quot;#hid&amp;lt;%= row.question_id.to_s + vm.round.to_s %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;td class = 'cf' data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= row.question_text %&amp;gt;&amp;quot;&amp;gt; &amp;lt;div style='float: left'&amp;gt;&amp;lt;%= j.to_s %&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div style='float: right'&amp;gt; &amp;amp;#&amp;lt;%= type_and_max(row) %&amp;gt;;&amp;lt;/div&amp;gt;  &amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
              &amp;lt;!-- actual cells with scores and colored background. --&amp;gt;&lt;br /&gt;
              &amp;lt;% row.score_row.each do |score| %&amp;gt;&lt;br /&gt;
                  &amp;lt;% score_comment = score.comment.nil? ? '' : score.comment %&amp;gt; &amp;lt;!-- changing nil to null string to avoid Null Pointer Exception --&amp;gt;&lt;br /&gt;
                  &amp;lt;td class=&amp;quot;&amp;lt;%= score.color_code %&amp;gt;&amp;quot; align=&amp;quot;center&amp;quot; data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= strip_tags(score.comment).html_safe%&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;&amp;lt;%=  underlined?(score) %&amp;gt;&amp;quot;&amp;gt;&amp;lt;%= score.score_value.to_s %&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
                  &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
F.5 New code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% vm.list_of_rows.each do |row| %&amp;gt;&lt;br /&gt;
            &amp;lt;% target_id = &amp;quot;hid__#{row.question_id}__#{vm.round}&amp;quot; %&amp;gt;&lt;br /&gt;
            &amp;lt;% if vm.questionnaire_type == &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
              &amp;lt;%# Since we render different heatgrids with the same questions for each&lt;br /&gt;
              teammember, we need to distinguish the ID, based on the user for whom,&lt;br /&gt;
              the reviews have been created. %&amp;gt;&lt;br /&gt;
              &amp;lt;% target_id += &amp;quot;__#{vm.reviewee_id}&amp;quot; %&amp;gt;&lt;br /&gt;
            &amp;lt;% end%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;!-- notice the data-target. because we're toggling via looped code, we need to dynamically generate the identifier. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr data-toggle=&amp;quot;collapse&amp;quot; class=&amp;quot;accordion-toggle&amp;quot; data-target=&amp;quot;&amp;lt;%= &amp;quot;#&amp;quot; + target_id %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;td class = 'cf' data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= row.question_text %&amp;gt;&amp;quot;&amp;gt; &amp;lt;div style='float: left'&amp;gt;&amp;lt;%= j.to_s %&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div style='float: right'&amp;gt; &amp;amp;#&amp;lt;%= type_and_max(row) %&amp;gt;;&amp;lt;/div&amp;gt;  &amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
              &amp;lt;!-- actual cells with scores and colored background. --&amp;gt;&lt;br /&gt;
              &amp;lt;% row.score_row.each do |score| %&amp;gt;&lt;br /&gt;
                  &amp;lt;% score_comment = score.comment.nil? ? '' : score.comment %&amp;gt;&lt;br /&gt;
                  &amp;lt;!-- changing nil to null string to avoid Null Pointer Exception --&amp;gt;&lt;br /&gt;
                  &amp;lt;td class=&amp;quot;&amp;lt;%= score.color_code %&amp;gt;&amp;quot; align=&amp;quot;center&amp;quot; data-toggle=&amp;quot;tooltip&amp;quot; title=&amp;quot;&amp;lt;%= strip_tags(score.comment).html_safe%&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;&amp;lt;%=  underlined?(score) %&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                      &amp;lt;%= score.score_value.to_s %&amp;gt;&lt;br /&gt;
                    &amp;lt;/span&amp;gt;&lt;br /&gt;
                  &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
F.6 Removed the following code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 &amp;lt;td  class = 'cf' align=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;%= row.countofcomments.to_s %&amp;gt;&lt;br /&gt;
              &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
F.7 Old code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!--loop that creates the collapsed-by-default row, which lists all comments. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr class=&amp;quot;tablesorter-childRow&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;td colspan=&amp;quot;&amp;lt;%= (i+1).to_s %&amp;gt;&amp;quot; class=&amp;quot;hiddenRow&amp;quot; &amp;gt;&amp;lt;div id=&amp;quot;hid&amp;lt;%= row.question_id.to_s + vm.round.to_s %&amp;gt;&amp;quot; class=&amp;quot;accordion-body collapse&amp;quot; style=&amp;quot;margin-left:10px;&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;div style=&amp;quot;padding-top: 10px; padding-bottom: 10px;&amp;quot;&amp;gt;&amp;lt;%=  sanitize row.question_text %&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;div&amp;gt;&lt;br /&gt;
                  &amp;lt;table class=&amp;quot;table tbl_questlist&amp;quot;&amp;gt;&lt;br /&gt;
@@ -181,7 +233,17 @@&lt;br /&gt;
                    &amp;lt;/thead&amp;gt;&lt;br /&gt;
                    &amp;lt;% for index in 0 .. row.score_row.length - 1 %&amp;gt;&lt;br /&gt;
                        &amp;lt;tr&amp;gt;&lt;br /&gt;
                          &amp;lt;td&amp;gt;Review &amp;lt;%=index + 1%&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
F.7 New code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!--loop that creates the collapsed-by-default row, which lists all comments. --&amp;gt;&lt;br /&gt;
            &amp;lt;tr class=&amp;quot;tablesorter-childRow&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;td colspan=&amp;quot;&amp;lt;%= (i+1).to_s %&amp;gt;&amp;quot; class=&amp;quot;hiddenRow&amp;quot; &amp;gt;&amp;lt;div id=&amp;quot;&amp;lt;%= target_id %&amp;gt;&amp;quot; class=&amp;quot;accordion-body collapse&amp;quot; style=&amp;quot;margin-left:10px;&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;div style=&amp;quot;padding-top: 10px; padding-bottom: 10px;&amp;quot;&amp;gt;&amp;lt;%=  sanitize row.question_text %&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;div&amp;gt;&lt;br /&gt;
                  &amp;lt;table class=&amp;quot;table tbl_questlist&amp;quot;&amp;gt;&lt;br /&gt;
@@ -181,7 +233,17 @@&lt;br /&gt;
                    &amp;lt;/thead&amp;gt;&lt;br /&gt;
                    &amp;lt;% for index in 0 .. row.score_row.length - 1 %&amp;gt;&lt;br /&gt;
                        &amp;lt;tr&amp;gt;&lt;br /&gt;
                          &amp;lt;% if @current_role_name.eql?'Student' or vm.questionnaire_type != &amp;quot;TeammateReviewQuestionnaire&amp;quot; %&amp;gt;&lt;br /&gt;
                            &amp;lt;%# Use Review {{index}} format for student view, and&lt;br /&gt;
                            when questionnaire_type is not teammatereview %&amp;gt;&lt;br /&gt;
                            &amp;lt;td&amp;gt;Review &amp;lt;%=index + 1%&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
                          &amp;lt;% else %&amp;gt;&lt;br /&gt;
                            &amp;lt;td&amp;gt;&lt;br /&gt;
                              &amp;lt;% reviewer_id = row.score_row[index].reviewer_id %&amp;gt;&lt;br /&gt;
                              &amp;lt;% fullname = Participant.find_by(id: reviewer_id).fullname(session[:ip]) %&amp;gt;&lt;br /&gt;
                              Review by &amp;lt;%= fullname %&amp;gt;&lt;br /&gt;
                            &amp;lt;/td&amp;gt;&lt;br /&gt;
                          &amp;lt;% end%&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''G. In spec/controllers/grades_controller_spec.rb:'''&lt;br /&gt;
&lt;br /&gt;
G.1 Old code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
before(:each) do&lt;br /&gt;
  allow(AssignmentParticipant).to receive(:find).with('1').and_return(participant)&lt;br /&gt;
  allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
  stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
@@ -91,29 +90,106 @@&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
G.1 New code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
before(:each) do&lt;br /&gt;
  allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
  stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
@@ -91,29 +90,106 @@&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
G.2 Remove xdescribe '#view_team' and change describe '#view_team' as follows. Old code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#view_team' do&lt;br /&gt;
render_views&lt;br /&gt;
context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
  it 'renders grades#view_team page' do&lt;br /&gt;
    allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
    allow(AssignmentQuestionnaire).to receive(:find_by).with(assignment_id: 1, questionnaire_id: 1).and_return(assignment_questionnaire)&lt;br /&gt;
    allow(AssignmentQuestionnaire).to receive(:where).with(any_args).and_return([assignment_questionnaire])&lt;br /&gt;
    allow(assignment).to receive(:late_policy_id).and_return(false)&lt;br /&gt;
    allow(assignment).to receive(:calculate_penalty).and_return(false)&lt;br /&gt;
    allow(assignment).to receive(:compute_total_score).with(any_args).and_return(100)&lt;br /&gt;
    allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
    allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
    params = {id: 1}&lt;br /&gt;
    allow(TaMapping).to receive(:exists?).with(ta_id: 1, course_id: 1).and_return(true)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
G.2 New code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#view_team' do&lt;br /&gt;
render_views&lt;br /&gt;
&lt;br /&gt;
# All stubs and factories are instantiated within this scope so as to not &lt;br /&gt;
# clash with other broken test.&lt;br /&gt;
# The names of the factories created for testing view_team&lt;br /&gt;
# have `_vt` suffix ```where necessary``` to differentiate them from &lt;br /&gt;
# the above declared factories&lt;br /&gt;
&lt;br /&gt;
let(:student1_vt) { create(:student, name: &amp;quot;barry&amp;quot;, id: 12) }&lt;br /&gt;
let(:student2_vt) { create(:student, name: &amp;quot;iris&amp;quot;, id: 13) }&lt;br /&gt;
&lt;br /&gt;
let(:tm_questionnaire) {&lt;br /&gt;
  build(&lt;br /&gt;
    :teammate_review_questionnaire,&lt;br /&gt;
    id: 12,&lt;br /&gt;
    questions: [question],&lt;br /&gt;
    max_question_score: 5&lt;br /&gt;
  )&lt;br /&gt;
}&lt;br /&gt;
let(:assignment_vt) {&lt;br /&gt;
  create(:assignment, id: 6, max_team_size: 2,&lt;br /&gt;
  questionnaires: [tm_questionnaire])&lt;br /&gt;
}&lt;br /&gt;
let(:assignment_questionnaire_vt) {&lt;br /&gt;
  create(:tm_assignment_questionnaire, id: 12, used_in_round: nil,&lt;br /&gt;
  assignment: assignment_vt, questionnaire: tm_questionnaire) }&lt;br /&gt;
let(:team_vt) { create(:assignment_team, id: 12,&lt;br /&gt;
assignment: assignment_vt) }&lt;br /&gt;
let(:participant_vt) { create(:participant, id: 12,&lt;br /&gt;
  assignment: assignment_vt, user_id: student1_vt.id) }&lt;br /&gt;
let(:participant2_vt) { create(:participant, id: 13,&lt;br /&gt;
  assignment: assignment_vt, user_id: student2_vt.id) }&lt;br /&gt;
&lt;br /&gt;
before(:each) do&lt;br /&gt;
  # Need to stub this method so the factory instance with&lt;br /&gt;
  # the stubbed :team method is returned by :find&lt;br /&gt;
  # instead of a separate instance with the same data&lt;br /&gt;
  allow(AssignmentParticipant)&lt;br /&gt;
    .to receive(:find)&lt;br /&gt;
    .with(participant_vt.id.to_s)&lt;br /&gt;
    .and_return(participant_vt)&lt;br /&gt;
  allow(participant_vt).to receive(:team).and_return(team_vt)&lt;br /&gt;
  allow(team_vt).to receive(:participants).and_return([participant_vt, participant2_vt])&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:find_by)&lt;br /&gt;
    .with(assignment_id: assignment_vt.id, questionnaire_id: tm_questionnaire.id)&lt;br /&gt;
    .and_return(assignment_questionnaire_vt)&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:find_by)&lt;br /&gt;
    .with(assignment_id: assignment.id, questionnaire_id: review_questionnaire.id)&lt;br /&gt;
    .and_return(assignment_questionnaire_vt)&lt;br /&gt;
  allow(AssignmentQuestionnaire)&lt;br /&gt;
    .to receive(:where)&lt;br /&gt;
    .with(any_args)&lt;br /&gt;
    .and_return([assignment_questionnaire_vt])&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:late_policy_id)&lt;br /&gt;
    .and_return(false)&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:calculate_penalty)&lt;br /&gt;
    .and_return(false)&lt;br /&gt;
  allow(assignment_vt)&lt;br /&gt;
    .to receive(:compute_total_score)&lt;br /&gt;
    .with(any_args)&lt;br /&gt;
    .and_return(100)&lt;br /&gt;
  allow(review_questionnaire).to receive(:get_assessments_round_for).with(participant, 1).and_return([review_response])&lt;br /&gt;
  allow(Answer).to receive(:compute_scores).with([review_response], [question]).and_return(max: 95, min: 88, avg: 90)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
 it 'renders grades#view_team page' do&lt;br /&gt;
  params = {id: participant_vt.id}&lt;br /&gt;
  get :view_team, params&lt;br /&gt;
  expect(response).to render_template(:view_team)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is opened by student' do&lt;br /&gt;
  it 'dropdown is not rendered' do&lt;br /&gt;
    session = { user: student1_vt }&lt;br /&gt;
    params = {id: participant_vt.id}&lt;br /&gt;
    stub_current_user(student1_vt, student1_vt.role.name, student1_vt.role)&lt;br /&gt;
    get :view_team, params&lt;br /&gt;
    expect(response.body).to_not have_selector('select')&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is opened by instructor' do&lt;br /&gt;
  it 'dropdown is rendered' do&lt;br /&gt;
    session = { user: instructor }&lt;br /&gt;
    params = {id: participant_vt.id}&lt;br /&gt;
    get :view_team, params&lt;br /&gt;
    expect(response.body).to have_selector('select')&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
context 'when view_team page is viewed by a student who is also a TA for another course' do&lt;br /&gt;
  it 'renders grades#view_team page' do&lt;br /&gt;
    params = { id: participant_vt.id }&lt;br /&gt;
    allow(TaMapping).to receive(:exists?).with(ta_id: participant_vt.user_id, course_id: 1).and_return(true)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''H. In spec/factories/factories.rb:'''&lt;br /&gt;
&lt;br /&gt;
H.1 Add the following factory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
factory :teammate_review_questionnaire, class: TeammateReviewQuestionnaire do&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
H.2 Add another factory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
factory :tm_assignment_questionnaire, class: AssignmentQuestionnaire do&lt;br /&gt;
  user_id 1&lt;br /&gt;
  questionnaire { association(:teammate_review_questionnaire) }&lt;br /&gt;
  questionnaire_weight 100&lt;br /&gt;
  used_in_round nil&lt;br /&gt;
  topic_id nil&lt;br /&gt;
  dropdown 1&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Present Status of the application ==&lt;br /&gt;
&lt;br /&gt;
'''Image 1. Instructor's view of teammate review''': This is the current screen given to the instructor. Here we see that the instructor can not determine who has given which review to which student in a team.&lt;br /&gt;
&lt;br /&gt;
[[File:Instructor-view-1.png|border| 700px |center|alt=The proposed expanded student display.|The proposed expanded student display.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Image 2. Student's view of teammate review''': Currently, a student is not able to see what grades were given by their teammates. We need to implement that functionality so that the student is able to view those grades.&lt;br /&gt;
&lt;br /&gt;
[[File:Student-view-2.png|border| 700px |center|alt=The current instructor view.|The current review display for instructors.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Image 3. UML Diagram''': We are planning to add two variables namely showTeammateReview and hideReviewerName. showTeammateReview will decide whether the students would be able to view the reviews given to them by their teammates. hideReviewerName will decide whether the student is able to view the reviewee's name or not.&lt;br /&gt;
[[File:Uml-assignment.png|border|center|alt=The proposed condensed student display.|The proposed condensed student display.]]&lt;br /&gt;
&lt;br /&gt;
== Proposed changes ==&lt;br /&gt;
&lt;br /&gt;
1)''' Proposed UI for instructor ''': The instructor is able to see the score for all teammates. In the existing code, only one teammate's scores are being shown. But, we are planning to change the way the (VmQuestionResponse array is populated)[https://github.com/expertiza/expertiza/blob/master/app/controllers/grades_controller.rb#L114], so that the scores for all teammates are appended to it so it correctly shows what should have already been shown in this screen for the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Proposed_screen.png|border|700px|center|alt=Proposed UI for instructor|Proposed UI for instructor.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: When a student visits this screen, they will only be shown the reviews received by them, assuming the instructor has allowed visibility of teammate reviews to students.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2)''' Error in existing UI for student ''': In the existing UI for a student, the highlighted block should not be rendered. This part of the screen is meant for the instructors/TAs. This portion of the screen being rendered to a student is a mistake, and we will remove this part of the screen from the student's screen as part of our proposed changes.&lt;br /&gt;
&lt;br /&gt;
[[File:Wrong render for student.png|border|700px|center|alt=Existing UI for student|Existing UI for student.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3)''' Show teammate review to student UI ''': The existing code doesn't render a student's teammate review scores at all. We are planning to render the scores to a student (as shown below) when they visit this screen. However, the visibility of this screen is contingent on whether the instructor has allowed visibility of the teammate review screen to students. If the instructor has disabled this feature, then the heatgrid will not be displayed at all.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:UI_for_student.png|border|700px|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
=== Files to be modified ===&lt;br /&gt;
&lt;br /&gt;
In the current design plan, the following files are planned to be edited:&lt;br /&gt;
&lt;br /&gt;
1. app/controllers/grades_controller.rb - Controller file which will change how the view model is populated&lt;br /&gt;
&lt;br /&gt;
2. app/views/grades/view_team.html.erb - View file, which will conditionally render the teammate name, for a teammate review heatgrid&lt;br /&gt;
&lt;br /&gt;
3. spec/controllers/grades_controller_spec.rb - For tests verifying the proposed changes&lt;br /&gt;
&lt;br /&gt;
4. app/models/vm_question_response.rb - We need to modify the view-model so it can tell us the name of the person being reviewed for the current heatgrid&lt;br /&gt;
&lt;br /&gt;
Apart from these, there will be a schema change for the `Assignment` model, as we need to add the appropriate boolean flags&lt;br /&gt;
&lt;br /&gt;
== Design Patterns ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Existing code does not use any design patterns, apart from if-else. It uses if-else conditional statements to check what type of questionnaire is present in the viewmodel `VmQuestionResponse`, and based on that, it renders the appropriate content.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can use decorator pattern, for handling the visibility of the heatgrid when rendering heatgrids for a student login.&lt;br /&gt;
&lt;br /&gt;
== User Stories ==&lt;br /&gt;
&lt;br /&gt;
1. As an instructor, I can view what reviews one teammate has given to other teammates.&lt;br /&gt;
&lt;br /&gt;
2. As a student, I can view what reviews my teammates have given to me.&lt;br /&gt;
&lt;br /&gt;
3. As an instructor, I can select if a student's reviews are anonymously shown to their teammates.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
'''CURRENT STATUS'''&lt;br /&gt;
&lt;br /&gt;
1. Presently, the tests only cover if the view_team is page is rendered when it is asked for.&lt;br /&gt;
&lt;br /&gt;
[[File:current_testing_status.png|border|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''OUR PROPOSAL'''&lt;br /&gt;
&lt;br /&gt;
- When show_team is set as false by the professor, the student should not be able to see his scores.&lt;br /&gt;
&lt;br /&gt;
- When show_team is set as true by the professor, the student should be able to see his.&lt;br /&gt;
&lt;br /&gt;
- An instructor can select which student's scores he/she wants to see. If no student's name is selected then the professor can see the scores of all the students.&lt;br /&gt;
- The instructor can decide whether to show the names of the reviewer to the reviewer in teammate reviews, by selecting a checkbox for the same.&lt;br /&gt;
[[File:Untitled Diagram.drawio.png|border|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;https://expertiza.ncsu.edu/&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Agarg25</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141695</id>
		<title>CSC/ECE 517 Fall 2021 - E2165. Fix teammate-review view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141695"/>
		<updated>2021-11-28T00:50:49Z</updated>

		<summary type="html">&lt;p&gt;Agarg25: /* How to access the changes made*/&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Introduction ==&lt;br /&gt;
&lt;br /&gt;
Dr. Edward Gehringer (instructor), Parimal Mehta (mentor)&lt;br /&gt;
&lt;br /&gt;
1. Anjali Garg (unity ID : agarg25)&lt;br /&gt;
&lt;br /&gt;
2. Arvasu Chikara (unity ID: achikar2)&lt;br /&gt;
&lt;br /&gt;
3. Lalit Bangad (unity ID: llbangad)&lt;br /&gt;
&lt;br /&gt;
4. Vinay Deshmukh (unity ID: vdeshmu)&lt;br /&gt;
&lt;br /&gt;
== Problems to be addressed ==&lt;br /&gt;
&lt;br /&gt;
After a project is submitted and reviewed, both the team members (students) and instructors should be able to view the teammate reviews. Students should be able to view the reviews by going to a particular assignment's -&amp;gt; your scores, at the bottom of the page. An instructor can view the teammate reviews by going to assignments -&amp;gt; assignment -&amp;gt; particular team's submission -&amp;gt; view submission -&amp;gt; assign grades -&amp;gt; view scores. &lt;br /&gt;
&lt;br /&gt;
In the case of the instructor, a single heat grid is shown whereas in the case of a team member, we cant view the scores. In the heat grid, it is not clear if the scores visible are for the reviews that the student has *written* for their teammates or the scores that the student has *received* from their teammates. Additionally, for instructors can choose from a list of the students on the team, but they have no way to tell whether the heat grid shows the reviews done *by* that student or done *for* that student.&lt;br /&gt;
&lt;br /&gt;
== Methodology Overview ==&lt;br /&gt;
&lt;br /&gt;
We have divided our work in the following tasks to address the above problems:&lt;br /&gt;
&lt;br /&gt;
1. Distinguish reviews done for a student by rendering separates heatgrids for each student&lt;br /&gt;
&lt;br /&gt;
2. For instructors, the table will have sections based on the students&lt;br /&gt;
&lt;br /&gt;
3. Include a checkbox on the edit assignment page that enables/disables visibility of heat grid to students&lt;br /&gt;
&lt;br /&gt;
4. Fix the average column for a table (which breaks for some reviews)&lt;br /&gt;
&lt;br /&gt;
5. Show a composite score derived from all reviews.  Make this code generalized, so other kinds of heat grid views could use it.&lt;br /&gt;
&lt;br /&gt;
6. Changes should work even in an anonymized view&lt;br /&gt;
&lt;br /&gt;
== Motivations ==&lt;br /&gt;
&lt;br /&gt;
1. Enable users to clearly tell which reviews are done by them, and which reviews are done for them.&lt;br /&gt;
&lt;br /&gt;
2. Code should be generic so it can be used for different types of heat grids as well.&lt;br /&gt;
&lt;br /&gt;
== Control Flow to access the concerned screens ==&lt;br /&gt;
'''1. For instructor (Log in as an instructor):-'''&lt;br /&gt;
&lt;br /&gt;
Screen after logging in by the instructor&lt;br /&gt;
[[File:ss1.png |border|1000px|center]]&lt;br /&gt;
Got to assignments on the Manage menu &lt;br /&gt;
[[File:ss2.png |border|1000px|center]]&lt;br /&gt;
Go to assignments&lt;br /&gt;
[[File:ss3.png |border|1000px|center]]&lt;br /&gt;
Go to submissions for any assignment&lt;br /&gt;
[[File:ss4a.png |border|1000px|center]]&lt;br /&gt;
Go to Assign Grade&lt;br /&gt;
[[File:ss5a.png |border|1000px|center]]&lt;br /&gt;
You will land on the page where the changes are made and can be reviewed&lt;br /&gt;
[[File:ss7a.png |border|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
'''2. Student:- (Logged in as an instructor)'''&lt;br /&gt;
&lt;br /&gt;
After landing on the assignments page, select any student from an assignment as shown below&lt;br /&gt;
[[File:ss6a.png |border|1000px|center]]&lt;br /&gt;
Go to/Select any assignment&lt;br /&gt;
[[File:ss9a.png |border|1000px|center]]&lt;br /&gt;
Go to your scores&lt;br /&gt;
[[File:ss10a.png |border|1000px|center]]&lt;br /&gt;
You will land on the page where the changes are made and can be reviewed&lt;br /&gt;
[[File:ss11a.png |border|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
== Models used / Explanation of fixes ==&lt;br /&gt;
&lt;br /&gt;
The below diagram illustrates the proposed code change for showing all team members with the teammate review data to an instructor. The existing code only iterated on the `Participant` whose ID is present in the URL of the page. To fix this, we will iterate over all teammates of the given participant so that all teammate reviews for all team members are shown to the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Logic e2165.png|border|center|alt=Flow diagram of proposed changes for showing team review data to instructor]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Existing code:&lt;br /&gt;
&lt;br /&gt;
    questionnaires.each do |questionnaire|&lt;br /&gt;
      @round = nil&lt;br /&gt;
      if @assignment.vary_by_round &amp;amp;&amp;amp; questionnaire.type == &amp;quot;ReviewQuestionnaire&amp;quot;&lt;br /&gt;
        questionnaires = AssignmentQuestionnaire.where(assignment_id: @assignment.id, questionnaire_id: questionnaire.id)&lt;br /&gt;
        if questionnaires.count &amp;gt; 1&lt;br /&gt;
          @round = questionnaires[counter_for_same_rubric].used_in_round&lt;br /&gt;
          counter_for_same_rubric += 1&lt;br /&gt;
        else&lt;br /&gt;
          @round = questionnaires[0].used_in_round&lt;br /&gt;
          counter_for_same_rubric = 0&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      # line which is causing the issue&lt;br /&gt;
      @vmlist &amp;lt;&amp;lt; populate_view_model(@participant, questionnaire, @team)&lt;br /&gt;
    end&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Modified code (replace the line which is causing issues):&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      if questionnaire.display_type == &amp;quot;Teammate Review&amp;quot;&lt;br /&gt;
        # as teammate review will be different for each participant&lt;br /&gt;
        # we need to create a separate table for each teammate&lt;br /&gt;
        @participant.team.participants.each do |participant|&lt;br /&gt;
          @vmlist &amp;lt;&amp;lt; populate_view_model(participant, questionnaire, @team)&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        # only one participant needs iterating, as apart from teammatereview&lt;br /&gt;
        # all other reviews are at &amp;quot;team&amp;quot; level&lt;br /&gt;
        @vmlist &amp;lt;&amp;lt; populate_view_model(@participant, questionnaire, @team)&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
The `populate_view_model` method returns an instance of `VmQuestionResponse`. This model represents the data required to render the table along with it's metadata, like `list_of_reviews` which is used to render the rows.&lt;br /&gt;
&lt;br /&gt;
== Present Status of the application ==&lt;br /&gt;
&lt;br /&gt;
'''Image 1. Instructor's view of teammate review''': This is the current screen given to the instructor. Here we see that the instructor can not determine who has given which review to which student in a team.&lt;br /&gt;
&lt;br /&gt;
[[File:Instructor-view-1.png|border| 700px |center|alt=The proposed expanded student display.|The proposed expanded student display.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Image 2. Student's view of teammate review''': Currently, a student is not able to see what grades were given by their teammates. We need to implement that functionality so that the student is able to view those grades.&lt;br /&gt;
&lt;br /&gt;
[[File:Student-view-2.png|border| 700px |center|alt=The current instructor view.|The current review display for instructors.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Image 3. UML Diagram''': We are planning to add two variables namely showTeammateReview and hideReviewerName. showTeammateReview will decide whether the students would be able to view the reviews given to them by their teammates. hideReviewerName will decide whether the student is able to view the reviewee's name or not.&lt;br /&gt;
[[File:Uml-assignment.png|border|center|alt=The proposed condensed student display.|The proposed condensed student display.]]&lt;br /&gt;
&lt;br /&gt;
== Proposed changes ==&lt;br /&gt;
&lt;br /&gt;
1)''' Proposed UI for instructor ''': The instructor is able to see the score for all teammates. In the existing code, only one teammate's scores are being shown. But, we are planning to change the way the (VmQuestionResponse array is populated)[https://github.com/expertiza/expertiza/blob/master/app/controllers/grades_controller.rb#L114], so that the scores for all teammates are appended to it so it correctly shows what should have already been shown in this screen for the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Proposed_screen.png|border|700px|center|alt=Proposed UI for instructor|Proposed UI for instructor.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: When a student visits this screen, they will only be shown the reviews received by them, assuming the instructor has allowed visibility of teammate reviews to students.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2)''' Error in existing UI for student ''': In the existing UI for a student, the highlighted block should not be rendered. This part of the screen is meant for the instructors/TAs. This portion of the screen being rendered to a student is a mistake, and we will remove this part of the screen from the student's screen as part of our proposed changes.&lt;br /&gt;
&lt;br /&gt;
[[File:Wrong render for student.png|border|700px|center|alt=Existing UI for student|Existing UI for student.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3)''' Show teammate review to student UI ''': The existing code doesn't render a student's teammate review scores at all. We are planning to render the scores to a student (as shown below) when they visit this screen. However, the visibility of this screen is contingent on whether the instructor has allowed visibility of the teammate review screen to students. If the instructor has disabled this feature, then the heatgrid will not be displayed at all.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:UI_for_student.png|border|700px|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
=== Files to be modified ===&lt;br /&gt;
&lt;br /&gt;
In the current design plan, the following files are planned to be edited:&lt;br /&gt;
&lt;br /&gt;
1. app/controllers/grades_controller.rb - Controller file which will change how the view model is populated&lt;br /&gt;
&lt;br /&gt;
2. app/views/grades/view_team.html.erb - View file, which will conditionally render the teammate name, for a teammate review heatgrid&lt;br /&gt;
&lt;br /&gt;
3. spec/controllers/grades_controller_spec.rb - For tests verifying the proposed changes&lt;br /&gt;
&lt;br /&gt;
4. app/models/vm_question_response.rb - We need to modify the view-model so it can tell us the name of the person being reviewed for the current heatgrid&lt;br /&gt;
&lt;br /&gt;
Apart from these, there will be a schema change for the `Assignment` model, as we need to add the appropriate boolean flags&lt;br /&gt;
&lt;br /&gt;
== Design Patterns ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Existing code does not use any design patterns, apart from if-else. It uses if-else conditional statements to check what type of questionnaire is present in the viewmodel `VmQuestionResponse`, and based on that, it renders the appropriate content.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can use decorator pattern, for handling the visibility of the heatgrid when rendering heatgrids for a student login.&lt;br /&gt;
&lt;br /&gt;
== User Stories ==&lt;br /&gt;
&lt;br /&gt;
1. As an instructor, I can view what reviews one teammate has given to other teammates.&lt;br /&gt;
&lt;br /&gt;
2. As a student, I can view what reviews my teammates have given to me.&lt;br /&gt;
&lt;br /&gt;
3. As an instructor, I can select if a student's reviews are anonymously shown to their teammates.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
'''CURRENT STATUS'''&lt;br /&gt;
&lt;br /&gt;
1. Presently, the tests only cover if the view_team is page is rendered when it is asked for.&lt;br /&gt;
&lt;br /&gt;
[[File:current_testing_status.png|border|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''OUR PROPOSAL'''&lt;br /&gt;
&lt;br /&gt;
- When show_team is set as false by the professor, the student should not be able to see his scores.&lt;br /&gt;
&lt;br /&gt;
- When show_team is set as true by the professor, the student should be able to see his.&lt;br /&gt;
&lt;br /&gt;
- An instructor can select which student's scores he/she wants to see. If no student's name is selected then the professor can see the scores of all the students.&lt;br /&gt;
- The instructor can decide whether to show the names of the reviewer to the reviewer in teammate reviews, by selecting a checkbox for the same.&lt;br /&gt;
[[File:Untitled Diagram.drawio.png|border|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;https://expertiza.ncsu.edu/&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Agarg25</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Ss11a.png&amp;diff=141694</id>
		<title>File:Ss11a.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Ss11a.png&amp;diff=141694"/>
		<updated>2021-11-28T00:39:51Z</updated>

		<summary type="html">&lt;p&gt;Agarg25: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Agarg25</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Ss10a.png&amp;diff=141693</id>
		<title>File:Ss10a.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Ss10a.png&amp;diff=141693"/>
		<updated>2021-11-28T00:39:37Z</updated>

		<summary type="html">&lt;p&gt;Agarg25: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Agarg25</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Ss9a.png&amp;diff=141692</id>
		<title>File:Ss9a.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Ss9a.png&amp;diff=141692"/>
		<updated>2021-11-28T00:39:20Z</updated>

		<summary type="html">&lt;p&gt;Agarg25: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Agarg25</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Ss8a.png&amp;diff=141691</id>
		<title>File:Ss8a.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Ss8a.png&amp;diff=141691"/>
		<updated>2021-11-28T00:39:05Z</updated>

		<summary type="html">&lt;p&gt;Agarg25: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Agarg25</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Ss7a.png&amp;diff=141690</id>
		<title>File:Ss7a.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Ss7a.png&amp;diff=141690"/>
		<updated>2021-11-28T00:38:51Z</updated>

		<summary type="html">&lt;p&gt;Agarg25: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Agarg25</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Ss6a.png&amp;diff=141689</id>
		<title>File:Ss6a.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Ss6a.png&amp;diff=141689"/>
		<updated>2021-11-28T00:38:23Z</updated>

		<summary type="html">&lt;p&gt;Agarg25: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Agarg25</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Ss5a.png&amp;diff=141688</id>
		<title>File:Ss5a.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Ss5a.png&amp;diff=141688"/>
		<updated>2021-11-28T00:32:27Z</updated>

		<summary type="html">&lt;p&gt;Agarg25: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Agarg25</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Ss4a.png&amp;diff=141687</id>
		<title>File:Ss4a.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Ss4a.png&amp;diff=141687"/>
		<updated>2021-11-28T00:32:09Z</updated>

		<summary type="html">&lt;p&gt;Agarg25: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Agarg25</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Ss3.png&amp;diff=141686</id>
		<title>File:Ss3.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Ss3.png&amp;diff=141686"/>
		<updated>2021-11-28T00:31:34Z</updated>

		<summary type="html">&lt;p&gt;Agarg25: Agarg25 uploaded a new version of File:Ss3.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;DropOffSite Snapshot3&lt;/div&gt;</summary>
		<author><name>Agarg25</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Ss2.png&amp;diff=141685</id>
		<title>File:Ss2.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Ss2.png&amp;diff=141685"/>
		<updated>2021-11-28T00:31:12Z</updated>

		<summary type="html">&lt;p&gt;Agarg25: Agarg25 uploaded a new version of File:Ss2.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;DropOffSite Snapshot2&lt;/div&gt;</summary>
		<author><name>Agarg25</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Ss1.png&amp;diff=141684</id>
		<title>File:Ss1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Ss1.png&amp;diff=141684"/>
		<updated>2021-11-28T00:30:51Z</updated>

		<summary type="html">&lt;p&gt;Agarg25: Agarg25 uploaded a new version of File:Ss1.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;DropOffSite Snapshot1&lt;/div&gt;</summary>
		<author><name>Agarg25</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141683</id>
		<title>CSC/ECE 517 Fall 2021 - E2165. Fix teammate-review view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141683"/>
		<updated>2021-11-27T23:49:29Z</updated>

		<summary type="html">&lt;p&gt;Agarg25: /* Control Flow to access the concerned screens */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Introduction ==&lt;br /&gt;
&lt;br /&gt;
Dr. Edward Gehringer (instructor), Parimal Mehta (mentor)&lt;br /&gt;
&lt;br /&gt;
1. Anjali Garg (unity ID : agarg25)&lt;br /&gt;
&lt;br /&gt;
2. Arvasu Chikara (unity ID: achikar2)&lt;br /&gt;
&lt;br /&gt;
3. Lalit Bangad (unity ID: llbangad)&lt;br /&gt;
&lt;br /&gt;
4. Vinay Deshmukh (unity ID: vdeshmu)&lt;br /&gt;
&lt;br /&gt;
== Problems to be addressed ==&lt;br /&gt;
&lt;br /&gt;
After a project is submitted and reviewed, both the team members (students) and instructors should be able to view the teammate reviews. Students should be able to view the reviews by going to a particular assignment's -&amp;gt; your scores, at the bottom of the page. An instructor can view the teammate reviews by going to assignments -&amp;gt; assignment -&amp;gt; particular team's submission -&amp;gt; view submission -&amp;gt; assign grades -&amp;gt; view scores. &lt;br /&gt;
&lt;br /&gt;
In the case of the instructor, a single heat grid is shown whereas in the case of a team member, we cant view the scores. In the heat grid, it is not clear if the scores visible are for the reviews that the student has *written* for their teammates or the scores that the student has *received* from their teammates. Additionally, for instructors can choose from a list of the students on the team, but they have no way to tell whether the heat grid shows the reviews done *by* that student or done *for* that student.&lt;br /&gt;
&lt;br /&gt;
== Methodology Overview ==&lt;br /&gt;
&lt;br /&gt;
We have divided our work in the following tasks to address the above problems:&lt;br /&gt;
&lt;br /&gt;
1. Distinguish reviews done for a student by rendering separates heatgrids for each student&lt;br /&gt;
&lt;br /&gt;
2. For instructors, the table will have sections based on the students&lt;br /&gt;
&lt;br /&gt;
3. Include a checkbox on the edit assignment page that enables/disables visibility of heat grid to students&lt;br /&gt;
&lt;br /&gt;
4. Fix the average column for a table (which breaks for some reviews)&lt;br /&gt;
&lt;br /&gt;
5. Show a composite score derived from all reviews.  Make this code generalized, so other kinds of heat grid views could use it.&lt;br /&gt;
&lt;br /&gt;
6. Changes should work even in an anonymized view&lt;br /&gt;
&lt;br /&gt;
== Motivations ==&lt;br /&gt;
&lt;br /&gt;
1. Enable users to clearly tell which reviews are done by them, and which reviews are done for them.&lt;br /&gt;
&lt;br /&gt;
2. Code should be generic so it can be used for different types of heat grids as well.&lt;br /&gt;
&lt;br /&gt;
== Control Flow to access the concerned screens ==&lt;br /&gt;
'''1. Instructor:-'''&lt;br /&gt;
&lt;br /&gt;
Screen after logging in by instructor&lt;br /&gt;
[[File:Instructor-1.png |border|700px|center|alt=Flow diagram of proposed changes for showing team review data to instructor]]&lt;br /&gt;
Click on view submissions&lt;br /&gt;
[[File:Instructor-2.png |border|700px|center|alt=Flow diagram of proposed changes for showing team review data to instructor]]&lt;br /&gt;
Then click on assign grade &lt;br /&gt;
[[File:Instructor-3.png |border|700px|center|alt=Flow diagram of proposed changes for showing team review data to instructor]]&lt;br /&gt;
Here the prospective changes would be made&lt;br /&gt;
[[File:Instructor-4.png |border|700px|center|alt=Flow diagram of proposed changes for showing team review data to instructor]]&lt;br /&gt;
&lt;br /&gt;
'''2. Student:-'''&lt;br /&gt;
&lt;br /&gt;
Click on the particular project&lt;br /&gt;
[[File:Student-2.png |border|700px|center|alt=Flow diagram of proposed changes for showing team review data to instructor]]&lt;br /&gt;
Then click on your scores&lt;br /&gt;
[[File:Student-3.png |border|700px|center|alt=Flow diagram of proposed changes for showing team review data to instructor]]&lt;br /&gt;
Here the prospective changes would be made&lt;br /&gt;
[[File:Student-4.png |border|700px|center|alt=Flow diagram of proposed changes for showing team review data to instructor]]&lt;br /&gt;
&lt;br /&gt;
== Models used / Explanation of fixes ==&lt;br /&gt;
&lt;br /&gt;
The below diagram illustrates the proposed code change for showing all team members with the teammate review data to an instructor. The existing code only iterated on the `Participant` whose ID is present in the URL of the page. To fix this, we will iterate over all teammates of the given participant so that all teammate reviews for all team members are shown to the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Logic e2165.png|border|center|alt=Flow diagram of proposed changes for showing team review data to instructor]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Existing code:&lt;br /&gt;
&lt;br /&gt;
    questionnaires.each do |questionnaire|&lt;br /&gt;
      @round = nil&lt;br /&gt;
      if @assignment.vary_by_round &amp;amp;&amp;amp; questionnaire.type == &amp;quot;ReviewQuestionnaire&amp;quot;&lt;br /&gt;
        questionnaires = AssignmentQuestionnaire.where(assignment_id: @assignment.id, questionnaire_id: questionnaire.id)&lt;br /&gt;
        if questionnaires.count &amp;gt; 1&lt;br /&gt;
          @round = questionnaires[counter_for_same_rubric].used_in_round&lt;br /&gt;
          counter_for_same_rubric += 1&lt;br /&gt;
        else&lt;br /&gt;
          @round = questionnaires[0].used_in_round&lt;br /&gt;
          counter_for_same_rubric = 0&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      # line which is causing the issue&lt;br /&gt;
      @vmlist &amp;lt;&amp;lt; populate_view_model(@participant, questionnaire, @team)&lt;br /&gt;
    end&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Modified code (replace the line which is causing issues):&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      if questionnaire.display_type == &amp;quot;Teammate Review&amp;quot;&lt;br /&gt;
        # as teammate review will be different for each participant&lt;br /&gt;
        # we need to create a separate table for each teammate&lt;br /&gt;
        @participant.team.participants.each do |participant|&lt;br /&gt;
          @vmlist &amp;lt;&amp;lt; populate_view_model(participant, questionnaire, @team)&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        # only one participant needs iterating, as apart from teammatereview&lt;br /&gt;
        # all other reviews are at &amp;quot;team&amp;quot; level&lt;br /&gt;
        @vmlist &amp;lt;&amp;lt; populate_view_model(@participant, questionnaire, @team)&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
The `populate_view_model` method returns an instance of `VmQuestionResponse`. This model represents the data required to render the table along with it's metadata, like `list_of_reviews` which is used to render the rows.&lt;br /&gt;
&lt;br /&gt;
== Present Status of the application ==&lt;br /&gt;
&lt;br /&gt;
'''Image 1. Instructor's view of teammate review''': This is the current screen given to the instructor. Here we see that the instructor can not determine who has given which review to which student in a team.&lt;br /&gt;
&lt;br /&gt;
[[File:Instructor-view-1.png|border| 700px |center|alt=The proposed expanded student display.|The proposed expanded student display.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Image 2. Student's view of teammate review''': Currently, a student is not able to see what grades were given by their teammates. We need to implement that functionality so that the student is able to view those grades.&lt;br /&gt;
&lt;br /&gt;
[[File:Student-view-2.png|border| 700px |center|alt=The current instructor view.|The current review display for instructors.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Image 3. UML Diagram''': We are planning to add two variables namely showTeammateReview and hideReviewerName. showTeammateReview will decide whether the students would be able to view the reviews given to them by their teammates. hideReviewerName will decide whether the student is able to view the reviewee's name or not.&lt;br /&gt;
[[File:Uml-assignment.png|border|center|alt=The proposed condensed student display.|The proposed condensed student display.]]&lt;br /&gt;
&lt;br /&gt;
== Proposed changes ==&lt;br /&gt;
&lt;br /&gt;
1)''' Proposed UI for instructor ''': The instructor is able to see the score for all teammates. In the existing code, only one teammate's scores are being shown. But, we are planning to change the way the (VmQuestionResponse array is populated)[https://github.com/expertiza/expertiza/blob/master/app/controllers/grades_controller.rb#L114], so that the scores for all teammates are appended to it so it correctly shows what should have already been shown in this screen for the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Proposed_screen.png|border|700px|center|alt=Proposed UI for instructor|Proposed UI for instructor.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: When a student visits this screen, they will only be shown the reviews received by them, assuming the instructor has allowed visibility of teammate reviews to students.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2)''' Error in existing UI for student ''': In the existing UI for a student, the highlighted block should not be rendered. This part of the screen is meant for the instructors/TAs. This portion of the screen being rendered to a student is a mistake, and we will remove this part of the screen from the student's screen as part of our proposed changes.&lt;br /&gt;
&lt;br /&gt;
[[File:Wrong render for student.png|border|700px|center|alt=Existing UI for student|Existing UI for student.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3)''' Show teammate review to student UI ''': The existing code doesn't render a student's teammate review scores at all. We are planning to render the scores to a student (as shown below) when they visit this screen. However, the visibility of this screen is contingent on whether the instructor has allowed visibility of the teammate review screen to students. If the instructor has disabled this feature, then the heatgrid will not be displayed at all.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:UI_for_student.png|border|700px|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
=== Files to be modified ===&lt;br /&gt;
&lt;br /&gt;
In the current design plan, the following files are planned to be edited:&lt;br /&gt;
&lt;br /&gt;
1. app/controllers/grades_controller.rb - Controller file which will change how the view model is populated&lt;br /&gt;
&lt;br /&gt;
2. app/views/grades/view_team.html.erb - View file, which will conditionally render the teammate name, for a teammate review heatgrid&lt;br /&gt;
&lt;br /&gt;
3. spec/controllers/grades_controller_spec.rb - For tests verifying the proposed changes&lt;br /&gt;
&lt;br /&gt;
4. app/models/vm_question_response.rb - We need to modify the view-model so it can tell us the name of the person being reviewed for the current heatgrid&lt;br /&gt;
&lt;br /&gt;
Apart from these, there will be a schema change for the `Assignment` model, as we need to add the appropriate boolean flags&lt;br /&gt;
&lt;br /&gt;
== Design Patterns ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Existing code does not use any design patterns, apart from if-else. It uses if-else conditional statements to check what type of questionnaire is present in the viewmodel `VmQuestionResponse`, and based on that, it renders the appropriate content.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can use decorator pattern, for handling the visibility of the heatgrid when rendering heatgrids for a student login.&lt;br /&gt;
&lt;br /&gt;
== User Stories ==&lt;br /&gt;
&lt;br /&gt;
1. As an instructor, I can view what reviews one teammate has given to other teammates.&lt;br /&gt;
&lt;br /&gt;
2. As a student, I can view what reviews my teammates have given to me.&lt;br /&gt;
&lt;br /&gt;
3. As an instructor, I can select if a student's reviews are anonymously shown to their teammates.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
'''CURRENT STATUS'''&lt;br /&gt;
&lt;br /&gt;
1. Presently, the tests only cover if the view_team is page is rendered when it is asked for.&lt;br /&gt;
&lt;br /&gt;
[[File:current_testing_status.png|border|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''OUR PROPOSAL'''&lt;br /&gt;
&lt;br /&gt;
- When show_team is set as false by the professor, the student should not be able to see his scores.&lt;br /&gt;
&lt;br /&gt;
- When show_team is set as true by the professor, the student should be able to see his.&lt;br /&gt;
&lt;br /&gt;
- An instructor can select which student's scores he/she wants to see. If no student's name is selected then the professor can see the scores of all the students.&lt;br /&gt;
- The instructor can decide whether to show the names of the reviewer to the reviewer in teammate reviews, by selecting a checkbox for the same.&lt;br /&gt;
[[File:Untitled Diagram.drawio.png|border|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;https://expertiza.ncsu.edu/&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Agarg25</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141682</id>
		<title>CSC/ECE 517 Fall 2021 - E2165. Fix teammate-review view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141682"/>
		<updated>2021-11-27T23:48:45Z</updated>

		<summary type="html">&lt;p&gt;Agarg25: /* Control Flow to access the concerned screens */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Introduction ==&lt;br /&gt;
&lt;br /&gt;
Dr. Edward Gehringer (instructor), Parimal Mehta (mentor)&lt;br /&gt;
&lt;br /&gt;
1. Anjali Garg (unity ID : agarg25)&lt;br /&gt;
&lt;br /&gt;
2. Arvasu Chikara (unity ID: achikar2)&lt;br /&gt;
&lt;br /&gt;
3. Lalit Bangad (unity ID: llbangad)&lt;br /&gt;
&lt;br /&gt;
4. Vinay Deshmukh (unity ID: vdeshmu)&lt;br /&gt;
&lt;br /&gt;
== Problems to be addressed ==&lt;br /&gt;
&lt;br /&gt;
After a project is submitted and reviewed, both the team members (students) and instructors should be able to view the teammate reviews. Students should be able to view the reviews by going to a particular assignment's -&amp;gt; your scores, at the bottom of the page. An instructor can view the teammate reviews by going to assignments -&amp;gt; assignment -&amp;gt; particular team's submission -&amp;gt; view submission -&amp;gt; assign grades -&amp;gt; view scores. &lt;br /&gt;
&lt;br /&gt;
In the case of the instructor, a single heat grid is shown whereas in the case of a team member, we cant view the scores. In the heat grid, it is not clear if the scores visible are for the reviews that the student has *written* for their teammates or the scores that the student has *received* from their teammates. Additionally, for instructors can choose from a list of the students on the team, but they have no way to tell whether the heat grid shows the reviews done *by* that student or done *for* that student.&lt;br /&gt;
&lt;br /&gt;
== Methodology Overview ==&lt;br /&gt;
&lt;br /&gt;
We have divided our work in the following tasks to address the above problems:&lt;br /&gt;
&lt;br /&gt;
1. Distinguish reviews done for a student by rendering separates heatgrids for each student&lt;br /&gt;
&lt;br /&gt;
2. For instructors, the table will have sections based on the students&lt;br /&gt;
&lt;br /&gt;
3. Include a checkbox on the edit assignment page that enables/disables visibility of heat grid to students&lt;br /&gt;
&lt;br /&gt;
4. Fix the average column for a table (which breaks for some reviews)&lt;br /&gt;
&lt;br /&gt;
5. Show a composite score derived from all reviews.  Make this code generalized, so other kinds of heat grid views could use it.&lt;br /&gt;
&lt;br /&gt;
6. Changes should work even in an anonymized view&lt;br /&gt;
&lt;br /&gt;
== Motivations ==&lt;br /&gt;
&lt;br /&gt;
1. Enable users to clearly tell which reviews are done by them, and which reviews are done for them.&lt;br /&gt;
&lt;br /&gt;
2. Code should be generic so it can be used for different types of heat grids as well.&lt;br /&gt;
&lt;br /&gt;
== Control Flow to access the concerned screens ==&lt;br /&gt;
1. Instructor:-&lt;br /&gt;
&lt;br /&gt;
Screen after logging in by instructor&lt;br /&gt;
[[File:Instructor-1.png |border|700px|center|alt=Flow diagram of proposed changes for showing team review data to instructor]]&lt;br /&gt;
Click on view submissions&lt;br /&gt;
[[File:Instructor-2.png |border|700px|center|alt=Flow diagram of proposed changes for showing team review data to instructor]]&lt;br /&gt;
Then click on assign grade &lt;br /&gt;
[[File:Instructor-3.png |border|700px|center|alt=Flow diagram of proposed changes for showing team review data to instructor]]&lt;br /&gt;
Here the prospective changes would be made&lt;br /&gt;
[[File:Instructor-4.png |border|700px|center|alt=Flow diagram of proposed changes for showing team review data to instructor]]&lt;br /&gt;
&lt;br /&gt;
2. Student:-&lt;br /&gt;
&lt;br /&gt;
Click on the particular project&lt;br /&gt;
[[File:Student-2.png |border|700px|center|alt=Flow diagram of proposed changes for showing team review data to instructor]]&lt;br /&gt;
Then click on your scores&lt;br /&gt;
[[File:Student-3.png |border|700px|center|alt=Flow diagram of proposed changes for showing team review data to instructor]]&lt;br /&gt;
Here the prospective changes would be made&lt;br /&gt;
[[File:Student-4.png |border|700px|center|alt=Flow diagram of proposed changes for showing team review data to instructor]]&lt;br /&gt;
&lt;br /&gt;
== Models used / Explanation of fixes ==&lt;br /&gt;
&lt;br /&gt;
The below diagram illustrates the proposed code change for showing all team members with the teammate review data to an instructor. The existing code only iterated on the `Participant` whose ID is present in the URL of the page. To fix this, we will iterate over all teammates of the given participant so that all teammate reviews for all team members are shown to the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Logic e2165.png|border|center|alt=Flow diagram of proposed changes for showing team review data to instructor]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Existing code:&lt;br /&gt;
&lt;br /&gt;
    questionnaires.each do |questionnaire|&lt;br /&gt;
      @round = nil&lt;br /&gt;
      if @assignment.vary_by_round &amp;amp;&amp;amp; questionnaire.type == &amp;quot;ReviewQuestionnaire&amp;quot;&lt;br /&gt;
        questionnaires = AssignmentQuestionnaire.where(assignment_id: @assignment.id, questionnaire_id: questionnaire.id)&lt;br /&gt;
        if questionnaires.count &amp;gt; 1&lt;br /&gt;
          @round = questionnaires[counter_for_same_rubric].used_in_round&lt;br /&gt;
          counter_for_same_rubric += 1&lt;br /&gt;
        else&lt;br /&gt;
          @round = questionnaires[0].used_in_round&lt;br /&gt;
          counter_for_same_rubric = 0&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      # line which is causing the issue&lt;br /&gt;
      @vmlist &amp;lt;&amp;lt; populate_view_model(@participant, questionnaire, @team)&lt;br /&gt;
    end&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Modified code (replace the line which is causing issues):&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      if questionnaire.display_type == &amp;quot;Teammate Review&amp;quot;&lt;br /&gt;
        # as teammate review will be different for each participant&lt;br /&gt;
        # we need to create a separate table for each teammate&lt;br /&gt;
        @participant.team.participants.each do |participant|&lt;br /&gt;
          @vmlist &amp;lt;&amp;lt; populate_view_model(participant, questionnaire, @team)&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        # only one participant needs iterating, as apart from teammatereview&lt;br /&gt;
        # all other reviews are at &amp;quot;team&amp;quot; level&lt;br /&gt;
        @vmlist &amp;lt;&amp;lt; populate_view_model(@participant, questionnaire, @team)&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
The `populate_view_model` method returns an instance of `VmQuestionResponse`. This model represents the data required to render the table along with it's metadata, like `list_of_reviews` which is used to render the rows.&lt;br /&gt;
&lt;br /&gt;
== Present Status of the application ==&lt;br /&gt;
&lt;br /&gt;
'''Image 1. Instructor's view of teammate review''': This is the current screen given to the instructor. Here we see that the instructor can not determine who has given which review to which student in a team.&lt;br /&gt;
&lt;br /&gt;
[[File:Instructor-view-1.png|border| 700px |center|alt=The proposed expanded student display.|The proposed expanded student display.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Image 2. Student's view of teammate review''': Currently, a student is not able to see what grades were given by their teammates. We need to implement that functionality so that the student is able to view those grades.&lt;br /&gt;
&lt;br /&gt;
[[File:Student-view-2.png|border| 700px |center|alt=The current instructor view.|The current review display for instructors.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Image 3. UML Diagram''': We are planning to add two variables namely showTeammateReview and hideReviewerName. showTeammateReview will decide whether the students would be able to view the reviews given to them by their teammates. hideReviewerName will decide whether the student is able to view the reviewee's name or not.&lt;br /&gt;
[[File:Uml-assignment.png|border|center|alt=The proposed condensed student display.|The proposed condensed student display.]]&lt;br /&gt;
&lt;br /&gt;
== Proposed changes ==&lt;br /&gt;
&lt;br /&gt;
1)''' Proposed UI for instructor ''': The instructor is able to see the score for all teammates. In the existing code, only one teammate's scores are being shown. But, we are planning to change the way the (VmQuestionResponse array is populated)[https://github.com/expertiza/expertiza/blob/master/app/controllers/grades_controller.rb#L114], so that the scores for all teammates are appended to it so it correctly shows what should have already been shown in this screen for the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Proposed_screen.png|border|700px|center|alt=Proposed UI for instructor|Proposed UI for instructor.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: When a student visits this screen, they will only be shown the reviews received by them, assuming the instructor has allowed visibility of teammate reviews to students.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2)''' Error in existing UI for student ''': In the existing UI for a student, the highlighted block should not be rendered. This part of the screen is meant for the instructors/TAs. This portion of the screen being rendered to a student is a mistake, and we will remove this part of the screen from the student's screen as part of our proposed changes.&lt;br /&gt;
&lt;br /&gt;
[[File:Wrong render for student.png|border|700px|center|alt=Existing UI for student|Existing UI for student.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3)''' Show teammate review to student UI ''': The existing code doesn't render a student's teammate review scores at all. We are planning to render the scores to a student (as shown below) when they visit this screen. However, the visibility of this screen is contingent on whether the instructor has allowed visibility of the teammate review screen to students. If the instructor has disabled this feature, then the heatgrid will not be displayed at all.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:UI_for_student.png|border|700px|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
=== Files to be modified ===&lt;br /&gt;
&lt;br /&gt;
In the current design plan, the following files are planned to be edited:&lt;br /&gt;
&lt;br /&gt;
1. app/controllers/grades_controller.rb - Controller file which will change how the view model is populated&lt;br /&gt;
&lt;br /&gt;
2. app/views/grades/view_team.html.erb - View file, which will conditionally render the teammate name, for a teammate review heatgrid&lt;br /&gt;
&lt;br /&gt;
3. spec/controllers/grades_controller_spec.rb - For tests verifying the proposed changes&lt;br /&gt;
&lt;br /&gt;
4. app/models/vm_question_response.rb - We need to modify the view-model so it can tell us the name of the person being reviewed for the current heatgrid&lt;br /&gt;
&lt;br /&gt;
Apart from these, there will be a schema change for the `Assignment` model, as we need to add the appropriate boolean flags&lt;br /&gt;
&lt;br /&gt;
== Design Patterns ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Existing code does not use any design patterns, apart from if-else. It uses if-else conditional statements to check what type of questionnaire is present in the viewmodel `VmQuestionResponse`, and based on that, it renders the appropriate content.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can use decorator pattern, for handling the visibility of the heatgrid when rendering heatgrids for a student login.&lt;br /&gt;
&lt;br /&gt;
== User Stories ==&lt;br /&gt;
&lt;br /&gt;
1. As an instructor, I can view what reviews one teammate has given to other teammates.&lt;br /&gt;
&lt;br /&gt;
2. As a student, I can view what reviews my teammates have given to me.&lt;br /&gt;
&lt;br /&gt;
3. As an instructor, I can select if a student's reviews are anonymously shown to their teammates.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
'''CURRENT STATUS'''&lt;br /&gt;
&lt;br /&gt;
1. Presently, the tests only cover if the view_team is page is rendered when it is asked for.&lt;br /&gt;
&lt;br /&gt;
[[File:current_testing_status.png|border|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''OUR PROPOSAL'''&lt;br /&gt;
&lt;br /&gt;
- When show_team is set as false by the professor, the student should not be able to see his scores.&lt;br /&gt;
&lt;br /&gt;
- When show_team is set as true by the professor, the student should be able to see his.&lt;br /&gt;
&lt;br /&gt;
- An instructor can select which student's scores he/she wants to see. If no student's name is selected then the professor can see the scores of all the students.&lt;br /&gt;
- The instructor can decide whether to show the names of the reviewer to the reviewer in teammate reviews, by selecting a checkbox for the same.&lt;br /&gt;
[[File:Untitled Diagram.drawio.png|border|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;https://expertiza.ncsu.edu/&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Agarg25</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141403</id>
		<title>CSC/ECE 517 Fall 2021 - E2165. Fix teammate-review view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141403"/>
		<updated>2021-11-09T02:51:26Z</updated>

		<summary type="html">&lt;p&gt;Agarg25: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Introduction ==&lt;br /&gt;
&lt;br /&gt;
Dr. Edward Gehringer (instructor), Parimal Mehta (mentor)&lt;br /&gt;
&lt;br /&gt;
1. Lalit Bangad (unity ID: llbangad)&lt;br /&gt;
&lt;br /&gt;
2. Vinay Deshmukh (unity ID: vdeshmu)&lt;br /&gt;
&lt;br /&gt;
3. Arvasu Chikara (unity ID: achikar2)&lt;br /&gt;
&lt;br /&gt;
4. Anjali Garg (unity ID : agarg25)   &lt;br /&gt;
&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
== Problems to be addressed ==&lt;br /&gt;
&lt;br /&gt;
After a project is submitted and reviewed, both the team members (students) and instructors should be able to view the teammate reviews. Students should be able to view the reviews by going to a particular assignment's -&amp;gt; your scores, at the bottom of the page. An instructor can view the teammate reviews by going to assignments -&amp;gt; assignment -&amp;gt; particular team's submission -&amp;gt; view submission -&amp;gt; assign grades -&amp;gt; view scores. &lt;br /&gt;
&lt;br /&gt;
In the case of the instructor, a single heat grid is shown whereas in the case of a team member, we cant view the scores. In the heat grid, it is not clear if the scores visible are for the reviews that the student has *written* for their teammates or the scores that the student has *received* from their teammates. Additionally, for instructors can choose from a list of the students on the team, but they have no way to tell whether the heat grid shows the reviews done *by* that student or done *for* that student.&lt;br /&gt;
&lt;br /&gt;
== Methodology Overview ==&lt;br /&gt;
&lt;br /&gt;
We have divided our work in the following tasks to address the above problems:&lt;br /&gt;
&lt;br /&gt;
1. Distinguish reviews done for a student by rendering separates heatgrids for each student&lt;br /&gt;
&lt;br /&gt;
2. For instructors, the table will have sections based on the students&lt;br /&gt;
&lt;br /&gt;
3. Include a checkbox on the edit assignment page that enables/disables visibility of heat grid to students&lt;br /&gt;
&lt;br /&gt;
4. Fix the average column for a table (which breaks for some reviews)&lt;br /&gt;
&lt;br /&gt;
5. Show a composite score derived from all reviews.  Make this code generalized, so other kinds of heat grid views could use it.&lt;br /&gt;
&lt;br /&gt;
6. Changes should work even in an anonymized view&lt;br /&gt;
&lt;br /&gt;
== Motivations ==&lt;br /&gt;
&lt;br /&gt;
1. Enable users to clearly tell which reviews are done by them, and which reviews are done for them.&lt;br /&gt;
&lt;br /&gt;
2. Code should be generic so it can be used for different types of heat grids as well.&lt;br /&gt;
&lt;br /&gt;
== Control Flow to access the concerned screens ==&lt;br /&gt;
&lt;br /&gt;
== Models used / Explanation of fixes ==&lt;br /&gt;
&lt;br /&gt;
The below diagram illustrates the proposed code change for showing all team members with the teammate review data to an instructor. The existing code only iterated on the `Participant` whose ID is present in the URL of the page. To fix this, we will iterate over all teammates of the given participant so that all teammate reviews for all team members are shown to the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Logic e2165.png|border|center|alt=Flow diagram of proposed changes for showing team review data to instructor]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Existing code:&lt;br /&gt;
&lt;br /&gt;
    questionnaires.each do |questionnaire|&lt;br /&gt;
      @round = nil&lt;br /&gt;
      if @assignment.vary_by_round &amp;amp;&amp;amp; questionnaire.type == &amp;quot;ReviewQuestionnaire&amp;quot;&lt;br /&gt;
        questionnaires = AssignmentQuestionnaire.where(assignment_id: @assignment.id, questionnaire_id: questionnaire.id)&lt;br /&gt;
        if questionnaires.count &amp;gt; 1&lt;br /&gt;
          @round = questionnaires[counter_for_same_rubric].used_in_round&lt;br /&gt;
          counter_for_same_rubric += 1&lt;br /&gt;
        else&lt;br /&gt;
          @round = questionnaires[0].used_in_round&lt;br /&gt;
          counter_for_same_rubric = 0&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      # line which is causing the issue&lt;br /&gt;
      @vmlist &amp;lt;&amp;lt; populate_view_model(@participant, questionnaire, @team)&lt;br /&gt;
    end&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Modified code (replace the line which is causing issues):&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      if questionnaire.display_type == &amp;quot;Teammate Review&amp;quot;&lt;br /&gt;
        # as teammate review will be different for each participant&lt;br /&gt;
        # we need to create a separate table for each teammate&lt;br /&gt;
        @participant.team.participants.each do |participant|&lt;br /&gt;
          @vmlist &amp;lt;&amp;lt; populate_view_model(participant, questionnaire, @team)&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        # only one participant needs iterating, as apart from teammatereview&lt;br /&gt;
        # all other reviews are at &amp;quot;team&amp;quot; level&lt;br /&gt;
        @vmlist &amp;lt;&amp;lt; populate_view_model(@participant, questionnaire, @team)&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
The `populate_view_model` method returns an instance of `VmQuestionResponse`. This model represents the data required to render the table along with it's metadata, like `list_of_reviews` which is used to render the rows.&lt;br /&gt;
&lt;br /&gt;
== Present Status of the application ==&lt;br /&gt;
&lt;br /&gt;
'''Image 1. Instructor's view of teammate review''': This is the current screen given to the instructor. Here we see that the instructor can not determine who has given which review to which student in a team.&lt;br /&gt;
&lt;br /&gt;
[[File:Instructor-view-1.png|border|center|alt=The proposed expanded student display.|The proposed expanded student display.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Image 2. Student's view of teammate review''': Currently, a student is not able to see what grades were given by their teammates. We need to implement that functionality so that the student is able to view those grades.&lt;br /&gt;
&lt;br /&gt;
[[File:Student-view-2.png|border|center|alt=The current instructor view.|The current review display for instructors.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Image 3. UML Diagram''': We are planning to add two variables namely showTeammateReview and hideReviewerName. showTeammateReview will decide whether the students would be able to view the reviews given to them by their teammates. hideReviewerName will decide whether the student is able to view the reviewee's name or not.&lt;br /&gt;
[[File:Uml-assignment.png|border|center|alt=The proposed condensed student display.|The proposed condensed student display.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Proposed changes ==&lt;br /&gt;
&lt;br /&gt;
1)''' Proposed UI for instructor ''': The instructor is able to see the score for all teammates. In the existing code, only one teammate's scores are being shown. But, we are planning to change the way the (VmQuestionResponse array is populated)[https://github.com/expertiza/expertiza/blob/master/app/controllers/grades_controller.rb#L114], so that the scores for all teammates are appended to it so it correctly shows what should have already been shown in this screen for the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Proposed_screen.png|border|center|alt=Proposed UI for instructor|Proposed UI for instructor.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: When a student visits this screen, they will only be shown the reviews received by them, assuming the instructor has allowed visibility of teammate reviews to students.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2)''' Error in existing UI for student ''': In the existing UI for a student, the highlighted block should not be rendered. This part of the screen is meant for the instructors/TAs. This portion of the screen being rendered to a student is a mistake, and we will remove this part of the screen from the student's screen as part of our proposed changes.&lt;br /&gt;
&lt;br /&gt;
[[File:Wrong render for student.png|border|center|alt=Existing UI for student|Existing UI for student.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3)''' Show teammate review to student UI ''': The existing code doesn't render a student's teammate review scores at all. We are planning to render the scores to a student (as shown below) when they visit this screen. However, the visibility of this screen is contingent on whether the instructor has allowed visibility of the teammate review screen to students. If the instructor has disabled this feature, then the heatgrid will not be displayed at all.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:UI_for_student.png|border|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
=== Files to be modified ===&lt;br /&gt;
&lt;br /&gt;
In the current design plan, the following files are planned to be edited:&lt;br /&gt;
&lt;br /&gt;
1. app/controllers/grades_controller.rb - Controller file which will change how the view model is populated&lt;br /&gt;
&lt;br /&gt;
2. app/views/grades/view_team.html.erb - View file, which will conditionally render the teammate name, for a teammate review heatgrid&lt;br /&gt;
&lt;br /&gt;
3. spec/controllers/grades_controller_spec.rb - For tests verifying the proposed changes&lt;br /&gt;
&lt;br /&gt;
4. app/models/vm_question_response.rb - We need to modify the view-model so it can tell us the name of the person being reviewed for the current heatgrid&lt;br /&gt;
&lt;br /&gt;
Apart from these, there will be a schema change for the `Assignment` model, as we need to add the appropriate boolean flags&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Design Patterns ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Existing code does not use any design patterns, apart from if-else. It uses if-else conditional statements to check what type of questionnaire is present in the viewmodel `VmQuestionResponse`, and based on that, it renders the appropriate content.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can use decorator pattern, for handling the visibility of the heatgrid when rendering heatgrids for a student login.&lt;br /&gt;
&lt;br /&gt;
== User Stories ==&lt;br /&gt;
&lt;br /&gt;
1. As an instructor, I can view what reviews one teammate has given to other teammates.&lt;br /&gt;
&lt;br /&gt;
2. As a student, I can view what reviews my teammates have given to me.&lt;br /&gt;
&lt;br /&gt;
3. As an instructor, I can select if a student's reviews are anonymously shown to their teammates.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
'''CURRENT STATUS'''&lt;br /&gt;
&lt;br /&gt;
1. Presently, the tests only cover if the view_team is page is rendered when it is asked for.&lt;br /&gt;
&lt;br /&gt;
[[File:current_testing_status.png|border|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''OUR PROPOSAL'''&lt;br /&gt;
&lt;br /&gt;
- When show_team is set as false by the professor, the student should not be able to see his scores.&lt;br /&gt;
&lt;br /&gt;
- When show_team is set as true by the professor, the student should be able to see his.&lt;br /&gt;
&lt;br /&gt;
- An instructor can select which student's scores he/she wants to see. If no student's name is selected then the professor can see the scores of all the students.&lt;br /&gt;
- The instructor can decide whether to show the names of the reviewer to the reviewer in teammate reviews, by selecting a checkbox for the same.&lt;br /&gt;
[[File:Untitled Diagram.drawio.png|border|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;https://expertiza.ncsu.edu/&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Agarg25</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141396</id>
		<title>CSC/ECE 517 Fall 2021 - E2165. Fix teammate-review view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141396"/>
		<updated>2021-11-09T02:46:07Z</updated>

		<summary type="html">&lt;p&gt;Agarg25: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Introduction ==&lt;br /&gt;
&lt;br /&gt;
Dr. Edward Gehringer (instructor), Parimal Mehta (mentor)&lt;br /&gt;
&lt;br /&gt;
1. Lalit Bangad (unity ID: llbangad)&lt;br /&gt;
&lt;br /&gt;
2. Vinay Deshmukh (unity ID: vdeshmu)&lt;br /&gt;
&lt;br /&gt;
3. Arvasu Chikara (unity ID: achikar2)&lt;br /&gt;
&lt;br /&gt;
4. Anjali Garg (unity ID : agarg25)   &lt;br /&gt;
&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
== Problems to be addressed ==&lt;br /&gt;
&lt;br /&gt;
After a project is submitted and reviewed, both the team members (students) and instructors should be able to view the teammate reviews. Students should be able to view the reviews by going to a particular assignment's -&amp;gt; your scores, at the bottom of the page. An instructor can view the teammate reviews by going to assignments -&amp;gt; assignment -&amp;gt; particular team's submission -&amp;gt; view submission -&amp;gt; assign grades -&amp;gt; view scores. &lt;br /&gt;
&lt;br /&gt;
In the case of the instructor, a single heat grid is shown whereas in the case of a team member, we cant view the scores. In the heat grid, it is not clear if the scores visible are for the reviews that the student has *written* for their teammates or the scores that the student has *received* from their teammates. Additionally, for instructors can choose from a list of the students on the team, but they have no way to tell whether the heat grid shows the reviews done *by* that student or done *for* that student.&lt;br /&gt;
&lt;br /&gt;
== Methodology Overview ==&lt;br /&gt;
&lt;br /&gt;
We have divided our work in the following tasks to address the above problems:&lt;br /&gt;
&lt;br /&gt;
1. Distinguish reviews done for a student by rendering separates heatgrids for each student&lt;br /&gt;
&lt;br /&gt;
2. For instructors, the table will have sections based on the students&lt;br /&gt;
&lt;br /&gt;
3. Include a checkbox on the edit assignment page that enables/disables visibility of heat grid to students&lt;br /&gt;
&lt;br /&gt;
4. Fix the average column for a table (which breaks for some reviews)&lt;br /&gt;
&lt;br /&gt;
5. Show a composite score derived from all reviews.  Make this code generalized, so other kinds of heat grid views could use it.&lt;br /&gt;
&lt;br /&gt;
6. Changes should work even in an anonymized view&lt;br /&gt;
&lt;br /&gt;
== Motivations ==&lt;br /&gt;
&lt;br /&gt;
1. Enable users to clearly tell which reviews are done by them, and which reviews are done for them.&lt;br /&gt;
&lt;br /&gt;
2. Code should be generic so it can be used for different types of heat grids as well.&lt;br /&gt;
&lt;br /&gt;
== Control Flow to access the concerned screens ==&lt;br /&gt;
&lt;br /&gt;
== Models used / Explanation of fixes ==&lt;br /&gt;
&lt;br /&gt;
The below diagram illustrates the proposed code change for showing all team members with the teammate review data to an instructor. The existing code only iterated on the `Participant` whose ID is present in the URL of the page. To fix this, we will iterate over all teammates of the given participant so that all teammate reviews for all team members are shown to the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Logic e2165.png|border|center|alt=Flow diagram of proposed changes for showing team review data to instructor]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Existing code:&lt;br /&gt;
&lt;br /&gt;
    questionnaires.each do |questionnaire|&lt;br /&gt;
      @round = nil&lt;br /&gt;
      if @assignment.vary_by_round &amp;amp;&amp;amp; questionnaire.type == &amp;quot;ReviewQuestionnaire&amp;quot;&lt;br /&gt;
        questionnaires = AssignmentQuestionnaire.where(assignment_id: @assignment.id, questionnaire_id: questionnaire.id)&lt;br /&gt;
        if questionnaires.count &amp;gt; 1&lt;br /&gt;
          @round = questionnaires[counter_for_same_rubric].used_in_round&lt;br /&gt;
          counter_for_same_rubric += 1&lt;br /&gt;
        else&lt;br /&gt;
          @round = questionnaires[0].used_in_round&lt;br /&gt;
          counter_for_same_rubric = 0&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      # line which is causing the issue&lt;br /&gt;
      @vmlist &amp;lt;&amp;lt; populate_view_model(@participant, questionnaire, @team)&lt;br /&gt;
    end&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Modified code (replace the line which is causing issues):&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      if questionnaire.display_type == &amp;quot;Teammate Review&amp;quot;&lt;br /&gt;
        # as teammate review will be different for each participant&lt;br /&gt;
        # we need to create a separate table for each teammate&lt;br /&gt;
        @participant.team.participants.each do |participant|&lt;br /&gt;
          @vmlist &amp;lt;&amp;lt; populate_view_model(participant, questionnaire, @team)&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        # only one participant needs iterating, as apart from teammatereview&lt;br /&gt;
        # all other reviews are at &amp;quot;team&amp;quot; level&lt;br /&gt;
        @vmlist &amp;lt;&amp;lt; populate_view_model(@participant, questionnaire, @team)&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Image 1. Instructor's view of teammate review'''&lt;br /&gt;
[[File:Instructor-view-1.png|border|center|alt=The proposed expanded student display.|The proposed expanded student display.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The `populate_view_model` returns an instance of `VmQuestionResponse`. This model represents the data required to render the table along with it's metadata, like `list_of_reviews` which is used to render the rows.&lt;br /&gt;
&lt;br /&gt;
== Present Status of the application ==&lt;br /&gt;
&lt;br /&gt;
'''Image 1. Instructor's view of teammate review''': This is the current screen given to the instructor. Here we see that the instructor can not determine who has given which review to which student.&lt;br /&gt;
&lt;br /&gt;
[[File:Instructor-view-1.png|border|center|alt=The proposed expanded student display.|The proposed expanded student display.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Image 2. Student's view of teammate review''': Currently, a student is not able to see what grades were given by their teammates. We need to implement that functionality so that the student is able to view the grades.&lt;br /&gt;
&lt;br /&gt;
[[File:Student-view-2.png|border|center|alt=The current instructor view.|The current review display for instructors.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Image 3. UML Diagram''': We are planning to add two variables namely showTeammateReview and hideReviewerName. showTeammateReview will decide whether the students would be able to view their team members reviews. hideReviewerName will decide whether the student is able to view peer's names or not.&lt;br /&gt;
[[File:Uml-assignment.png|border|center|alt=The proposed condensed student display.|The proposed condensed student display.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Proposed changes ==&lt;br /&gt;
&lt;br /&gt;
1)''' Proposed UI for instructor ''': The instructor is able to see the score for all teammates. In the existing code, only one teammate's scores are being shown. But, we are planning to change the way the (VmQuestionResponse array is populated)[https://github.com/expertiza/expertiza/blob/master/app/controllers/grades_controller.rb#L114], so that the scores for all teammates are appended to it so it correctly shows what should have already been shown in this screen for the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Proposed_screen.png|border|center|alt=Proposed UI for instructor|Proposed UI for instructor.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: When a student visits this screen, they will only be shown the reviews received by them, assuming the instructor has allowed visibility of teammate reviews to students.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2)''' Error in existing UI for student ''': In the existing UI for a student, the highlighted block should not be rendered. This part of the screen is meant for the instructors/TAs. This portion of the screen being rendered to a student is a mistake, and we will remove this part of the screen from the student's screen as part of our proposed changes.&lt;br /&gt;
&lt;br /&gt;
[[File:Wrong render for student.png|border|center|alt=Existing UI for student|Existing UI for student.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3)''' Show teammate review to student UI ''': The existing code doesn't render a student's teammate review scores at all. We are planning to render the scores to a student when they visit this screen. However, the visibility of this screen is contingent on whether the instructor has allowed visibility of the teammate review screen to students. If the instructor has disabled this feature, then the heatgrid will not be displayed at all.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:UI_for_student.png|border|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
=== Files to be modified ===&lt;br /&gt;
&lt;br /&gt;
In the current design plan, the following files are planned to be edited:&lt;br /&gt;
&lt;br /&gt;
1. app/controllers/grades_controller.rb - Controller file which will change how the view model is populated&lt;br /&gt;
2. app/views/grades/view_team.html.erb - View file, which will conditionally render the teammate name, for a teammate review heatgrid&lt;br /&gt;
3. spec/controllers/grades_controller_spec.rb - For tests verifying the proposed changes&lt;br /&gt;
4. app/models/vm_question_response.rb - We need to modify the view-model so it can tell us the name of the person being reviewed for the current heatgrid&lt;br /&gt;
&lt;br /&gt;
Apart from these, there will be a schema change for the `Assignment` model, as we need to add the appropriate boolean flags&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Design Patterns ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Existing code does not use any design patterns, apart from if-else. It uses if-else conditional statements to check what type of questionnaire is present in the viewmodel `VmQuestionResponse`, and based on that, it renders the appropriate content.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can use decorator pattern, for handling the visibility of the heatgrid when rendering heatgrids for a student login.&lt;br /&gt;
&lt;br /&gt;
== User Stories ==&lt;br /&gt;
&lt;br /&gt;
1. As an instructor, I can view what reviews one teammate has given to other teammates.&lt;br /&gt;
&lt;br /&gt;
2. As a student, I can view what reviews my teammates have given to me.&lt;br /&gt;
&lt;br /&gt;
3. As an instructor, I can select if a student's reviews are anonymously shown to their teammates.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
'''CURRENT STATUS'''&lt;br /&gt;
&lt;br /&gt;
1. Presently, the tests only cover if the view_team is page is rendered when it is asked for.&lt;br /&gt;
&lt;br /&gt;
[[File:current_testing_status.png|border|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''OUR PROPOSAL'''&lt;br /&gt;
&lt;br /&gt;
- When show_team is set as false by the professor, the student should not be able to see his scores.&lt;br /&gt;
&lt;br /&gt;
- When show_team is set as true by the professor, the student should be able to see his.&lt;br /&gt;
&lt;br /&gt;
- An instructor can select which student's scores he/she wants to see. If no student's name is selected then the professor can see the scores of all the students.&lt;br /&gt;
- The instructor can decide whether to show the names of the reviewer to the reviewer in teammate reviews, by selecting a checkbox for the same.&lt;br /&gt;
[[File:Untitled Diagram.drawio.png|border|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;https://expertiza.ncsu.edu/&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Agarg25</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141389</id>
		<title>CSC/ECE 517 Fall 2021 - E2165. Fix teammate-review view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141389"/>
		<updated>2021-11-09T02:38:52Z</updated>

		<summary type="html">&lt;p&gt;Agarg25: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Introduction ==&lt;br /&gt;
&lt;br /&gt;
Dr. Edward Gehringer (instructor), Parimal Mehta (mentor)&lt;br /&gt;
&lt;br /&gt;
1. Lalit Bangad (unity ID: llbangad)&lt;br /&gt;
&lt;br /&gt;
2. Vinay Deshmukh (unity ID: vdeshmu)&lt;br /&gt;
&lt;br /&gt;
3. Arvasu Chikara (unity ID: achikar2)&lt;br /&gt;
&lt;br /&gt;
4. Anjali Garg (unity ID : agarg25)   &lt;br /&gt;
&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
== Problems to be addressed ==&lt;br /&gt;
&lt;br /&gt;
After a project is submitted and reviewed, both the team members (students) and instructors should be able to view the teammate reviews. Students should be able to view the reviews by going to a particular assignment's -&amp;gt; your scores, at the bottom of the page. An instructor can view the teammate reviews by going to assignments -&amp;gt; assignment -&amp;gt; particular team's submission -&amp;gt; view submission -&amp;gt; assign grades -&amp;gt; view scores. &lt;br /&gt;
&lt;br /&gt;
In the case of the instructor, a single heat grid is shown whereas in the case of a team member, we cant view the scores. In the heat grid, it is not clear if the scores visible are for the reviews that the student has *written* for their teammates or the scores that the student has *received* from their teammates. Additionally, for instructors can choose from a list of the students on the team, but they have no way to tell whether the heat grid shows the reviews done *by* that student or done *for* that student.&lt;br /&gt;
&lt;br /&gt;
== Methodology Overview ==&lt;br /&gt;
&lt;br /&gt;
We have divided our work in the following tasks to address the above problems:&lt;br /&gt;
&lt;br /&gt;
1. Distinguish reviews done for a student by rendering separates heatgrids for each student&lt;br /&gt;
&lt;br /&gt;
2. For instructors, the table will have sections based on the students&lt;br /&gt;
&lt;br /&gt;
3. Include a checkbox on the edit assignment page that enables/disables visibility of heat grid to students&lt;br /&gt;
&lt;br /&gt;
4. Fix the average column for a table (which breaks for some reviews)&lt;br /&gt;
&lt;br /&gt;
5. Show a composite score derived from all reviews.  Make this code generalized, so other kinds of heat grid views could use it.&lt;br /&gt;
&lt;br /&gt;
6. Changes should work even in an anonymized view&lt;br /&gt;
&lt;br /&gt;
== Motivations ==&lt;br /&gt;
&lt;br /&gt;
1. Enable users to clearly tell which reviews are done by them, and which reviews are done for them.&lt;br /&gt;
&lt;br /&gt;
2. Code should be generic so it can be used for different types of heat grids as well.&lt;br /&gt;
&lt;br /&gt;
== Control Flow to access the concerned screens ==&lt;br /&gt;
&lt;br /&gt;
== Models used / Explanation of fixes ==&lt;br /&gt;
&lt;br /&gt;
The below diagram illustrates the proposed code change for showing all team members with the teammate review data to an instructor. The existing code only iterated on the `Participant` whose ID is present in the URL of the page. To fix this, we will iterate over all teammates of the given participant so that all teammate reviews for all team members are shown to the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Logic e2165.png|border|center|alt=Flow diagram of proposed changes for showing team review data to instructor]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Existing code:&lt;br /&gt;
&lt;br /&gt;
    questionnaires.each do |questionnaire|&lt;br /&gt;
      @round = nil&lt;br /&gt;
      if @assignment.vary_by_round &amp;amp;&amp;amp; questionnaire.type == &amp;quot;ReviewQuestionnaire&amp;quot;&lt;br /&gt;
        questionnaires = AssignmentQuestionnaire.where(assignment_id: @assignment.id, questionnaire_id: questionnaire.id)&lt;br /&gt;
        if questionnaires.count &amp;gt; 1&lt;br /&gt;
          @round = questionnaires[counter_for_same_rubric].used_in_round&lt;br /&gt;
          counter_for_same_rubric += 1&lt;br /&gt;
        else&lt;br /&gt;
          @round = questionnaires[0].used_in_round&lt;br /&gt;
          counter_for_same_rubric = 0&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      # line which is causing the issue&lt;br /&gt;
      @vmlist &amp;lt;&amp;lt; populate_view_model(@participant, questionnaire, @team)&lt;br /&gt;
    end&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Modified code (replace the line which is causing issues):&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      if questionnaire.display_type == &amp;quot;Teammate Review&amp;quot;&lt;br /&gt;
        # as teammate review will be different for each participant&lt;br /&gt;
        # we need to create a separate table for each teammate&lt;br /&gt;
        @participant.team.participants.each do |participant|&lt;br /&gt;
          @vmlist &amp;lt;&amp;lt; populate_view_model(participant, questionnaire, @team)&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        # only one participant needs iterating, as apart from teammatereview&lt;br /&gt;
        # all other reviews are at &amp;quot;team&amp;quot; level&lt;br /&gt;
        @vmlist &amp;lt;&amp;lt; populate_view_model(@participant, questionnaire, @team)&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Image 1. Instructor's view of teammate review'''&lt;br /&gt;
[[File:Instructor-view-1.png|border|center|alt=The proposed expanded student display.|The proposed expanded student display.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The `populate_view_model` returns an instance of `VmQuestionResponse`. This model represents the data required to render the table along with it's metadata, like `list_of_reviews` which is used to render the rows.&lt;br /&gt;
&lt;br /&gt;
== Present Status of the application ==&lt;br /&gt;
&lt;br /&gt;
'''Image 1. Instructor's view of teammate review''': This is the current screen given to the instructor. Here we see that the instructor can not determine who has given which review to which student.&lt;br /&gt;
&lt;br /&gt;
[[File:Instructor-view-1.png|border|center|alt=The proposed expanded student display.|The proposed expanded student display.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Image 2. Student's view of teammate review''': Currently, a student is not able to see what grades were given by their teammates. We need to implement that functionality so that the student is able to view the grades.&lt;br /&gt;
&lt;br /&gt;
[[File:Student-view-2.png|border|center|alt=The current instructor view.|The current review display for instructors.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Image 3. UML Diagram''': We are planning to add two variables namely showTeammateReview and hideReviewerName. showTeammateReview will decide whether the students would be able to view their team members reviews. hideReviewerName will decide whether the student is able to view peer's names or not.&lt;br /&gt;
[[File:Uml-assignment.png|border|center|alt=The proposed condensed student display.|The proposed condensed student display.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Proposed changes ==&lt;br /&gt;
&lt;br /&gt;
1)''' Proposed UI for instructor ''': The instructor is able to see the score for all teammates. In the existing code, only one teammate's scores are being shown. But, we are planning to change the way the (VmQuestionResponse array is populated)[https://github.com/expertiza/expertiza/blob/master/app/controllers/grades_controller.rb#L114], so that the scores for all teammates are appended to it so it correctly shows what should have already been shown in this screen for the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Proposed_screen.png|border|center|alt=Proposed UI for instructor|Proposed UI for instructor.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: When a student visits this screen, they will only be shown the reviews received by them, assuming the instructor has allowed visibility of teammate reviews to students.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2)''' Error in existing UI for student ''': In the existing UI for a student, the highlighted block should not be rendered. This part of the screen is meant for the instructors/TAs. This portion of the screen being rendered to a student is a mistake, and we will remove this part of the screen from the student's screen as part of our proposed changes.&lt;br /&gt;
&lt;br /&gt;
[[File:Wrong render for student.png|border|center|alt=Existing UI for student|Existing UI for student.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3)''' Show teammate review to student UI ''': The existing code doesn't render a student's teammate review scores at all. We are planning to render the scores to a student when they visit this screen. However, the visibility of this screen is contingent on whether the instructor has allowed visibility of the teammate review screen to students. If the instructor has disabled this feature, then the heatgrid will not be displayed at all.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:UI_for_student.png|border|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
== Design Patterns ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Existing code does not use any design patterns, apart from if-else. It uses if-else conditional statements to check what type of questionnaire is present in the viewmodel `VmQuestionResponse`, and based on that, it renders the appropriate content.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can use decorator pattern, for handling the visibility of the heatgrid when rendering heatgrids for a student login.&lt;br /&gt;
&lt;br /&gt;
== User Stories ==&lt;br /&gt;
&lt;br /&gt;
1. As an instructor, I can view what reviews one teammate has given to other teammates.&lt;br /&gt;
&lt;br /&gt;
2. As a student, I can view what reviews my teammates have given to me.&lt;br /&gt;
&lt;br /&gt;
3. As an instructor, I can select if a student's reviews are anonymously shown to their teammates.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
'''CURRENT STATUS'''&lt;br /&gt;
&lt;br /&gt;
1. Presently, the tests only cover if the view_team is page is rendered when it is asked for.&lt;br /&gt;
&lt;br /&gt;
[[File:current_testing_status.png|border|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''OUR PROPOSAL'''&lt;br /&gt;
&lt;br /&gt;
1. For a student:&lt;br /&gt;
&lt;br /&gt;
- When show_team is set as false, the student should not be able to see his scores.&lt;br /&gt;
&lt;br /&gt;
- When show_team is set as true, the student should be able to see his scores.&lt;br /&gt;
&lt;br /&gt;
2. For instructor:&lt;br /&gt;
&lt;br /&gt;
- Should be able to see all the scores by default.&lt;br /&gt;
&lt;br /&gt;
- The instructor can decide whether to show the names of the reviewer to the reviewer in teammate reviews, by selecting a checkbox for the same.&lt;br /&gt;
[[File:Untitled Diagram.drawio.png|border|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;https://expertiza.ncsu.edu/&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Agarg25</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Untitled_Diagram.drawio-2.png&amp;diff=141380</id>
		<title>File:Untitled Diagram.drawio-2.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Untitled_Diagram.drawio-2.png&amp;diff=141380"/>
		<updated>2021-11-09T02:12:16Z</updated>

		<summary type="html">&lt;p&gt;Agarg25: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Agarg25</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141379</id>
		<title>CSC/ECE 517 Fall 2021 - E2165. Fix teammate-review view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141379"/>
		<updated>2021-11-09T02:12:03Z</updated>

		<summary type="html">&lt;p&gt;Agarg25: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Introduction ==&lt;br /&gt;
&lt;br /&gt;
Dr. Edward Gehringer (instructor), Parimal Mehta (mentor)&lt;br /&gt;
&lt;br /&gt;
1. Lalit Bangad (unity ID: llbangad)&lt;br /&gt;
&lt;br /&gt;
2. Vinay Deshmukh (unity ID: vdeshmu)&lt;br /&gt;
&lt;br /&gt;
3. Arvasu Chikara (unity ID: achikar2)&lt;br /&gt;
&lt;br /&gt;
4. Anjali Garg (unity ID : agarg25)   &lt;br /&gt;
&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
== Problems to be addressed ==&lt;br /&gt;
&lt;br /&gt;
After a project is submitted and reviewed, both the team members (students) and instructors should be able to view the teammate reviews. Students should be able to view the reviews by going to a particular assignment's -&amp;gt; your scores, at the bottom of the page. An instructor can view the teammate reviews by going to assignments -&amp;gt; assignment -&amp;gt; particular team's submission -&amp;gt; view submission -&amp;gt; assign grades -&amp;gt; view scores. &lt;br /&gt;
&lt;br /&gt;
In the case of the instructor, a single heat grid is shown whereas in the case of a team member, we cant view the scores. In the heat grid, it is not clear if the scores visible are for the reviews that the student has *written* for their teammates or the scores that the student has *received* from their teammates. Additionally, for instructors can choose from a list of the students on the team, but they have no way to tell whether the heat grid shows the reviews done *by* that student or done *for* that student.&lt;br /&gt;
&lt;br /&gt;
== Methodology Overview ==&lt;br /&gt;
&lt;br /&gt;
We have divided our work in the following tasks to address the above problems:&lt;br /&gt;
&lt;br /&gt;
1. Distinguish reviews done for a student by rendering separates heatgrids for each student&lt;br /&gt;
&lt;br /&gt;
2. For instructors, the table will have sections based on the students&lt;br /&gt;
&lt;br /&gt;
3. Include a checkbox on the edit assignment page that enables/disables visibility of heat grid to students&lt;br /&gt;
&lt;br /&gt;
4. Fix the average column for a table (which breaks for some reviews)&lt;br /&gt;
&lt;br /&gt;
5. Show a composite score derived from all reviews.  Make this code generalized, so other kinds of heat grid views could use it.&lt;br /&gt;
&lt;br /&gt;
6. Changes should work even in an anonymized view&lt;br /&gt;
&lt;br /&gt;
== Motivations ==&lt;br /&gt;
&lt;br /&gt;
1. Enable users to clearly tell which reviews are done by them, and which reviews are done for them.&lt;br /&gt;
&lt;br /&gt;
2. Code should be generic so it can be used for different types of heat grids as well.&lt;br /&gt;
&lt;br /&gt;
== Control Flow to access the concerned screens ==&lt;br /&gt;
&lt;br /&gt;
== Models used / Explanation of fixes ==&lt;br /&gt;
&lt;br /&gt;
The below diagram illustrates the proposed code change for showing all team members with the teammate review data to an instructor. The existing code only iterated on the `Participant` whose ID is present in the URL of the page. To fix this, we will iterate over all teammates of the given participant so that all teammate reviews for all team members are shown to the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Logic e2165.png|border|center|alt=Flow diagram of proposed changes for showing team review data to instructor]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Existing code:&lt;br /&gt;
&lt;br /&gt;
    questionnaires.each do |questionnaire|&lt;br /&gt;
      @round = nil&lt;br /&gt;
      if @assignment.vary_by_round &amp;amp;&amp;amp; questionnaire.type == &amp;quot;ReviewQuestionnaire&amp;quot;&lt;br /&gt;
        questionnaires = AssignmentQuestionnaire.where(assignment_id: @assignment.id, questionnaire_id: questionnaire.id)&lt;br /&gt;
        if questionnaires.count &amp;gt; 1&lt;br /&gt;
          @round = questionnaires[counter_for_same_rubric].used_in_round&lt;br /&gt;
          counter_for_same_rubric += 1&lt;br /&gt;
        else&lt;br /&gt;
          @round = questionnaires[0].used_in_round&lt;br /&gt;
          counter_for_same_rubric = 0&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      # line which is causing the issue&lt;br /&gt;
      @vmlist &amp;lt;&amp;lt; populate_view_model(@participant, questionnaire, @team)&lt;br /&gt;
    end&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Modified code (replace the line which is causing issues):&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      if questionnaire.display_type == &amp;quot;Teammate Review&amp;quot;&lt;br /&gt;
        # as teammate review will be different for each participant&lt;br /&gt;
        # we need to create a separate table for each teammate&lt;br /&gt;
        @participant.team.participants.each do |participant|&lt;br /&gt;
          @vmlist &amp;lt;&amp;lt; populate_view_model(participant, questionnaire, @team)&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        # only one participant needs iterating, as apart from teammatereview&lt;br /&gt;
        # all other reviews are at &amp;quot;team&amp;quot; level&lt;br /&gt;
        @vmlist &amp;lt;&amp;lt; populate_view_model(@participant, questionnaire, @team)&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Image 1. Instructor's view of teammate review'''&lt;br /&gt;
[[File:Instructor-view-1.png|border|center|alt=The proposed expanded student display.|The proposed expanded student display.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The `populate_view_model` returns an instance of `VmQuestionResponse`. This model represents the data required to render the table along with it's metadata, like `list_of_reviews` which is used to render the rows.&lt;br /&gt;
&lt;br /&gt;
== Present Status of the application ==&lt;br /&gt;
&lt;br /&gt;
'''Image 1. Instructor's view of teammate review''': This is the current screen given to the instructor. Here we see that the instructor can not determine who has given which review to which student.&lt;br /&gt;
&lt;br /&gt;
[[File:Instructor-view-1.png|border|center|alt=The proposed expanded student display.|The proposed expanded student display.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Image 2. Student's view of teammate review''': Currently, a student is not able to see what grades were given by their teammates. We need to implement that functionality so that the student is able to view the grades.&lt;br /&gt;
&lt;br /&gt;
[[File:Student-view-2.png|border|center|alt=The current instructor view.|The current review display for instructors.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Image 3. UML Diagram''': We are planning to add two variables namely showTeammateReview and hideReviewerName. showTeammateReview will decide whether the students would be able to view their team members reviews. hideReviewerName will decide whether the student is able to view peer's names or not.&lt;br /&gt;
[[File:Uml-assignment.png|border|center|alt=The proposed condensed student display.|The proposed condensed student display.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Proposed changes ==&lt;br /&gt;
&lt;br /&gt;
1)''' Proposed UI for instructor ''': The instructor is able to see the score for all teammates. In the existing code, only one teammate's scores are being shown. But, we are planning to change the way the VmQuestionResponse array is created, so that the scores for all teammates are appended to it so it correctly shows what should have already been shown in this screen for the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Proposed_screen.png|border|center|alt=Proposed UI for instructor|Proposed UI for instructor.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: When a student visits this screen, they will only be shown the reviews received by them, assuming the instructor has allowed visibility of teammate reviews to students.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2)''' Error in existing UI for student ''': In the existing UI for a student, the highlighted block should not be rendered. This part of the screen is meant for the instructors/TAs. This portion of the screen being rendered to a student is a mistake, and we will remove this part of the screen from the student's screen as part of our proposed changes.&lt;br /&gt;
&lt;br /&gt;
[[File:Wrong render for student.png|border|center|alt=Existing UI for student|Existing UI for student.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3)''' Show teammate review to student UI ''': The existing code doesn't render a student's teammate review scores at all. We are planning to render the scores to a student when they visit this screen. However, the visibility of this screen is contingent on whether the instructor has allowed visibility of the teammate review screen to students. If the instructor has disabled this feature, then the heatgrid will not be displayed at all.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:UI_for_student.png|border|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
== Design Patterns ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Existing code does not use any design patterns, apart from if-else. It uses if-else conditional statements to check what type of questionnaire is present in the viewmodel `VmQuestionResponse`, and based on that, it renders the appropriate content.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can use decorator pattern, for handling the visibility of the heatgrid when rendering heatgrids for a student login.&lt;br /&gt;
&lt;br /&gt;
== User Stories ==&lt;br /&gt;
&lt;br /&gt;
1. As an instructor, I can view what reviews one teammate has given to other teammates.&lt;br /&gt;
&lt;br /&gt;
2. As a student, I can view what reviews my teammates have given to me.&lt;br /&gt;
&lt;br /&gt;
3. As an instructor, I can select if a student's reviews are anonymously shown to their teammates.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
'''CURRENT STATUS'''&lt;br /&gt;
&lt;br /&gt;
1. Presently, the tests only cover if the view_team is page is rendered when it is asked for.&lt;br /&gt;
&lt;br /&gt;
'''OUR PROPOSAL'''&lt;br /&gt;
&lt;br /&gt;
1. For a student:&lt;br /&gt;
&lt;br /&gt;
- When show_team is set as false, the student should not be able to see his scores.&lt;br /&gt;
&lt;br /&gt;
- When show_team is set as true, the student should be able to see his scores.&lt;br /&gt;
&lt;br /&gt;
2. For instructor:&lt;br /&gt;
&lt;br /&gt;
- Should be able to see all the scores by default.&lt;br /&gt;
&lt;br /&gt;
- The instructor can decide whether to show the names of the reviewer to the reviewer in teammate reviews, by selecting a checkbox for the same.&lt;br /&gt;
[[File:Untitled Diagram.drawio.png|border|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;https://expertiza.ncsu.edu/&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Agarg25</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Untitled_Diagram.drawio.png&amp;diff=141376</id>
		<title>File:Untitled Diagram.drawio.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Untitled_Diagram.drawio.png&amp;diff=141376"/>
		<updated>2021-11-09T02:07:23Z</updated>

		<summary type="html">&lt;p&gt;Agarg25: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Agarg25</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141375</id>
		<title>CSC/ECE 517 Fall 2021 - E2165. Fix teammate-review view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141375"/>
		<updated>2021-11-09T02:06:03Z</updated>

		<summary type="html">&lt;p&gt;Agarg25: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Introduction ==&lt;br /&gt;
&lt;br /&gt;
Dr. Edward Gehringer (instructor), Parimal Mehta (mentor)&lt;br /&gt;
&lt;br /&gt;
1. Lalit Bangad (unity ID: llbangad)&lt;br /&gt;
&lt;br /&gt;
2. Vinay Deshmukh (unity ID: vdeshmu)&lt;br /&gt;
&lt;br /&gt;
3. Arvasu Chikara (unity ID: achikar2)&lt;br /&gt;
&lt;br /&gt;
4. Anjali Garg (unity ID : agarg25)   &lt;br /&gt;
&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
== Problems to be addressed ==&lt;br /&gt;
&lt;br /&gt;
After a project is submitted and reviewed, both the team members (students) and instructors should be able to view the teammate reviews. Students should be able to view the reviews by going to a particular assignment's -&amp;gt; your scores, at the bottom of the page. An instructor can view the teammate reviews by going to assignments -&amp;gt; assignment -&amp;gt; particular team's submission -&amp;gt; view submission -&amp;gt; assign grades -&amp;gt; view scores. &lt;br /&gt;
&lt;br /&gt;
In the case of the instructor, a single heat grid is shown whereas in the case of a team member, we cant view the scores. In the heat grid, it is not clear if the scores visible are for the reviews that the student has *written* for their teammates or the scores that the student has *received* from their teammates. Additionally, for instructors can choose from a list of the students on the team, but they have no way to tell whether the heat grid shows the reviews done *by* that student or done *for* that student.&lt;br /&gt;
&lt;br /&gt;
== Methodology Overview ==&lt;br /&gt;
&lt;br /&gt;
We have divided our work in the following tasks to address the above problems:&lt;br /&gt;
&lt;br /&gt;
1. Distinguish reviews done for a student by rendering separates heatgrids for each student&lt;br /&gt;
&lt;br /&gt;
2. For instructors, the table will have sections based on the students&lt;br /&gt;
&lt;br /&gt;
3. Include a checkbox on the edit assignment page that enables/disables visibility of heat grid to students&lt;br /&gt;
&lt;br /&gt;
4. Fix the average column for a table (which breaks for some reviews)&lt;br /&gt;
&lt;br /&gt;
5. Show a composite score derived from all reviews.  Make this code generalized, so other kinds of heat grid views could use it.&lt;br /&gt;
&lt;br /&gt;
6. Changes should work even in an anonymized view&lt;br /&gt;
&lt;br /&gt;
== Motivations ==&lt;br /&gt;
&lt;br /&gt;
1. Enable users to clearly tell which reviews are done by them, and which reviews are done for them.&lt;br /&gt;
&lt;br /&gt;
2. Code should be generic so it can be used for different types of heat grids as well.&lt;br /&gt;
&lt;br /&gt;
== Control Flow to access the concerned screens ==&lt;br /&gt;
&lt;br /&gt;
== Models used / Explanation of fixes ==&lt;br /&gt;
&lt;br /&gt;
The below diagram illustrates the proposed code change for showing all team members with the teammate review data to an instructor. The existing code only iterated on the `Participant` whose ID is present in the URL of the page. To fix this, we will iterate over all teammates of the given participant so that all teammate reviews for all team members are shown to the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Logic e2165.png|border|center|alt=Flow diagram of proposed changes for showing team review data to instructor]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Existing code:&lt;br /&gt;
&lt;br /&gt;
    questionnaires.each do |questionnaire|&lt;br /&gt;
      @round = nil&lt;br /&gt;
      if @assignment.vary_by_round &amp;amp;&amp;amp; questionnaire.type == &amp;quot;ReviewQuestionnaire&amp;quot;&lt;br /&gt;
        questionnaires = AssignmentQuestionnaire.where(assignment_id: @assignment.id, questionnaire_id: questionnaire.id)&lt;br /&gt;
        if questionnaires.count &amp;gt; 1&lt;br /&gt;
          @round = questionnaires[counter_for_same_rubric].used_in_round&lt;br /&gt;
          counter_for_same_rubric += 1&lt;br /&gt;
        else&lt;br /&gt;
          @round = questionnaires[0].used_in_round&lt;br /&gt;
          counter_for_same_rubric = 0&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      # line which is causing the issue&lt;br /&gt;
      @vmlist &amp;lt;&amp;lt; populate_view_model(@participant, questionnaire, @team)&lt;br /&gt;
    end&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Modified code (replace the line which is causing issues):&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      if questionnaire.display_type == &amp;quot;Teammate Review&amp;quot;&lt;br /&gt;
        # as teammate review will be different for each participant&lt;br /&gt;
        # we need to create a separate table for each teammate&lt;br /&gt;
        @participant.team.participants.each do |participant|&lt;br /&gt;
          @vmlist &amp;lt;&amp;lt; populate_view_model(participant, questionnaire, @team)&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        # only one participant needs iterating, as apart from teammatereview&lt;br /&gt;
        # all other reviews are at &amp;quot;team&amp;quot; level&lt;br /&gt;
        @vmlist &amp;lt;&amp;lt; populate_view_model(@participant, questionnaire, @team)&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Image 1. Instructor's view of teammate review'''&lt;br /&gt;
[[File:Instructor-view-1.png|border|center|alt=The proposed expanded student display.|The proposed expanded student display.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The `populate_view_model` returns an instance of `VmQuestionResponse`. This model represents the data required to render the table along with it's metadata, like `list_of_reviews` which is used to render the rows.&lt;br /&gt;
&lt;br /&gt;
== Present Status of the application ==&lt;br /&gt;
&lt;br /&gt;
'''Image 1. Instructor's view of teammate review''': This is the current screen given to the instructor. Here we see that the instructor can not determine who has given which review to which student.&lt;br /&gt;
&lt;br /&gt;
[[File:Instructor-view-1.png|border|center|alt=The proposed expanded student display.|The proposed expanded student display.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Image 2. Student's view of teammate review''': Currently, a student is not able to see what grades were given by their teammates. We need to implement that functionality so that the student is able to view the grades.&lt;br /&gt;
&lt;br /&gt;
[[File:Student-view-2.png|border|center|alt=The current instructor view.|The current review display for instructors.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Image 3. UML Diagram''': We are planning to add two variables namely showTeammateReview and hideReviewerName. showTeammateReview will decide whether the students would be able to view their team members reviews. hideReviewerName will decide whether the student is able to view peer's names or not.&lt;br /&gt;
[[File:Uml-assignment.png|border|center|alt=The proposed condensed student display.|The proposed condensed student display.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Proposed changes ==&lt;br /&gt;
&lt;br /&gt;
1)''' Proposed UI for instructor ''': The instructor is able to see the score for all teammates. In the existing code, only one teammate's scores are being shown. But, we are planning to change the way the VmQuestionResponse array is created, so that the scores for all teammates are appended to it so it correctly shows what should have already been shown in this screen for the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Proposed_screen.png|border|center|alt=Proposed UI for instructor|Proposed UI for instructor.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: When a student visits this screen, they will only be shown the reviews received by them, assuming the instructor has allowed visibility of teammate reviews to students.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2)''' Error in existing UI for student ''': In the existing UI for a student, the highlighted block should not be rendered. This part of the screen is meant for the instructors/TAs. This portion of the screen being rendered to a student is a mistake, and we will remove this part of the screen from the student's screen as part of our proposed changes.&lt;br /&gt;
&lt;br /&gt;
[[File:Wrong render for student.png|border|center|alt=Existing UI for student|Existing UI for student.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3)''' Show teammate review to student UI ''': The existing code doesn't render a student's teammate review scores at all. We are planning to render the scores to a student when they visit this screen. However, the visibility of this screen is contingent on whether the instructor has allowed visibility of the teammate review screen to students. If the instructor has disabled this feature, then the heatgrid will not be displayed at all.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:UI_for_student.png|border|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
== Design Patterns ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Existing code does not use any design patterns, apart from if-else. It uses if-else conditional statements to check what type of questionnaire is present in the viewmodel `VmQuestionResponse`, and based on that, it renders the appropriate content.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can use decorator pattern, for handling the visibility of the heatgrid when rendering heatgrids for a student login.&lt;br /&gt;
&lt;br /&gt;
== User Stories ==&lt;br /&gt;
&lt;br /&gt;
1. As an instructor, I can view what reviews one teammate has given to other teammates.&lt;br /&gt;
&lt;br /&gt;
2. As a student, I can view what reviews my teammates have given to me.&lt;br /&gt;
&lt;br /&gt;
3. As an instructor, I can select if a student's reviews are anonymously shown to their teammates.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
'''CURRENT STATUS'''&lt;br /&gt;
&lt;br /&gt;
1. Presently, the tests only cover if the view_team is page is rendered when it is asked for.&lt;br /&gt;
&lt;br /&gt;
'''OUR PROPOSAL'''&lt;br /&gt;
&lt;br /&gt;
1. For a student:&lt;br /&gt;
&lt;br /&gt;
- When show_team is set as false, the student should not be able to see his scores.&lt;br /&gt;
- When show_team is set as true, the student should be able to see his scores.&lt;br /&gt;
&lt;br /&gt;
2. For instructor:&lt;br /&gt;
&lt;br /&gt;
- Should be able to see all the scores by default.&lt;br /&gt;
- Instructor should be able to select a particular teammates name to view their individual scores only.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;https://expertiza.ncsu.edu/&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Agarg25</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141374</id>
		<title>CSC/ECE 517 Fall 2021 - E2165. Fix teammate-review view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view&amp;diff=141374"/>
		<updated>2021-11-09T02:04:49Z</updated>

		<summary type="html">&lt;p&gt;Agarg25: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Introduction ==&lt;br /&gt;
&lt;br /&gt;
Dr. Edward Gehringer (instructor), Parimal Mehta (mentor)&lt;br /&gt;
&lt;br /&gt;
1. Lalit Bangad (unity ID: llbangad)&lt;br /&gt;
&lt;br /&gt;
2. Vinay Deshmukh (unity ID: vdeshmu)&lt;br /&gt;
&lt;br /&gt;
3. Arvasu Chikara (unity ID: achikar2)&lt;br /&gt;
&lt;br /&gt;
4. Anjali Garg (unity ID : agarg25)   &lt;br /&gt;
&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
== Problems to be addressed ==&lt;br /&gt;
&lt;br /&gt;
After a project is submitted and reviewed, both the team members (students) and instructors should be able to view the teammate reviews. Students should be able to view the reviews by going to a particular assignment's -&amp;gt; your scores, at the bottom of the page. An instructor can view the teammate reviews by going to assignments -&amp;gt; assignment -&amp;gt; particular team's submission -&amp;gt; view submission -&amp;gt; assign grades -&amp;gt; view scores. &lt;br /&gt;
&lt;br /&gt;
In the case of the instructor, a single heat grid is shown whereas in the case of a team member, we cant view the scores. In the heat grid, it is not clear if the scores visible are for the reviews that the student has *written* for their teammates or the scores that the student has *received* from their teammates. Additionally, for instructors can choose from a list of the students on the team, but they have no way to tell whether the heat grid shows the reviews done *by* that student or done *for* that student.&lt;br /&gt;
&lt;br /&gt;
== Methodology Overview ==&lt;br /&gt;
&lt;br /&gt;
We have divided our work in the following tasks to address the above problems:&lt;br /&gt;
&lt;br /&gt;
1. Distinguish reviews done for a student by rendering separates heatgrids for each student&lt;br /&gt;
&lt;br /&gt;
2. For instructors, the table will have sections based on the students&lt;br /&gt;
&lt;br /&gt;
3. Include a checkbox on the edit assignment page that enables/disables visibility of heat grid to students&lt;br /&gt;
&lt;br /&gt;
4. Fix the average column for a table (which breaks for some reviews)&lt;br /&gt;
&lt;br /&gt;
5. Show a composite score derived from all reviews.  Make this code generalized, so other kinds of heat grid views could use it.&lt;br /&gt;
&lt;br /&gt;
6. Changes should work even in an anonymized view&lt;br /&gt;
&lt;br /&gt;
== Motivations ==&lt;br /&gt;
&lt;br /&gt;
1. Enable users to clearly tell which reviews are done by them, and which reviews are done for them.&lt;br /&gt;
&lt;br /&gt;
2. Code should be generic so it can be used for different types of heat grids as well.&lt;br /&gt;
&lt;br /&gt;
== Control Flow to access the concerned screens ==&lt;br /&gt;
&lt;br /&gt;
== Models used / Explanation of fixes ==&lt;br /&gt;
&lt;br /&gt;
The below diagram illustrates the proposed code change for showing all team members with the teammate review data to an instructor. The existing code only iterated on the `Participant` whose ID is present in the URL of the page. To fix this, we will iterate over all teammates of the given participant so that all teammate reviews for all team members are shown to the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Logic e2165.png|border|center|alt=Flow diagram of proposed changes for showing team review data to instructor]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Existing code:&lt;br /&gt;
&lt;br /&gt;
    questionnaires.each do |questionnaire|&lt;br /&gt;
      @round = nil&lt;br /&gt;
      if @assignment.vary_by_round &amp;amp;&amp;amp; questionnaire.type == &amp;quot;ReviewQuestionnaire&amp;quot;&lt;br /&gt;
        questionnaires = AssignmentQuestionnaire.where(assignment_id: @assignment.id, questionnaire_id: questionnaire.id)&lt;br /&gt;
        if questionnaires.count &amp;gt; 1&lt;br /&gt;
          @round = questionnaires[counter_for_same_rubric].used_in_round&lt;br /&gt;
          counter_for_same_rubric += 1&lt;br /&gt;
        else&lt;br /&gt;
          @round = questionnaires[0].used_in_round&lt;br /&gt;
          counter_for_same_rubric = 0&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      # line which is causing the issue&lt;br /&gt;
      @vmlist &amp;lt;&amp;lt; populate_view_model(@participant, questionnaire, @team)&lt;br /&gt;
    end&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Modified code (replace the line which is causing issues):&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      if questionnaire.display_type == &amp;quot;Teammate Review&amp;quot;&lt;br /&gt;
        # as teammate review will be different for each participant&lt;br /&gt;
        # we need to create a separate table for each teammate&lt;br /&gt;
        @participant.team.participants.each do |participant|&lt;br /&gt;
          @vmlist &amp;lt;&amp;lt; populate_view_model(participant, questionnaire, @team)&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        # only one participant needs iterating, as apart from teammatereview&lt;br /&gt;
        # all other reviews are at &amp;quot;team&amp;quot; level&lt;br /&gt;
        @vmlist &amp;lt;&amp;lt; populate_view_model(@participant, questionnaire, @team)&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Image 1. Instructor's view of teammate review'''&lt;br /&gt;
[[File:Instructor-view-1.png|border|center|alt=The proposed expanded student display.|The proposed expanded student display.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The `populate_view_model` returns an instance of `VmQuestionResponse`. This model represents the data required to render the table along with it's metadata, like `list_of_reviews` which is used to render the rows.&lt;br /&gt;
&lt;br /&gt;
== Present Status of the application ==&lt;br /&gt;
&lt;br /&gt;
'''Image 1. Instructor's view of teammate review''': This is the current screen given to the instructor. Here we see that the instructor can not determine who has given which review to which student.&lt;br /&gt;
&lt;br /&gt;
[[File:Instructor-view-1.png|border|center|alt=The proposed expanded student display.|The proposed expanded student display.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Image 2. Student's view of teammate review''': Currently, a student is not able to see what grades were given by their teammates. We need to implement that functionality so that the student is able to view the grades.&lt;br /&gt;
&lt;br /&gt;
[[File:Student-view-2.png|border|center|alt=The current instructor view.|The current review display for instructors.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Image 3. UML Diagram''': We are planning to add two variables namely showTeammateReview and hideReviewerName. showTeammateReview will decide whether the students would be able to view their team members reviews. hideReviewerName will decide whether the student is able to view peer's names or not.&lt;br /&gt;
[[File:Uml-assignment.png|border|center|alt=The proposed condensed student display.|The proposed condensed student display.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Proposed changes ==&lt;br /&gt;
&lt;br /&gt;
1)''' Proposed UI for instructor ''': The instructor is able to see the score for all teammates. In the existing code, only one teammate's scores are being shown. But, we are planning to change the way the VmQuestionResponse array is created, so that the scores for all teammates are appended to it so it correctly shows what should have already been shown in this screen for the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Proposed_screen.png|border|center|alt=Proposed UI for instructor|Proposed UI for instructor.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: When a student visits this screen, they will only be shown the reviews received by them, assuming the instructor has allowed visibility of teammate reviews to students.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2)''' Error in existing UI for student ''': In the existing UI for a student, the highlighted block should not be rendered. This part of the screen is meant for the instructors/TAs. This portion of the screen being rendered to a student is a mistake, and we will remove this part of the screen from the student's screen as part of our proposed changes.&lt;br /&gt;
&lt;br /&gt;
[[File:Wrong render for student.png|border|center|alt=Existing UI for student|Existing UI for student.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3)''' Show teammate review to student UI ''': The existing code doesn't render a student's teammate review scores at all. We are planning to render the scores to a student when they visit this screen. However, the visibility of this screen is contingent on whether the instructor has allowed visibility of the teammate review screen to students. If the instructor has disabled this feature, then the heatgrid will not be displayed at all.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:UI_for_student.png|border|center|alt=New UI for students|New UI for students ]]&lt;br /&gt;
&lt;br /&gt;
== Design Patterns ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Existing code does not use any design patterns, apart from if-else. It uses if-else conditional statements to check what type of questionnaire is present in the viewmodel `VmQuestionResponse`, and based on that, it renders the appropriate content.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can use decorator pattern, for handling the visibility of the heatgrid when rendering heatgrids for a student login.&lt;br /&gt;
&lt;br /&gt;
== User Stories ==&lt;br /&gt;
&lt;br /&gt;
1. As an instructor, I can view what reviews one teammate has given to other teammates.&lt;br /&gt;
&lt;br /&gt;
2. As a student, I can view what reviews my teammates have given to me.&lt;br /&gt;
&lt;br /&gt;
3. As an instructor, I can select if a student's reviews are anonymously shown to their teammates.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
'''CURRENT STATUS'''&lt;br /&gt;
1. Presently, the tests only cover if the view_team is page is rendered when it is asked for.&lt;br /&gt;
&lt;br /&gt;
'''TEST PLAN'''&lt;br /&gt;
1. For a student:&lt;br /&gt;
- When show_team is set as false, the student should not be able to see his scores.&lt;br /&gt;
- When show_team is set as true, the student should be able to see his scores.&lt;br /&gt;
&lt;br /&gt;
2. For instructor:&lt;br /&gt;
- Should be able to see all the scores by default.&lt;br /&gt;
- Instructor should be able to select a particular teammates name to view their individual scores only.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;https://expertiza.ncsu.edu/&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Agarg25</name></author>
	</entry>
</feed>