feat: update update_response
endpoint to replace values
#3711
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.
Description
After discussing with @damianpumar, we both agreed to update the
PUT /api/v1/responses/{response_id}
endpoint to behave like a realPUT
endpoint replacing thevalues
stored in the database with thevalues
received in the request.Therefore, this PR updates the
PUT /api/v1/responses/{response_id}
endpoint to do a complete update of theResponse.values
(replace the dict), as before the endpoint was behaving like aPATCH
endpoint. In addition, the PR updates the validation of the responses given for theRankingQuestion
when thestatus!=submitted
allowing the following response to be valid (missingrank
in some options, which means the user has not ranked this options yet):Type of change
How Has This Been Tested
In a local development environment:
PUT /api/v1/responses/{response_id}
updates the response for a record (overwritesResponse.values
)PUT /api/v1/responses/{response_id}
and the above JSON payload, the server accepts it and returns200
Checklist
CHANGELOG.md
file (See https://keepachangelog.com/)