Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

E2479_Reimplement teams_users_controller.rb #146

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

manideepika21
Copy link

The teams_users_controller.rb needs to be reimplemented from the Expertiza repository to the reimplementation-back-end repository to follow SOLID and DRY principles. The TeamsUsersController class is responsible for managing the interactions between teams associated with assignments or courses and the participants (users associated to those assignments or courses) in those teams. Its main functionalities include listing team members, adding participants to teams, removing participants from teams, updating participants' duties within teams, and providing auto-complete suggestions for participant names when adding new members, and bulk deletion. Overall, this controller encapsulates the logic required to manage communication between the respectful view and model classes.

What needs to be done?

Primarily, TeamsUsersController class needs to be modified into TeamsParticipantsController since participants are the ones who are associated with assignments or courses (look at expertiza wiki for the respective tables). The next big issue is in the create method, which is too long. Reimplementing this method with DRY principles should result in a shorter, more readable code.

Instead of a TeamsUsersController, write a TeamsParticipantsController, and update all associations and references, accordingly.
The controller has to house functionalities that deal with interactions between the views and models. Methods from the existing controller can be reimplemented in the model class if they do not interact with the user.
The create method is longer than it needs to be. DRY principle is not followed in this method. Make use of helper methods for shared logic to improve code readability.
The create method also has unnecessary nestings. Use coding best practices to write clean code.
When a user is added to a team, you should make sure that the user is not on any other team unless the user is a mentor for that assignment, and the team does not already have a mentor. This functionality should be coded in AssignmentTeam and MentoredTeam so that polymorphism can be used. It should not be in the controller.
Use an appropriate naming convention for the variables since they are inconsistent throughout the class.
Ensure SOLID and DRY principles are maintained in your reimplementation.
Write detailed tests for every action in the controller. Passing all test cases is crucial.
Write descriptive comments to make the code easily readable and maintainable.

manideepika21 and others added 19 commits November 25, 2024 10:45
- Refactored the logic for adding/removing users to Team and TeamUser models
- Cleaned up create action
- Refgactored delete method
- Improved list method
- Enhance delete_selected method
…ctores the code with detailed comments and the variable names
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant