-
Notifications
You must be signed in to change notification settings - Fork 172
E2550 Response hierarchy and responses_controller back end #227
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
base: main
Are you sure you want to change the base?
Conversation
Response Type Mapping
…-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
edited case descriptions
Removing mock data from rails_helper
Code clean up, removing output statements
Increase puma version to 6.4.2
Generated by 🚫 Danger |
Update the swagger with new response endpoints
|
🚨 RSpec Tests Report |
2 similar comments
|
🚨 RSpec Tests Report |
|
🚨 RSpec Tests Report |
|
🚨 RSpec Tests Report |
Score calculation test cases clean up
|
🚨 RSpec Tests Report |
1 similar comment
|
🚨 RSpec Tests Report |
efg
left a comment
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.
Lots of low-level issues to handle and fix.
| true | ||
| when 'update', 'submit' | ||
| @response = Response.find(params[:id]) | ||
| unless owns_response_or_map? || has_role?('Instructor') || has_role?('Admin') |
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.
The disjunction should be replaced by ~ has_privileges_of
| render json: { error: 'forbidden' }, status: :forbidden | ||
| end | ||
| when 'unsubmit', 'destroy' | ||
| unless has_role?('Instructor') || has_role?('Admin') |
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.
Shouldn't it also check to make sure this is the instructor's (or the admin's) assignment? Shouldn't be able to delete reviews for other people's assignments.
| return render json: { error: 'Response already submitted' }, status: :unprocessable_entity if @response.is_submitted? | ||
|
|
||
| # Check deadline | ||
| return render json: { error: 'Deadline has passed' }, status: :forbidden unless deadline_open?(@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.
deadline_open? is a bad name. What does that mean?
| return render json: { error: 'Deadline has passed' }, status: :forbidden unless deadline_open?(@response) | ||
|
|
||
| # Validate rubric completion | ||
| unanswered = @response.scores.select { |a| a.answer.nil? } |
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.
It is just WRONG to build into the mechanism that ALL rubric items must have text (or numbers) entered for ALL rubrics of ANY KIND anywhere in the system. This should be dependent on policy. Remove this check.
|
|
||
| if @response.is_submitted? | ||
| @response.update(is_submitted: false) | ||
| render json: { message: 'Response reopened for revision', response: @response }, status: :ok |
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.
The word "Response" here could be confusing. That's what it is in the system, but the UI should use better names. Don't we have print names for each different kind of Questionnaire? Also, "reopened for revision" is much too cryptic. Say it in plain English!
| return nil unless reviewee | ||
|
|
||
| candidates = [] | ||
| candidates << reviewee.updated_at if reviewee.respond_to?(:updated_at) && reviewee.updated_at.present? |
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.
respond_to? is confusing; that method should be renamed to something that is more suggestive of what it does.
Changes as per few review comments in the response_controller
Pr fixes related to response type mapping
Changes as per few review comments in the response_controller
…and clarified comments
Updated response specs and clarified response_map helpers
…prove user messages
efg
left a comment
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.
Thanks for fixing!
| true | ||
| when 'update', 'submit' | ||
| @response = Response.find(params[:id]) | ||
| unless response_belongs_to? || current_user_has_admin_privileges? || |
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.
It's not whether current_user_has_admin_privileges?; it's whether this user created (is the parent of) the instructor whose course this is. One of the current projects is writing/has written code for this. Not sure which, but it should be fairly easy to guess.
| # Checks whether the current_user is the instructor for the assignment | ||
| # associated with the response identified by params[:id]. | ||
| # Uses the shared authorization method from Authorization concern. | ||
| def current_user_instructs_response_assignment? |
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.
Not only the instructor, but also TAs for the course and the admin who created the instructor, need to be able to perform this method.
| return true if assignment.nil? | ||
| return true if assignment.due_dates.nil? | ||
|
|
||
| # Check if due_date has a future? method, otherwise compare timestamps |
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.
I think there is an "upcoming" method that does what you think future? does.
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.
I think "upcoming" is a better name.
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.
It's E2566, finish DueDates, who is using the upcoming method.
| # (each response can omit questions, so maximum_score may differ and we normalize before averaging) | ||
| existing_responses.each do |response| | ||
| unless id == response.id # the current_response is also in existing_responses array | ||
| count += 1 |
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.
Should this be in the ReviewAggregator mixin?
app/models/response.rb
Outdated
| unless id == response.id # the current_response is also in existing_responses array | ||
| count += 1 | ||
| total += response.aggregate_questionnaire_score.to_f / response.maximum_score | ||
| total += response.aggregate_questionnaire_score.to_f / response.maximum_score |
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.
Please remove the code smell.
…s; prefer upcoming for deadlines; reduce rounding in report diffs
This PR focuses on improving the Response system within Expertiza, which handles how peer reviews, teammate evaluations, and other questionnaire-based responses are stored and managed. Previously, response handling was scattered across different map controllers (e.g., ReviewResponseMap, TeammateReviewResponseMap), so the goal of this project is to centralize and standardize response management through enhancements to the Response model and the creation of a new ResponsesController on the back end.
Wiki Link: https://github.com/bestinlalu/reimplementation-back-end/wiki/Background