CSC/ECE 517 Fall 2017/E1774 Metareview fixes and improvements.rb
Introduction
Problem Statement
In Expertiza, the metareview feature in Expertiza enables a third party to evaluate the quality of feedback that a reviewer gives to a reviewee. Metareview is an important feature that can help students become a better reviewer for their peers by providing detailed feedback that is actionable and positively formulated. Unfortunately, this feature is broken and the following issues were identified. Your task is to fix these issues so that this feature can be used again.
Team Members
The team members who worked on this particular problem are:-
Rachit Agarwal
Cherukeshi Machan
Aishwarya Sundararajan
Issues
Issue #970
Dynamic assignment of metareviews does not work. When requesting a new metareview to perform, it shows NoMethodError undefined method ‘includes?’ in assignment.rb line 102.
Fix: This line has been fixed and now checks if response_map.reviewer == metareviewer rather than response_map.reviewer.includes?(metareviewer), which was invalid.
response_map.reviewee == metareviewer or response_map.reviewer == metareviewer
Issue #298
New Feature: Metareviewer should be able to see author feedback. Currently, the metareviewer can only see the review and doesn't have access to the author feedback.
Implementation: This feature is implemented using the "reviewed_object_id" from the "response_maps" table to fetch the authors feedback for the particular reviewed id. Below are the code changes for implementing this feature.
responses.html
<% if map.type.to_s == "MetareviewResponseMap" %> <td> <%= link_to "Author's Feedback", {controller: 'student_review', action: 'show_authors_feedback',:id => map.reviewed_object_id}%></td> <% end %>
student_review_controller.rb
def show_authors_feedback @map = FeedbackResponseMap.find_by(reviewed_object_id: params[:id]) end
show_authors_feedback.html
<% if @map and !@map.response.empty? then %> <%= @map.response.last.display_as_html %> <%else%> <h3>Feedback from author</h3> <h4> No feedback done yet.</h4> <%end%> <a href="javascript:window.history.back()">Back</a>
Issue #198
Meta-reviews do not show the review to be reviewed. When I am assigned the meta-review, the original review I'm supposed to critique is not shown, only the link to the wiki article and the review rubric.
Fix: Updated response.html.erb: Previously, this view was rendering a partial which was actually not present in the views. So we are not rendering that partial anymore. Now the actual review is displayed by calling an action of response.controller to show the original review which metareviewer is supposed to critique.
Old Code
<% if @responses_versions.empty? %> <I>No previous review was performed.</I><br/><hr/><br/> <% else %> <%= render :partial => 'review', :locals => {:versions => @responses_versions} %> <% end %>
New Code
<% if @responses_versions.empty? %> <I>No previous review was performed.</I><br/><hr/><br/> <% else %> <%= @responses_versions.each do |response| %> <%= response.display_as_html() %> <br/> <% end %> <hr/> <br/> <% end %>
Issue #162
Student selected a new meta review they get their own project to metareview
This functionality is working fine as per the requirement. When a user selects a new metareview, a review is assigned to the user to be reviewed, which have the different author other than the User. This can be tested using the test scenario mentioned in the testing section.
Issue #145
Metareviews need to be fixed to work with staggered-deadline assignments
Fix: The submission is reviewable if the submission is in a stage where reviews can be done. It does not depend on the stage of the topic the reviewer is writing on. The same has been incorporated by the below changes.
Code mentioned in defect:
<% if @assignment.review_allowed(@reviewee_topic_id) or @assignment.metareview_allowed(nil) or @assignment.get_current_stage(@participant.topic_id) == "Complete" %>
Updated code:
student_task/view.html.erb
<% if check_reviewable_topics(@assignment) or @assignment.metareview_allowed(nil) or @assignment.get_current_stage(@topic_id) == "Finished" %>
student_task_helper.rb
def check_reviewable_topics(assignment) return true if !assignment.has_topics? and assignment.get_current_stage != "submission" sign_up_topics = SignUpTopic.where(assignment_id: assignment.id) sign_up_topics.each {|topic| return true if assignment.can_review(topic.id) } false end
Test Plan
Automated
Issue #970
describe "GET #new_feedback" do it "redirects to new if review object is found" do allow(Response).to receive(:find).and_return(review) allow(session[:user]).to receive(:id).and_return(1) allow(review).to receive_message_chain(:map, :assignment, :id).and_return(1) allow(review).to receive_message_chain(:map, :reviewer, :id).and_return(1) allow_any_instance_of(AssignmentParticipant).to receive_message_chain(:where, :first).and_return(assignment) allow_any_instance_of(FeedbackResponseMap).to receive_message_chain(:where, :first).and_return(map) allow_any_instance_of(FeedbackResponseMap).to receive(:create).and_return(map) get :new_feedback expect(response).to redirect_to action: :new, id: map.id, return: "feedback" end it "redirects to same page if no review is found" do allow(Response).to receive(:find).and_return(false) expect(response).to have_http_status(200) end end
Issue #298
We wrote test for Issue "Metareviewer should be able to see author feedback". student_review_controller_spec.rb file has been created
Code:
RSpec.describe StudentReviewController do context 'logged in as metareviewer' do let(:review) { Response.create(map_id: 1, additional_comment: 'hello', round: 1) } let(:map) { FeedbackResponseMap.create(reviewed_object_id: 1, reviewer_id: 1, reviewee_id: 1) } let(:assignment) { AssignmentParticipant.new } let(:responsemap) { ResponseMap.new } describe "GET #authorFeedback" do it "returns authors feedback" do get :show_authors_Feedback expect(response).to redirect_to(request.env['HTTP_REFERER'] ? :back : :root) end end end end
StudentReviewController logged in as metareviewer GET #authorFeedback returns authors feedback 0.21359 seconds ./spec/controllers/student_review_controller_spec.rb:12 1 example, 0 failures, 1 passed Finished in 0.563879969 seconds
Issue #198
Manual
Issue #970
1) Login as Admin, create an assignment with all the necessary details like maximum no of users per team, add topics for the assignment, enroll users(students) in the assignment.
2) Select checkbox "add metareview deadlines", select dates and add metareview rubric for the same.
3) Go back to manage assignment and add select Assign reviewers.
4) Add meta-reviewer to a particular review submitted by students.
5) Impersonate the meta-reviewer assigned above and go to others work for the same assignment.
6) Select the option "request a new metareview" and a new review will be dynamically assigned for meta-review.
Issue #298
1) Login as Admin, create an assignment with all the necessary details like maximum no of users per team, add topics for the assignment, enroll users(students) in the assignment.
2) Select checkbox "add metareview deadlines", select dates and add metareview rubric for the same.
3) Go back to manage assignment and add select Assign reviewers.
4) Add meta-reviewer to a particular review submitted by students.
5) Impersonate the meta-reviewer assigned above and go to others work for the same assignment.
6) Select the option "request a new metareview" and a new review will be dynamically assigned for meta-review.
7) Option to view the author's feedback will be visible next to Begin button.
Issue #198
1) Login as Admin, create an assignment with all the necessary details like maximum no of users per team, add topics for the assignment, enroll users(students) in the assignment.
2) Select checkbox "add metareview deadlines", select dates and add metareview rubric for the same.
3) Go back to manage assignment and add select Assign reviewers.
4) Add meta-reviewer to a particular review submitted by students.
5) Impersonate the meta-reviewer assigned above and go to others work for the same assignment.
6) Select the option "request a new metareview" and a new review will be dynamically assigned for meta-review.
7) click begin button and show review option should be visible on the top to view the origin review to be reviewed.
Issue #162
1) Login as Admin, create an assignment with all the necessary details like maximum no of users per team, add topics for the assignment, enroll users(students) in the assignment.
2) Select checkbox "add metareview deadlines", select dates and add metareview rubric for the same.
3) Go back to manage assignment and add select Assign reviewers.
4) Add meta-reviewer to a particular review submitted by students.
5) Impersonate the meta-reviewer assigned above and go to others work for the same assignment.
6) Select the option "request a new metareview" and a new review will be dynamically assigned for meta-review.
7) Select begin button.
8) The submitted work is different from the work submitted by the metareviewer.
Issue #145
1) Login as Admin, create an assignment with all the necessary details like maximum no of users per team, add topics for the assignment, enroll users(students) in the assignment.
2) Select checkbox "add metareview deadlines", select "Staggered deadline assignment?" checkbox in general tab and update the deadlines for metareview in "due dates" tab.
3) Go back to manage assignment and add select Assign reviewers.
4) Add meta-reviewer to a particular review submitted by students.
5) Impersonate the meta-reviewer assigned above and go to others work for the same assignment.
6) "Request a new metareview" option should be visible to the user if the deadline is the future date for that particular assignment.