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
E2409. Refactor sign_up_sheet_controller.rb #2777
Open
Harshil47
wants to merge
20
commits into
expertiza:main
Choose a base branch
from
Harshil47:main
base: main
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
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.
Open
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
Expertiza: Refactor update and signup_as_instructor_action methods
Refactored delete_signup and delete_signup_as_instructor as it has much in common and violates the DRY principle.
Update sign_up_sheet_controller.rb
refactored save_topic_headline function part 1
renamed methods, variables and change to fix codeql issue
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.
1.The previous version of the project fixed the naming discrepancy issue. We have validated it and found no other changes.
2.Refactored delete_signup and delete_signup_as_instructor - to create a centralized the shared functionality, delete_signup_common, a new method which lessens redundancy and enhances maintainability.
3.Refactoring the Update method to make it more concise and readable. It uses the Rails 'update_attributes' method to update multiple attributes of the @topic object in a single call. It also sets a success flash message when the topic is updated successfully, which was missing in the original code.
4.Refactoring the signup_as_instructor_action method - We have reduced the function length which was raised in the Code Climate issue. Also added multiple helper function to reduce the if-else ladder complexity. We added a new user_registered_for_assignment, process_signup_as_instructor_request helper functions as well as log_message function to make sure DRY principle is followed while logging messages.
5. Refactoring the save_topic_deadlines method Part-1 - As part 1 of refactoring save_topic_deadlines we will be reducing the number of lines of code for this function as it exceeds the limit which was raised in code climate. For this we gave create separate create and update methods of creating and saving TopicDueDate object. Additionally instance_variable_get('@assignment_' + deadline_type + 'due_dates')[i - 1] and instance_variable_get('@topic' + deadline_type + '_due_date') were used multiple number of times