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
No edit summary
Line 30: Line 30:
* If the same request is re-sent, the system adds the same submission for review a second time.
* 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.
::'''Click this button multiple times without stopping.'''
[[File:Submit_review_button.png]]
[[File:Submit_review_button.png]]


::Result after multiple clicks
::'''Result after multiple clicks'''
[[File:result_1956.png]]
[[File:result_1956.png]]



Revision as of 00:22, 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 (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).

Current Implementation

Functionality
  • 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

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

    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

      # 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

Current 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. In order to implement this functionality, we created an instance variable 'review_mappings' that contains the reviews done by a particular 'reviewer.id'. The 'if' condition checks whether the number of tuples in 'review_mappings' is less than the number of reviews allowed for that submission. If yes, then the student is allowed to make an additonal review. Otherwise, a flash message would be generated saying that no more submissions are allowed for the current user.

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.