CSC/ECE 517 Fall 2019 - E1997. Issues related to meta-reviewing
Overview of Project
In Expertiza, meta-review is a feature that enables a third party to evaluate the quality of feedback that a reviewer gives a reviewee. meta-review is an important feature that can help students become better reviewers for their peers by providing detailed feedback that is actionable and positively formulated. Unfortunately, this feature is broken and the following issues were identified.
Design Pattern
Design patterns are not applicable as our task involved just modification of existing methods.
Issue1 - Cannot begin/view/edit a meta-review
Issue Description
When a user requests a new meta-review, (s)he should be able to click on the Begin button, which should redirect him/her to the meta-review questionnaire and when the user returns back (to the page where he can view the reviews and meta-reviews, by clicking on Others’ work in his/her assignment), (s)he should be then able to see view and update links for the meta-reviews (s)he has performed.
But the issue is Begin and Edit are not working for the given scenario.
Existing Issue
1. Log in as instructor6, click on Manage...-> Assignments
2. Click on edit assignment, navigate to Due Dates and check "Use meta-review deadline" checkbox
3. Select "Yes" for all of the following: Submission allowed, Review allowed and Meta-review allowed in all of the deadline types
4. Navigate back to Assignment Tree View and click on "Add participant"
5. Add couple of students(say student1 and student2) to the assignment
6. Impersonate/login as student1 and make a submission
7. Impersonate/login as student2 and Request for a new review under others work, submit the review
8. Impersonate/login back as student1 and Request for a new meta review
9. When Begin is clicked following will be displayed. Instead of this, the meta review page must be displayed.
10. A template must be added to fix the broken link
Issue2 - Count of number of meta-reviews left not reducing
Issue Description
The number of meta-reviews(refer to the snapshot below),should decrease when a user requests a meta-review.Also, the button to request a new meta-review should not disappear until the total number of reviews assigned has reached the allowed limit.
Existing Issue
Design strategy For Issue1 and Issue 2
The flow chart below describes the design we choose to implement the above two issues
Solution and Code Modification for Issue 1 and 2
Modification 1
Basically, the file named 'response.html.erb'(Exact navigation: https://github.com/VishnusRepo/expertiza/blob/master/app/views/response/response.html.erb) is looking for a partial named 'review'
The code that expects partial is:
<%= render :partial => 'review', :locals => {:versions => @responses_versions} %>
We have created partial named _review.html.erb at https://github.com/VishnusRepo/expertiza/blob/master/app/views/response/_review.html.erb It is a simple partial with code as follows:
<% versions.each do |response| %> <% rm = ResponseMap.find(response.map_id) %> <% as = Assignment.find(rm.reviewed_object_id) %> <% questionnaire = rm.questionnaire %> <%= response.display_as_html() %> <% end %>
Modification 2
The response_controller.rb(controller that works in tandem with response.html.erb view, which was expecting partial) required a minute fix, which is, - The existing code doesn't work if AssignmentTeam is found to be nil. Please check the below existing code:
if @response.nil? || AssignmentTeam.find(@map.reviewee_id).most_recent_submission.updated_at > @response.updated_at @response = Response.create(map_id: @map.id, additional_comment: , round: @current_round, is_submitted: 0)
The response is created(by Response.create) only if the 'if' condition is satisfied. The AssignmentTeam.find(@map.reviewee_id) shall return a nil(for metareviews), hence AssignmentTeam.find(@map.reviewee_id).most_recent_submission will throw an exception.
The problem is, assignment team will be nil for meta reviews. Hence, existing code won't work.
To cover this special nil case, we have modified the code as:
begin assignment_team = AssignmentTeam.find(@map.reviewee_id) rescue ActiveRecord::RecordNotFound => e assignment_team = nil end if @response.nil? || (!assignment_team.nil? && assignment_team.most_recent_submission.updated_at > @response.updated_at) @response = Response.create(map_id: @map.id, additional_comment: , round: @current_round, is_submitted: 0)
Modification 3
There's this issue of user being able to request and review more than allowed 'x' number of reviews. After user performed max allowed 'x' number of reviews, the button 'Request a new metareview to perform' shouldn't be visible. To handle this, following code change is made in file (https://github.com/VishnusRepo/expertiza/blob/master/app/views/student_review/list.html.erb)
<% if @assignment.num_metareviews_allowed - @num_metareviews_completed <= 0 %>
Note: You can not do more than <%=@assignment.num_metareviews_allowed%> metareviews according to assignment policy.
<% elsif @num_metareviews_in_progress == 0 %>
<%= render :partial => 'set_dynamic_metareview', :locals => {:assignment => @assignment} %>
<% end %>
The code in elsif block shows the button using which user can request more metareviews. By modifying the code as above, we shall not render the partial set_dynamic_metareview, which contains the request button.
By changing the code to above, we were able to handle the exceptions.
Both the Issues 1 and 2 are now solved. For the test setup we performed, following screenshot shows that we were able to do metareviews(Issue 1 done) and count of metareviews remaining is being reduced(Issue 2 done).
Issue3 - View/Hide meta-review fields based on enabled/disabled status
Background:
An instructor can edit an assignment and can choose whether to have metareview in it or not. He can do so by following the below steps:
1) From Manage>Assignments, click on the Edit Assignment button for the appropriate assignment.
2) On the Due Date tab, the instructor can select if (s)he wants to have meta-reviews done for the assignment, by clicking on the “Use meta-review deadline” checkbox and setting a meta-review deadline below.
3) Under the “Review Strategy” tab of edit assignment, the instructor can set Allowed and Required number of meta-reviews per reviewer by checking the Has meta-review Limit? checkbox.
Issue Description
For an assignment, when 'Use Metareview Deadline' is unchecked, it means meta-reviews are not enabled for that assignment. The checkbox is as below
As said, when this box is unchecked, it means there is no meta reviewing system for this assignment. The issue is, there are some meta review related fields that show up even if the above box is unchecked. Like in below image
Also, when a new issue is created, the default # of meta-reviews allowed and required should be null. As soon as someone checks the Has meta-review Limit box on the “Review Strategy” tab, the UI should fill in 3 and 3 as the required and allowed number. Of course, the user can change this number before submitting it.
Solution and Code Modification for Issue 3
As the checkbox and the content to be displayed on clicking the checkbox are located on different pages we cannot use the regular checkbox logic, so we used the concept of local storage and event listener.
we have made changes to the below two files:
1)/expertiza/app/views/assignments/edit/_due_dates.html.erb
2)/expertiza/app/views/assignments/edit/_review_strategy.html.erb
In the _due_dates.html.erb file:
There is an existing code where on clicking the checkbox 'Use metareview deadline', a function called 'removeOrAddMetareview()' is invoked. The code snippet below shows the existing code:
The 'removeOrAddMetareview()' is called on click of the 'Use metareview deadline' checkbox. Now we implemented two new functions which are invoked inside this function they are 'hideMetaReviewLimit()' and 'showMetaReviewLimit()'. This can be seen in the below code snippet
Now on clicking the 'Use metareview deadline' checkbox, the new code will invoke the 'removeOrAddMetareview()' function which indirectly invokes the two new functions.
Now let us look at the implementation of the two new functions, we used a local storage variable called 'meta'.So based on the status of the checkbox a value is assigned to the local storage variable. For example, if the 'Use metareview deadline' checkbox is checked then the local storage variable is initialized with the value 'show' and if the 'Use metareview deadline' checkbox is Unchecked we assign with the value 'hide' to the local storage variable. Now after storing the respective values for the local storage variable, the storage event is triggered by these functions. The below code snippet shows the implementation of the two new functions:
In _review_strategy.html.erb file:
Small modifications have been made to the existing code that is the display of the table row with id 'meta' is given 'none' by default and also the status of the 'Has Meta-review Limit?' checkbox is changed to false. The below code snippet shows the modifications made:
we wrote a javascript code that handles the event triggered when the 'Use metareview deadline' checkbox has been checked or unchecked. In this javascript, the event triggered is handled by calling the 'onStorageEvent(storageEvent)' function. In this 'onStorageEvent' function we check the value in the local storage variable and based on that value we change the status of the display for the table row with id 'meta'.
Finally, the null value to the 'Has Meta-review Limit?' can be assigned during the creation of the table and on clicking the 'Has Meta-review Limit?' checkbox the UI displays '3' in the allowed number of metareviews that is num_metareviews_allowed variable is assigned '3'.
Test Plan
1. Ensure that when an assignment is created, the number of meta-reviews is set to null.
2. Ensure that the meta-review fields in the review strategy tab are visible only when 'Use metareview deadline' is enabled in the Due dates tab.