CSC/ECE 517 Spring 2022 - E2218: Refactor response controller
This page details project documentation for the CSC/ECE 517 Spring 2022, "E2218 refactor response_controller.rb" project.
Background
A response is the object that is created when someone fills out a review rubric, such as when one writes a review, gives feedback to a reviewer, or fills out a survey. Responses to the individual rubric items are kept in Answer objects; each Answer object has a response_id to say what Response it is part of. Since response_controller needs to work with many kinds of responses, its code is pretty general. It is not the worst controller in the system, but it would be much clearer if its method names were more descriptive of what they do.
Mentor
Ed Gehringer, efg@ncsu.edu
Team Members
- Sai Naga Vamshi Chidara (schidar@ncsu.edu)
- Akhil Kumar (amengan@ncsu.edu)
- Samson Mulkur (smulkur@ncsu.edu)
Code Modifications and Refactorization
Described below are the code refactoring tasks and issues addressed by this team. We have also included any pertinent details, reasonings, comments, warnings, etc., corresponding to each task.
- Initializing response and map variables
@response and @map instance variables are initialized the same way across multiple methods. In order to avoid duplication, we created a before_action action which will be called first before calling the corresponding methods.
Modified Files
response_controller.rb
response_helper.rb
assignment_questionnaire.rb
awarded_badge.rb
cake.rb
response.rb
Testing
Running Tests
rspec spec/controllers/questionnaires_controller_spec.rb
GitHub links and Pull Request
Link to Expertiza repository: here
Link to the forked repository: here
Link to Pull Request: here