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

From Expertiza_Wiki
Jump to navigation Jump to search
Line 103: Line 103:
File : [https://github.com/expertiza/expertiza/blob/beta/app/views/grades/_view_heatgrid.html.erb _view_heatgrid.html.erb]
File : [https://github.com/expertiza/expertiza/blob/beta/app/views/grades/_view_heatgrid.html.erb _view_heatgrid.html.erb]


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


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.
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.


<code>
<code>
              <% vm.list_of_reviews.each do |review| %>
        <% vm.list_of_reviews.each do |review| %>
                  ....
            ....
                    
                    
                  <% elsif vm.questionnaire_display_type == "Author Feedback" %>
            <% 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 %>
              <% user_name = User.find(Participant.find(ResponseMap.find(Response.find(review.id).map_id).reviewee_id).user_id).fullname(session[:ip]).to_s %>
                      <th class="sorter-false"> <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></th>
              <th class="sorter-false"> <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></th>
                  <% else %>
            <% else %>
                    
                    
                  .....
            .....
</code>
</code>


Secondly, we change the Title of each row in the detailed score view (when the dropdown of review is opened).
Secondly, we change the Title of each row in the detailed score view (when the dropdown of review is opened). Currently, it shows name of the Review. Here, we need the Id of the reviewee.


<code>
<code>
                            <% if vm.questionnaire_display_type == "Author Feedback" %>
        <% if vm.questionnaire_display_type == "Author Feedback" %>
                                <td><%= vm.list_of_reviewers[index].user_id %></td>
            <td><%= vm.list_of_reviewers[index].user_id %></td>
                              <% else %>
        <% else %>
                                <td>Review <%=index + 1%></td>
            <td>Review <%=index + 1%></td>
                              <% end %>
        <% end %>
</code>
</code>




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




<code>
<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 %>)
<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>
</code>


====Side Effects====
====Side Effects====

Revision as of 23:01, 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

List of files with code relevant to this issue :


view_heatgrid() method in grades_helper.rb is responsible for providing information about reviews, metareviews, author feedbacks, etc. For the purpose of this issue, we only need VmQuestionResponse data structure defined in this file. We do not need to make changes in this file.

'Author Feedback' tab in the UI contains tables for each team member with detailed breakdown of their feedback. The method add_reviews() is called before the review table is rendered in the view. This method does different things based on which tab we are on. In this function, we only have to change the if block for 'Author Feedback' tab.

Apart from these, we need to change the heatgrid view in the UI. Current view cannot be used 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. We need Reviewee Id there.

  • Logic to show total number of feedbacks in the title row doesn't work.



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 tab.

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). Currently, it shows name of the Review. Here, we need the Id of the reviewee.

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

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

        <% else %>

Review <%=index + 1%>

        <% end %>


At last, we 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