backend
backend copied to clipboard
Saving blank answer leads to 400 error
To reproduce
- Go to a mission
- Delete every line of code, leaving not even a newline
- Press save
An error 400 Bad Request will be sent from backend.
It appears that this is an issue with how the backend is designed, specifically in assessments.ex where the relevant error is returned here.
On further debugging it seems that a blank answer is not allowed by the backend:
errors: [answer: {"invalid answer provided for answer type.\nChangeset: #Ecto.Changeset<action: nil, changes: %{}, errors: [code: {\"can't be blank\", [validation: :required]}], data: #Cadet.Assessments.AnswerTypes.ProgrammingAnswer<>, valid?: false>", []}], data: #Cadet.Assessments.Answer<>, valid?: false>
I do believe that we should allow blank submissions (as you can just get around this by typing a newline/space), but let's hear what @RichDom2185 has to say about this.
Will be moving this issue to backend.