CSC/ECE 517 Spring 2022 - E2216: Refactor late policies controller

From Expertiza_Wiki
Revision as of 12:47, 21 March 2022 by Wgplaga (talk | contribs) (Initial Wiki Start)
Jump to navigation Jump to search

Background

The later policies controller file manages the SCRUM from late policies. Chiefly, the file checks if new or updated late policies are valid policies, in that they do not have the same name as an already existing policy, does not have a late penatly per unit time that surpasses the max late penalty, and does not have a late penalty surpassing 100.

Team Members

  • Wyatt Plaga (wgplaga@ncsu.edu)
  • Sunjith Tumma (stumma2@ncsu.edu)
  • Shawn Salekin (ssaleki@ncsu.edu)

Description about project

This wiki describes the work done to refactor late_policies_controller.rb. The main focus of the work went into removing code duplication, as well as simplifying the code for readability, for the create and update methods. This also includes adding code comments for understandibility.

Files Involved

  • late_policies_controller.rb

Code Issues

1. All the late policies will show up on the index page, not just policies created by the current instructor. Need to create public & private late policies. Try to leverage code for private and public courses, assignments, and questionnaires. 2. create and update have some duplicate code. Fix that using a partial, _form. 3. Both create and update need comments and a better identifier naming. 4. Reduce code duplication. Find a way to make the code more DRY 5. Line 64: The if condition can be simplified. 6. Improve the variable name for same_policy_name. (Boolean variables can be named in a better way) 7. Add method comments 8. Find the use of instance variables in create and update method? Do we really need it? Can it be made local variables instead?

Code Changes

1. All the late policies will show up on the index page, not just policies created by the current instructor. Need to create public & private late policies. Try to leverage code for private and public courses, assignments, and questionnaires

Current code:


Modifications:



GitHub links

Link to Expertiza repository: here

Link to the forked repository: here