CSC/ECE 517 Fall 2021 - E2128. Refactor student quizzes controller.rb & late policies controller.rb
This wiki page is for the description of changes made under E2128 OSS assignment for Fall 2021, CSC/ECE 517.
Introduction
Expertiza is a web application developed using Ruby on Rails that serves as a peer-review system. The application allows students to submit and peer-review learning objects (articles, code, websites, etc)Expertiza on GitHub Expertiza Wiki Page. It is an open-source project and its codebase is maintained on GitHub. We are contributing to Expertiza as a part of our Object-Oriented Design and Development's Open-Source Software (OSS) Project. Our goal in this project is to refactor the StudentQuiz controller and LatePolicies Controller. In this Wiki Page, we would be explaining the changes that we have made for the same.
Modifications made to student_quizzes_controller
Line 23
Added a method comment to better describe the purpose of finished_quiz method.
Method : finished_quiz
After Refactoring
# Gets the last submission for a quiz by a student
Line 24
Updated the query from .first to .last as we want to get the latest score and not the first score, in the case a team/student submitted the quiz multiple times.
Method : finished_quiz
Before Refactoring
@response = Response.where(map_id: params[:map_id]).first
After Refactoring
@response = Response.where(map_id: params[:map_id]).last # Get the last score if a student took a quiz multiple times
Line 28
Method: finished_quiz
The code under consideration is the following
@participant = AssignmentTeam.find(@map.reviewee_id).participants.first
We get the first participant from the list of participants from AssignmentTeam, which is stored in the variable @participant. Therefore no refactor is required for this issue.
Line 34
Updated the method comment to better explain its purpose.
Method : self.take_quiz
Before Refactoring
# Create an array of candidate quizzes for current reviewer
After Refactoring
# Returns an array of candidate quizzes for current reviewer
Lines 53-96
As the method calculate_score has not yet been completed, skipping this issue, as directed by Professor Gehringer.
Line 98
Added method comment to record response to describe its purpose.
Method : record_response
After Refactoring
# Saves the response by the student only if the student has not taken the quiz before.
Line 108
As the method calculate_score has not yet been completed, skipping this issue, as directed by Professor Gehringer.
Line 110
Fixed the english of the flash message as the word records was ambiguous.
Method : record_response
Before Refactoring
flash[:error] = "You have already taken this quiz, below are the records for your responses."
After Refactoring
flash[:error] = "You have already taken this quiz. Please find your previous submission below."
Line 119
Update the method comment to better describe review_questions.
Method : review_questions
Before Refactoring
# This method is only for quiz questionnaires, it is called when instructors click "view quiz questions" on the pop-up panel.
After Refactoring
# Gets all the questionnaire responses by all the teams for a particular assignment
Modifications made to late_policies_controller
Issue 1
< Add description here >
Issue 2
< Add description here >
Issue 3
< Add description here >