test: testing system and fix bugs
This commit is contained in:
@@ -3,14 +3,15 @@ Authorization: Bearer {{$global.accessToken}}
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"testId": 1
|
||||
"testId": 2
|
||||
}
|
||||
|
||||
POST {{baseUrl}}/submissions/2/answer
|
||||
POST {{baseUrl}}/submissions/1/answer
|
||||
Authorization: Bearer {{$global.accessToken}}
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
// "choiceId": 2
|
||||
"numericValue": 8
|
||||
// "choiceId": 17
|
||||
// "numericValue": 12
|
||||
"choiceIds": [19,21]
|
||||
}
|
||||
|
||||
@@ -77,7 +77,6 @@ export class StartSubmissionProvider {
|
||||
relations: {
|
||||
toQuestion: {
|
||||
choices: true,
|
||||
rangeRules: true,
|
||||
},
|
||||
},
|
||||
order: {
|
||||
|
||||
@@ -14,9 +14,13 @@ export class SubmissionAnswerValidator implements ValidatorConstraintInterface {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
const obj = validationArguments?.object as any;
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
const { choiceId, numericValue } = obj;
|
||||
const { choiceId, numericValue, choiceIds } = obj;
|
||||
|
||||
return choiceId !== undefined || numericValue !== undefined;
|
||||
return (
|
||||
choiceId !== undefined ||
|
||||
numericValue !== undefined ||
|
||||
choiceIds !== undefined
|
||||
);
|
||||
}
|
||||
|
||||
defaultMessage?(): string {
|
||||
@@ -24,7 +28,7 @@ export class SubmissionAnswerValidator implements ValidatorConstraintInterface {
|
||||
|
||||
return (
|
||||
i18n?.t('submissions.errors.choiceNumericConstraint') ??
|
||||
'You must send either choiceId or numericValue.'
|
||||
'You must send either choiceId, choiceIds or numericValue.'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user