Skip to content

E2550: reimplement responses hierarchy responses controller back end#292

Closed
bhandariprerak wants to merge 63 commits intoexpertiza:mainfrom
bhandariprerak:develop
Closed

E2550: reimplement responses hierarchy responses controller back end#292
bhandariprerak wants to merge 63 commits intoexpertiza:mainfrom
bhandariprerak:develop

Conversation

@bhandariprerak
Copy link
Copy Markdown
Collaborator

Yu Wang and others added 30 commits October 26, 2025 12:43
…bestinlalu#9, bestinlalu#20] Implement ResponseController class with all APIs and testing done using rspec
[bestinlalu#4, bestinlalu#5, bestinlalu#6, bestinlalu#7, bestinlalu#8, bestinlalu#9, bestinlalu#20] Implement ResponseController class with all APIs and testing done using rspec
…-back-end into ScoreLogic

Adding controller updates to the ScoreLogic
Implemented name link from Edit to Update
Removed save_draft endpoint, Removed using Reviewer role, Updated rspec
Removing mock data from rails_helper
Code clean up, removing output statements
Update the swagger with new response endpoints
bestinlalu and others added 21 commits November 14, 2025 10:56
Changes as per few review comments in the response_controller
Updated response specs and clarified response_map helpers
…s; prefer upcoming for deadlines; reduce rounding in report diffs
Comment thread app/controllers/responses_controller.rb Outdated
resp.map.reviewer&.id == current_user.id
end

# Variant helpers for parent-admin checks
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't these be more general parent_admin methods? Putting them in the response class makes them vulnerable to a DRY problem if another class needs to do the same check.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep these wrappers local to this controller for now. The shared primitives (find_assignment_instructor, current_user_ancestor_of?, role checks) are already provided by Authorization. The policy here is response-specific: allow an Administrator only when they are an ancestor of the assignment's instructor, which is the rule used to reopen/delete responses and to let an admin act on a response map during creation.

Comment thread app/controllers/responses_controller.rb Outdated
Comment thread app/models/response.rb
reviewer_assignment.assignment_questionnaires.find_by(used_in_round: self.round).questionnaire
end

# Backward-compatible wrapper around ResponseMap#response_map_label.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does "backward-compatible" mean? There should only be one format for ResponseMaps.

Comment thread app/models/response.rb

# calculates the average score of all other responses
average_score = total / count
# Calculate average of peers by dividing once at the end
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a potential DRY violation. Is there any way this code could be rewritten to leverage the mixin that does grade calculation?

end

# returns the assignment related to the response map
# Returns the assignment context for this map, derived from the reviewer participant.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is an "assignment context"?!

record.respond_to?(:updated_at) && record.updated_at.present?
end

def reviewee_exposes_team?(reviewee_record)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All methods need clear & concise method comments!

reviewee_record.respond_to?(:team) && reviewee_record.team.present?
end

def team_exposes_memberships?(team_record)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

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.

6 participants