-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Backend Validation for Questions #8646
Comments
@crphang sir As I am able to understand that |
Based on current design:
What we can do is let |
@crphang sir for each type of question there is their different individual error message which is generated after validating from |
@shaharyar-shamshi yes. But And yes, refactoring involves changing all the validateQuestionDetails for all question types. |
@crphang sir should we also throw null parameter error to the user when particular field(if required) is empty empty. |
@shaharyar-shamshi, this is left to each question's design of validation. I believe we will add that into the error list to be displayed to user. To clarify further, this issue is more about refactoring the flow of how validation is done, than what the validation is and should be specifically for each question. |
In V7, there is no |
Currently when adding new questions, a sample data flow works like this.
In
InstructorFeedbackQuestionAddAction
In
extractFeedbackQuestionData
:extractQuestionDetails
, which already does a validation of the fields, and add to the instance variable.Text/Json
.From
feedbackQuestion.getQuestionDetails().validateQuestionDetails();
:It picks up the fields that in the metadata, and validates them, returning errors to the user when appropriate. There are a few issues with this flow.
When
extractQuestionDetails
realises that the fields are invalid, it can do a few things:validateQuestionDetails
, we pick up this dummy value and know its an error and tell the user.validateQuestionDetails
and let the user know of the errors.Both techniques are not perfect due to the coupling between store persistence,
extractQuestionDetails
andvalidateQuestionDetails
. An implementation that could work is to allowextractQuestionDetails
to return the errors since it's already doing the validation, after all, invalid fields should not be permeated in the database.The text was updated successfully, but these errors were encountered: