-
Notifications
You must be signed in to change notification settings - Fork 115
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
manideepika21
wants to merge
19
commits into
expertiza:main
Choose a base branch
from
manideepika21:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- 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
…ods to this model
…ctores the code with detailed comments and the variable names
…l teams_participant and assignment models
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.