test: testing system and fix bugs
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
},
|
||||
"errors": {
|
||||
"alreadyTookTest": "You already took this test.",
|
||||
"choiceNumericConstraint": "You must send either choiceId or numericValue.",
|
||||
"choiceNumericConstraint": "You must send either choiceId, choiceIds or numericValue.",
|
||||
"emptyNumericValue": "A numeric value should be provided as answer.",
|
||||
"numericValueRange": "Numeric value is out of specified range.",
|
||||
"emptyChoiceId": "Choice Id should be provided as answer.",
|
||||
|
||||
@@ -3,9 +3,9 @@ Authorization: Bearer {{$global.accessToken}}
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"question": 6,
|
||||
"text": "Option 2",
|
||||
"question": 13,
|
||||
"text": "Option 4",
|
||||
"value": 1,
|
||||
"order": 2,
|
||||
"score": 8
|
||||
"order": 4,
|
||||
"score": 10
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
DELETE {{baseUrl}}/admin/question-transitions/26
|
||||
Authorization: Bearer {{$global.accessToken}}
|
||||
Content-Type: application/json
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
PATCH {{baseUrl}}/admin/question-transitions/26
|
||||
Authorization: Bearer {{$global.accessToken}}
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"toQuestion": 13
|
||||
}
|
||||
+6
-5
@@ -3,10 +3,11 @@ Authorization: Bearer {{$global.accessToken}}
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"test": 1,
|
||||
"test": 2,
|
||||
"type": "end",
|
||||
"fromQuestion": 7
|
||||
// "toQuestion": 7
|
||||
// "conditionValue": {"min": 51, "max": 100}
|
||||
// "conditionValue": {"choiceId": 5}
|
||||
"fromQuestion": 13
|
||||
// "toQuestion": 13
|
||||
// "conditionValue": {"min": 11, "max": 20}
|
||||
// "conditionValue": {"choiceId": 16 }
|
||||
// "conditionValue": {"choiceIds": [13, 14, 15], "operator": "all"}
|
||||
}
|
||||
@@ -3,11 +3,11 @@ Authorization: Bearer {{$global.accessToken}}
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"test": 1,
|
||||
"content": "سوال هفتم",
|
||||
"test": 2,
|
||||
"content": "Q6",
|
||||
"required": true,
|
||||
"type": "numeric"
|
||||
// "metadata": { "min": -10, "max": 10 }
|
||||
"type": "multi-choice"
|
||||
// "metadata": { "min": 0, "max": 100 }
|
||||
}
|
||||
|
||||
POST {{baseUrl}}/admin/questions/range-rules
|
||||
@@ -15,8 +15,8 @@ Authorization: Bearer {{$global.accessToken}}
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"question": 5,
|
||||
"min": 1,
|
||||
"max": 10,
|
||||
"score": 8
|
||||
"question": 11,
|
||||
"min": 51,
|
||||
"max": 100,
|
||||
"score": 5
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
GET {{baseUrl}}/admin/tests?title=test&isActive=true&accessType=paid&sortBy=title&order=DSC&page=2&limit=1
|
||||
Authorization: Bearer {{$global.accessToken}}
|
||||
|
||||
GET {{baseUrl}}/admin/tests/4
|
||||
GET {{baseUrl}}/admin/tests/1
|
||||
Authorization: Bearer {{$global.accessToken}}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
PATCH {{baseUrl}}/admin/tests/4
|
||||
PATCH {{baseUrl}}/admin/tests/2
|
||||
Authorization: Bearer {{$global.accessToken}}
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"accessType": "login",
|
||||
"isActive": false
|
||||
// "accessType": "login",
|
||||
// "isActive": false
|
||||
"status": "published"
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@ Content-Type: application/json
|
||||
Authorization: Bearer {{$global.accessToken}}
|
||||
|
||||
{
|
||||
"title": "Test One",
|
||||
"description": "Description One",
|
||||
"title": "Test Two",
|
||||
"description": "Description Two",
|
||||
"accessType": "login",
|
||||
"isActive": true
|
||||
}
|
||||
@@ -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