CSC/ECE 517 Fall 2024 - E2450. Refactor assignments controller.rb: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
Line 47: Line 47:


=== '''Clarify aq Parameter Naming in list_unassigned_rubrics & remove_existing_questionnaire''' ===  
=== '''Clarify aq Parameter Naming in list_unassigned_rubrics & remove_existing_questionnaire''' ===  
==== Original Code ====  
==== What ====
*Todo
Todo.
==== Updated Code ====  
==== Why ====
*Todo
Todo
 
==== How ====
Todo
 


=== '''Fixing the Github required checks''' ===  
=== '''Fixing the Github required checks''' ===  
==== Original Code ====  
==== What ====
*Todo
Todo.
==== Updated Code ====  
==== Why ====
*Todo
Todo
 
==== How ====
Todo
 


=== '''Refactor Variable Naming for Clarity''' ===  
=== '''Refactor Variable Naming for Clarity''' ===  
==== Original Code ====  
==== What ====
*Todo.
Todo.
==== Updated Code ====  
==== Why ====
Todo
Todo
==== How ====
Todo


=== '''Review path Method Location''' ===  
=== '''Review path Method Location''' ===  
==== Original Code ====  
==== What ====
*Todo  
Todo.
==== Updated Code ====  
==== Why ====
Todo
Todo
==== How ====
Todo


=== '''Refactor Authorization Checks''' ===  
=== '''Refactor Authorization Checks''' ===  
==== Original Code ====  
==== What ====
*Todo.
Todo.
==== Updated Code ====  
==== Why ====
*Todo.
Todo
 
==== How ====
Todo
 


=== '''Simplify Array Usage in Create Method''' ===  
=== '''Simplify Array Usage in Create Method''' ===  
==== Original Code ====  
==== What ====
*Todo.
Todo.
==== Updated Code ====  
==== Why ====
*Todo.
Todo
 
==== How ====
Todo
 


=== '''Refactor Method Names with 'Check'''' ===  
=== '''Refactor Method Names with 'Check'''' ===  
==== Original Code ====  
==== What ====
*Todo.
Todo.
==== Updated Code ====  
==== Why ====
*Todo.
Todo
 
==== How ====
Todo
 


=== '''Refactor query_participants_and_alert Method''' ===  
=== '''Refactor query_participants_and_alert Method''' ===  
==== Original Code ====  
==== What ====
*Todo.
Todo.
==== Updated Code ====  
==== Why ====
*Todo.
Todo
 
==== How ====
Todo
 





Revision as of 02:33, 30 October 2024

About Controller

The `AssignmentsController` handles actions related to managing assignments.Key functionalities include initializing a new assignment in the `new` action and creating assignments through the `create` action, with validations to prevent duplicate names and directory paths. If creation succeeds, it redirects appropriately; otherwise, it renders the form with errors. This controller ensures smooth assignment management by enforcing proper validations and access control throughout the process.

Functionality of assignments_controller

The `AssignmentsController` handles the management of assignments by providing actions for creating and initializing them while ensuring access control. It uses `before_action` callbacks to enforce authorization, ensuring only permitted users can interact with assignment-related features. The `new` action initializes a blank assignment object for form rendering, facilitating the creation of new assignments. Additionally, the `create` action is responsible for processing form submissions, validating input, and saving the assignment if it meets the criteria. This controller ensures that all assignment operations are secure, properly initialized, and follow the required business logic.

Problem Statement

The `assignments_controller` presents difficulties due to its large size, intricate structure, and absence of comments, making it challenging for developers to grasp its functionality. To address these issues, a thorough refactor is advised, breaking down lengthy methods into smaller, more manageable sections. This strategy would modularize complex logic, assigning specific tasks to individual parts within the controller’s responsibilities. Furthermore, the refactor should aim to remove redundant code by consolidating repetitive sections into reusable functions or utilities, enhancing code quality and reducing the risk of errors. By restructuring the controller and improving its documentation, developers can better understand its operations, making maintenance, debugging, and future updates more straightforward.

Tasks

1. Refactor create method

2. Refactor edit method

3. Refactor update method

4. Refactor delete method: New models for subclasses will be implemented to streamline organization and simplify management.

5. Reposition methods

6. Enhance Comments

7. Expand Test Coverage

Phase 1

  1. Clarify and Refactor exist_assignment variable.
  2. Clarify aq Parameter Naming in list_unassigned_rubrics & remove_existing_questionnaire.
  3. Fixing the Github required checks.
  4. Refactor Variable Naming for Clarity.
  5. Review path Method Location.
  6. Refactor Authorization Checks.
  7. Simplify Array Usage in Create Method.
  8. Refactor Method Names with 'Check'.
  9. Refactor query_participants_and_alert Method.

Test Cases

  1. To do

Implementation

Clarify and Refactor exist_assignment variable.

What

Todo.

Why

Todo

How

Todo

Clarify aq Parameter Naming in list_unassigned_rubrics & remove_existing_questionnaire

What

Todo.

Why

Todo

How

Todo


Fixing the Github required checks

What

Todo.

Why

Todo

How

Todo


Refactor Variable Naming for Clarity

What

Todo.

Why

Todo

How

Todo


Review path Method Location

What

Todo.

Why

Todo

How

Todo


Refactor Authorization Checks

What

Todo.

Why

Todo

How

Todo


Simplify Array Usage in Create Method

What

Todo.

Why

Todo

How

Todo


Refactor Method Names with 'Check'

What

Todo.

Why

Todo

How

Todo


Refactor query_participants_and_alert Method

What

Todo.

Why

Todo

How

Todo


Team

Mentor

  • Ameya Vaichalkar

Members

  • Avleen Mehal
  • Daksh Pratap Singh
  • Abhinav Sharma

References

  1. Expertiza