CSC/ECE 517 Fall 2022 - E2257: Refactor questionnaires controller.rb

From Expertiza_Wiki
Jump to navigation Jump to search

Introduction

In Expertiza, Questionnaire is the superclass for all kinds of questionnaires and rubrics—rubrics for evaluating submissions and teammate contributions, and taking quizzes and surveys. All of these are subclasses of Questionnaire. questionnaires_controller.rb is charged with creating, displaying, and managing Questionnaires. Because it is used so widely, malfunctions could cause bugs in many parts of the system; hence it is especially important that the code be clear.


Issues Fixed

  1. Removed create_questionnaire

Files Changed

Changes

Fix #1

The create_teams method's name poorly reflected it's actual function. The function takes a group of students from an assignment or course and creates randomized teams. To reflect this, the method was renamed to randomize_teams and a comment was added briefly describing the function. This also needed to be updated in the rspec test teams_controller_spec.rb:

  describe 'create teams method' do
    context 'when correct parameters are passed' do
      it 'creates teams with random names' do
        allow(ExpertizaLogger).to receive(:info).and_return(nil)
        ...
        user_session = { user: instructor, team_type: 'Assignment' }
        result = get :randomize_teams, params: request_params, session: user_session
        # status code 302: Redirect url
        ...
      end
    end
  end

Fix #2

Fix #3

Fix #4

Fix #5

Project Mentor

Edward Gehringer (efg@ncsu.edu)


Team Member

Ashwin Shankar Umasankar (aumasan@ncsu.edu)

Kailash Singaravelu (ksingar2@ncsu.edu)

Pujitha Enamandala (penaman@ncsu.edu)

Reference

  1. VCL link
  2. Github Repo
  3. Github Pull Request
  4. Expertiza on GitHub
  5. GitHub Project Repository Fork
  6. Expertiza Project Documentation Wiki
  7. CodeClimate Documentation