Implement GET and PATCH /overall_comment API routes, closes #7708#7963
Conversation
|
Noting that I will update the API documentation and open a PR for that on Monday. |
Coverage Report for CI Build 26410002258Coverage increased (+0.02%) to 90.277%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats💛 - Coveralls |
84ce689 to
854fe4c
Compare
david-yz-liu
left a comment
There was a problem hiding this comment.
@philipkukulak nice work, I left a few comments, and also please make sure to update the Changelog.
| format.json { render json: { overall_comment: result.overall_comment } } | ||
| end | ||
| when 'PATCH' | ||
| if result.update(overall_comment: params[:overall_comment]) |
There was a problem hiding this comment.
Here we should check whether :overall_comment is present in the params first. If it isn't, render the 422 error response (similar to how we do this in update_marking_state).
Separately, when reviewing this I realized that we should not allow the overall_comment field to be updated if the result is released. This should actually be controlled by a model validation (i.e., within the Result class). There's already a validation but it's only checking a change to the marking_state status, so please add to that validation to detect a change to the overall_comment field.
There was a problem hiding this comment.
Thank you David. I've updated the overall_comment method to validate the existence of :overall_comment when a PATCH is received since no parameter is sent for GET requests.
I've also added a case to the check_for_released method in the Result model.
Tests updated accordingly, and Changelog has been updated as well. I'll work on documentation shortly.
854fe4c to
977967e
Compare
david-yz-liu
left a comment
There was a problem hiding this comment.
Nice work, @philipkukulak!
Proposed Changes
Implements
GETandPATCH/overall_comment, allowing for API retrieval and updating of theoverall_commentfield in theresultstable. Closes #7708.GET/api/courses/:course_id/assignments/:assignment_id/groups/:id/overall_comment— returns the current overall comment for a group's resultPATCH/api/courses/:course_id/assignments/:assignment_id/groups/:id/overall_comment— sets or clears the overall commentBoth endpoints return JSON or XML depending on the Accept header, consistent with the rest of the API.
Screenshots of your changes (if applicable)
n/aAssociated documentation repository pull request (if applicable)
https://github.com/MarkUsProject/Wiki/pull/263Type of Change
(Write an
Xor a brief description next to the type or types that best describe your changes.)Checklist
(Complete each of the following items for your pull request. Indicate that you have completed an item by changing the
[ ]into a[x]in the raw text, or by clicking on the checkbox in the rendered description on GitHub.)Before opening your pull request:
After opening your pull request:
Questions and Comments
Detailed description of smoke tests:
Smoke Test:
GET/PATCH .../groups/:id/overall_commentSetup
Prerequisites
docker compose up -d railshttp://localhost:3000/csc108/api/...Variables used in all commands below
Reset to a known state before running:
Test Cases
Auth
Format
Routing
GET
PATCH
Results (2026-05-22)
{"overall_comment":...}<result><overall-comment>""null