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
E2220: Refactoring reputation_web_service_controller #2291
Conversation
Generated by expertiza-bot |
Hey @krishnasaurabh, |
split db_query method, change method names
Split json_generator, db_query methods, changed param to list
# | ||
# result = ActiveRecord::Base.connection.select_all(query) | ||
def db_query(assignment_id, round_num, has_topic, another_assignment_id = 0) | ||
def calculate_peer_review_grade(response) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right now, I can see this method does 2 things,
- Getting answers based on response_id
- Calculating overall score
Can you send the answers object in the method parameter?
teams.each { |team| team_ids << team.id } | ||
def get_ids_list(tables) | ||
id_list = [] | ||
tables.each { |table| id_list << table.id } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use map function for this?
assignment_id_list << assignment_id_two unless assignment_id_two.zero? | ||
assignment_id_list | ||
end | ||
|
||
def send_post_request |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is scope of improvement in this method,
- The URL is hardcoded. Can you find a better place to place this URL in a constant and use it here?
- This method should only hit the post request, anything else (like generating request body, headers, decrypting response, etc) should not be the scope of this method.
…review_grade-method Updated the calculate_peer_review_grade method
Decomposed send_post_request method to abide the SRP principle
Updating variables instances
Used constants instead of url strings
…_test fixed failing test cases for client method
…op_to_map Changes for code comments and fixes for views
…ents_fix review comments fix
Fix typo reqest to request
Changes that are included in the Pull Request are:
A complete list of changes and description is present at https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2022_-_E2220:_Refactor_reputation_web_service_controller