CSC/ECE 517 Fall 2019 - E1956. There is no shortcut to get free review points: Review Assignment Bug: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
Line 95: Line 95:
====Changes Implemented====
====Changes Implemented====
* The assign_review_dynamically method was previously not keeping a track of the number of assignments reviewed by a student.  
* The assign_review_dynamically method was previously not keeping a track of the number of assignments reviewed by a student.  
<pre>    The code in order to assign reviews in a dynamic fashion has been implemented in the review_mappings_controller.rb. The method assign_review_dynamically, checks initially if student has selected a topic for which he wants a review or if the "I don't care" is selected. Based on the selection the method would then select a submission which is
<pre>    The code in order to assign reviews in a dynamic fashion has been implemented in the review_mappings_controller.rb. The method assign_review_dynamically, checks initially if student has selected a  
topic for which he wants a review or if the "I don't care" is selected. Based on the selection the method would then select a submission which is
           1. Not assigned previously to given student
           1. Not assigned previously to given student
           2. Is not his own submission
           2. Is not his own submission
Line 104: Line 105:
         Creates a mapping from the student to assigned submission for reviewing as soon as assign_review_dynamically assigns a submission to student for review.
         Creates a mapping from the student to assigned submission for reviewing as soon as assign_review_dynamically assigns a submission to student for review.


We decided to get all the reviews assigned to given student from ReviewResponseMap (where(reviewer_id: reviewer.id)) and then check if the size of the reviews assigned to the given reviewer is more than maximum allocated for the assignment and creates a flash error if the maximum review limit is exceded.</pre>
We decided to get all the reviews assigned to given student from ReviewResponseMap (where(reviewer_id: reviewer.id)) and then check if the size of the reviews assigned to the given reviewer is more than  
maximum allocated for the assignment and creates a flash error if the maximum review limit is exceded.</pre>


==Future Implementation==
==Future Implementation==
Currently there is no check on whether a user has completely submitted the previous two reviews before requesting for additional reviews. So one of the future tasks would be to allow a user to request for a new submission if and only if the previously requested submissions have been completed.
Currently there is no check on whether a user has completely submitted the previous two reviews before requesting for additional reviews. So one of the future tasks would be to allow a user to request for a new submission if and only if the previously requested submissions have been completed.

Revision as of 00:44, 29 October 2019

E1956. There is no shortcut to get free review points: Review Assignment Bug

This page provides a description of the Expertiza based OSS project.

About Expertiza

Expertiza is an open source project based on Ruby on Rails framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.

Introduction

Background

Each assignment contains an assignment policy. We can generally submit n reviews according to assignment policy. For an assignment with topics, a student has an option to choose a submission to review or can say “I don’t care” and the system chooses any available topic for review.

Motivation

This project in particular intends that the students collaborate with each other and work on making enhancements to the code base by applying the concepts of Rails,RSpec, DRY code,Test driven development etc. This provides an opportunity for students to contribute to an open source project and learn further about software deployment etc.

List of Changes

Issues Presented

  • The number of reviews done by any student is not checked in the back-end with the maximum number of submissions allowed as per the assignment policy.
  • There is no check to see if the submission is already assigned to the student.

Current Implementation

  • No limitation on maximum number of peer reviews.
There is no check in the backend that limits the number of reviews a student can be assigned. There is a check in the UI, but you could evade the limit by typing in a URL to make the same post request. You can also evade it by clicking multiple times on "Request a review for submission" button in UI.
  • There is no check to see if the submission is already assigned to the student (on consulting the TA, it was made known that the feature was working correctly without editing any of the code and thus no refactoring was performed for this task).
  • If the same request is re-sent, the system adds the same submission for review a second time.
Click this button multiple times without stopping.

Result after multiple clicks

New Implementation

Files modified

  • review_mapping_controller_spec.rb



  • review_mapping_controller.rb

def assign_reviewer_dynamically
    assignment = Assignment.find(params[:assignment_id])
    reviewer = AssignmentParticipant.where(user_id: params[:reviewer_id], parent_id: assignment.id).first
 
    @review_mappings = ReviewResponseMap.where(reviewer_id: reviewer.id)
    if params[:i_dont_care].nil? && params[:topic_id].nil? && assignment.topics? && assignment.can_choose_topic_to_review?
      flash[:error] = "No topic is selected.  Please go back and select a topic."
    else
      if @review_mappings.size >= assignment.num_reviews_allowed
         flash[:notice] = "You cannot do more than " + assignment.num_reviews_allowed.to_s + " reviews based on assignment policy"
        
      else

      # begin
      if assignment.topics? # assignment with topics
        topic = if params[:topic_id]
                  SignUpTopic.find(params[:topic_id])
                else
                  assignment.candidate_topics_to_review(reviewer).to_a.sample rescue nil
                end
        if topic.nil?
          flash[:error] = "No topics are available to review at this time. Please try later."
        else
          assignment.assign_reviewer_dynamically(reviewer, topic)
        end

      else # assignment without topic -Yang
        assignment_teams = assignment.candidate_assignment_teams_to_review(reviewer)
        assignment_team = assignment_teams.to_a.sample rescue nil
        if assignment_team.nil?
          flash[:error] = "No artifacts are available to review at this time. Please try later."
        else
          assignment.assign_reviewer_dynamically_no_topic(reviewer, assignment_team)
        end

      end
    end
    # rescue Exception => e
    #   flash[:error] = (e.nil?) ? $! : e
    # end
    end
    redirect_to controller: 'student_review', action: 'list', id: reviewer.id
  end

Changes Implemented

  • The assign_review_dynamically method was previously not keeping a track of the number of assignments reviewed by a student.
     The code in order to assign reviews in a dynamic fashion has been implemented in the review_mappings_controller.rb. The method assign_review_dynamically, checks initially if student has selected a 
topic for which he wants a review or if the "I don't care" is selected. Based on the selection the method would then select a submission which is
           1. Not assigned previously to given student
           2. Is not his own submission

However, since the code did not have a check for how many reviews already are allocated to given student, one could easily bypass the review limit by sending the same post request again and again.

ReviewResponseMap:
        Creates a mapping from the student to assigned submission for reviewing as soon as assign_review_dynamically assigns a submission to student for review.

We decided to get all the reviews assigned to given student from ReviewResponseMap (where(reviewer_id: reviewer.id)) and then check if the size of the reviews assigned to the given reviewer is more than 
maximum allocated for the assignment and creates a flash error if the maximum review limit is exceded.

Future Implementation

Currently there is no check on whether a user has completely submitted the previous two reviews before requesting for additional reviews. So one of the future tasks would be to allow a user to request for a new submission if and only if the previously requested submissions have been completed.