CSC/ECE 517 Spring 2020 / E2001 Refactor Questionnaires Controller

From Expertiza_Wiki
Jump to navigation Jump to search

E2000 Refactor questionnaires_controller.rb

This page provides a description of the Expertiza based OSS project

About Expertiza

Expertiza is an open source software project created using Ruby on Rails. Expertiza allows instructors to craft new assignments and edit existing ones. This flexibility ensures that each round of students gets an experience that is appropriate to the given situation. It also allows the instructor to create a list of project options and have the students bid for their favorite project.

While their are a plethora of benefits for instructors, students also gain some benefits when using Expertiza. They are able to form teams and keep track of the past peers they have worked with, and are also able to manage the progress and submission of their assignments.

Problem Statement

Background: In Expertiza, Questionnaire is a super-class utilized by all questionnaires, including rubrics, quizzes, and surveys. Rubrics are used to assess things such as project submissions and project teammates. All of the above-mentioned questionnaires are sub-classes of the Questionnaire super-class. Since this super-class is used in a multitude of locations ensuring that there are no issues in the code is very important since an error can cause malfunctions throughout Expertiza.

Problem: Questionnaires controller has been refactored repeatedly over the past few years, yet some improvements can still be made through refactoring to increase the quality and dryness of the code.

These possible improvements are as follows:

  • Assess if the method called create_questionnaire is used and remove it if not
  • The create method is 49 lines long and needs to be broken up into smaller self-documenting methods
  • There are three checks for whether a questionnaire is a QuizQuestionnaire, evaluate the necessity of these and remove as needed.
  • Several methods have a questionnaire_id as a parameter, however This may not be necessary as params[:id] should be enough. Evaluate options and implement a solution.
  • Unprotected mass assignment in 3 different areas
  • Unsafe reflection method const_get called with parameter value in 4 locations
  • ADD MORE AS NEEDED

Files Modified in Project

Issues and Improvements

Testing Plan

RSpec Testing

Manual Testing

References