CSC/ECE 517 Fall 2019 - E1956. There is no shortcut to get free review points: Review Assignment Bug: Difference between revisions
No edit summary |
(Review Mapping Controller changes) |
||
Line 29: | Line 29: | ||
===Files modified=== | ===Files modified=== | ||
* review_mapping_controller_spec.rb | * review_mapping_controller_spec.rb | ||
<pre> | |||
</pre> | |||
* review_mapping_controller.rb | * review_mapping_controller.rb | ||
<pre> | |||
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 | |||
</pre> | |||
====Changes Implemened==== | ====Changes Implemened==== | ||
* 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. | * 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== | ==Future Implementation== |
Revision as of 23:45, 28 October 2019
E1553. 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).
- If the same request is re-sent, the system adds the same submission for review a second time.
Current Implementation
Functionality
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 Implemened
- 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.