CSC/ECE 517 Fall 2019 - E1967. Fix glitches in author feedback: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 52: Line 52:


[[File:E1967_3.png]]
[[File:E1967_3.png]]
* The number of feedbacks in row title is not correct.
[[File:E1967_5.png]]




Line 126: Line 130:
Similarly, we also need to change the count of Feedbacks displayed at the top of each row as shown in the figure.
Similarly, we also need to change the count of Feedbacks displayed at the top of each row as shown in the figure.


<code>
        <a href="#" id="<%=prefix%>_<%=index.to_s%>_feedbackLink" name="<%=prefix%>_feedbackLink" onClick="toggleElement('<%=prefix%>_<%=index.to_s%>_feedback','author feedbacks');return false;"><b> <%=participant.fullname(session[:ip]) %></b></a> (<%=  FeedbackResponseMap.where(reviewer_id: participant.id).count rescue 0 %>)
</code>





Revision as of 17:59, 28 October 2019

E1967 Fix glitches in Author Feedback

Team members :

  • Bin Patel (bpatel24)
  • Omkar Kulkarni (oskulkar)
  • Pranav Gaikwad (pmgaikwa)

Problem Statement

In Summary report for assignment (grades/view_team?id=xxxx) for instructors, the author feedback section list a different set of users than the reviewers. It should list the team's feedback to all it's reviewers to this particular assignment.

Introduction

Currently, the Author Feedback section for a team shows the feedback the team received from other Authors they reviewed earlier.

The Author Feedback section, however, should display the feedback the team gave to their reviewers.

To explain these ideas in more detail, let's consider the following scenario :

Team 22 has two members in the team : Team Member 1, and Team Member 2. This team reviewed assignments of Team 29 and Team 30. Currently, the author feedback section displays feedback given by Team 29 and Team 30 to Team 22. See following figure.

Current Output


Now, consider that the Team 22's assignment was reviewed by members from Team 23 and Team 24. Then, the Author Feedback section should display the feedback Team 22 gave to the members of Team 23 and Team 24.

Expected Output



Problem Identification

Controller responsible for this page : grades_controller.rb

View responsible for this page : _view_heatgrid.html.erb

Related models : vm_question_response.rb

Related helpers : grades_helper.rb

The helper grades_helper.rb has a method view_heatgrid(). This method is called whenever the application requires to show a table with reviews and scores in it. This table is also used in other tabs on the same page. We have to make sure that the code we add here doesn't break other parts of the application.

The method add_reviews() is called before the review table is rendered in the view. This method does different things based on what is being requested. In this function, we only have to change the if block for 'Author Feedback' tab.

Additionally, the heatgrid view is only capable of showing reviews, metareviews, etc. We cannot use the same logic for Author Feedback for following reasons :

  • The heatgrid is configured to use Reviewer id as column title. In case of Author Feedback, we want Reviewee id as column title instead.

  • The row title in detailed scores is not appropriate for Author Feedback

  • The number of feedbacks in row title is not correct.




Proposed Solution

Changes in model

File : vm_question_response.rb

We only need to change the if block responsible for Author Feedback tab.

Logic :

  • Get the list of all FeedbackResponseMaps where current Participant is a reviewer. The participant id is already passed to the add_reviews() method.
  • For each FeedbackResponseMap obtained above, find out all the most recent Response objects. We only need most recent responses since Participants may have edited their responses. The old responses are not deleted from Responses table.
  • Pass the list of Responses to the heatgrid view.

def add_reviews(participant, team, vary)

   ...
   
   elsif @questionnaire_type == "AuthorFeedbackQuestionnaire"
     reviews = []
     feedbacks = FeedbackResponseMap.where(reviewer_id: participant.id)
     feedbacks.each do |fback|
       participant = Participant.find_by(id: fback.reviewee_id)
       response = Response.where(map_id: fback.id).order('updated_at').last
       if response
         reviews << response
         @list_of_reviews << response
       end 
       @list_of_reviewers << participant
     end
  
   ...

end

Changes in view

File : _view_heatgrid.html.erb

As discussed in the previous section, we need to change UI elements specific to Author Feedback.

First, we change the title of each column to show Reviewee Id instead of Reviewer Id. To achieve that, we only add a simple if condition in the view to check whether the current tab is 'Author Feedback'. We change the title to use 'reviewee_id' whenever the current tab is Author Feedback.

             <% vm.list_of_reviews.each do |review| %>
                 ....
                  
                 <% elsif vm.questionnaire_display_type == "Author Feedback" %>
                     <% user_name = User.find(Participant.find(ResponseMap.find(Response.find(review.id).map_id).reviewee_id).user_id).fullname(session[:ip]).to_s %>

<a target="_blank" href="../response/view?id=<%= review.id.to_s %>" data-toggle="tooltip" data-placement="right" title="Click to see details"><%= user_name.to_s %></a>

                 <% else %>
                 
                 .....

Secondly, we change the Title of each row in the detailed score view (when the dropdown of review is opened).

                            <% if vm.questionnaire_display_type == "Author Feedback" %>

<%= vm.list_of_reviewers[index].user_id %>

                             <% else %>

Review <%=index + 1%>

                             <% end %>


Similarly, we also need to change the count of Feedbacks displayed at the top of each row as shown in the figure.


       <a href="#" id="<%=prefix%>_<%=index.to_s%>_feedbackLink" name="<%=prefix%>_feedbackLink" onClick="toggleElement('<%=prefix%>_<%=index.to_s%>_feedback','author feedbacks');return false;"> <%=participant.fullname(session[:ip]) %></a> (<%=  FeedbackResponseMap.where(reviewer_id: participant.id).count rescue 0 %>)


Side Effects

The code we changed is very specific and only applies to cases where 'Author Feedback' is to be shown. Therefore, we do not expect other parts of the application to get affected by our code.

Continue reading for more information on tests.

Tests

File : vm_question_response.rb

There is a fundamental change in how Author Feedback is tested. In existing implementation, we test for the feedback received by a participant. However, in the new implementation, we are interested in testing feedback left by current participant to other team members. Therefore, variable @list_of_reviews should contain the list of reviews (feedbacks) left by current participant.


To achieve that, we first create a new mock Author Feedback on behalf of the test user / participant. Then, we check whether the mocked feedback is returned in the variable @list_of_reviews