test: testing system and fix bugs
This commit is contained in:
@@ -9,7 +9,7 @@
|
|||||||
},
|
},
|
||||||
"errors": {
|
"errors": {
|
||||||
"alreadyTookTest": "You already took this test.",
|
"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.",
|
"emptyNumericValue": "A numeric value should be provided as answer.",
|
||||||
"numericValueRange": "Numeric value is out of specified range.",
|
"numericValueRange": "Numeric value is out of specified range.",
|
||||||
"emptyChoiceId": "Choice Id should be provided as answer.",
|
"emptyChoiceId": "Choice Id should be provided as answer.",
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ Authorization: Bearer {{$global.accessToken}}
|
|||||||
Content-Type: application/json
|
Content-Type: application/json
|
||||||
|
|
||||||
{
|
{
|
||||||
"question": 6,
|
"question": 13,
|
||||||
"text": "Option 2",
|
"text": "Option 4",
|
||||||
"value": 1,
|
"value": 1,
|
||||||
"order": 2,
|
"order": 4,
|
||||||
"score": 8
|
"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
|
Content-Type: application/json
|
||||||
|
|
||||||
{
|
{
|
||||||
"test": 1,
|
"test": 2,
|
||||||
"type": "end",
|
"type": "end",
|
||||||
"fromQuestion": 7
|
"fromQuestion": 13
|
||||||
// "toQuestion": 7
|
// "toQuestion": 13
|
||||||
// "conditionValue": {"min": 51, "max": 100}
|
// "conditionValue": {"min": 11, "max": 20}
|
||||||
// "conditionValue": {"choiceId": 5}
|
// "conditionValue": {"choiceId": 16 }
|
||||||
|
// "conditionValue": {"choiceIds": [13, 14, 15], "operator": "all"}
|
||||||
}
|
}
|
||||||
@@ -3,11 +3,11 @@ Authorization: Bearer {{$global.accessToken}}
|
|||||||
Content-Type: application/json
|
Content-Type: application/json
|
||||||
|
|
||||||
{
|
{
|
||||||
"test": 1,
|
"test": 2,
|
||||||
"content": "سوال هفتم",
|
"content": "Q6",
|
||||||
"required": true,
|
"required": true,
|
||||||
"type": "numeric"
|
"type": "multi-choice"
|
||||||
// "metadata": { "min": -10, "max": 10 }
|
// "metadata": { "min": 0, "max": 100 }
|
||||||
}
|
}
|
||||||
|
|
||||||
POST {{baseUrl}}/admin/questions/range-rules
|
POST {{baseUrl}}/admin/questions/range-rules
|
||||||
@@ -15,8 +15,8 @@ Authorization: Bearer {{$global.accessToken}}
|
|||||||
Content-Type: application/json
|
Content-Type: application/json
|
||||||
|
|
||||||
{
|
{
|
||||||
"question": 5,
|
"question": 11,
|
||||||
"min": 1,
|
"min": 51,
|
||||||
"max": 10,
|
"max": 100,
|
||||||
"score": 8
|
"score": 5
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
GET {{baseUrl}}/admin/tests?title=test&isActive=true&accessType=paid&sortBy=title&order=DSC&page=2&limit=1
|
GET {{baseUrl}}/admin/tests?title=test&isActive=true&accessType=paid&sortBy=title&order=DSC&page=2&limit=1
|
||||||
Authorization: Bearer {{$global.accessToken}}
|
Authorization: Bearer {{$global.accessToken}}
|
||||||
|
|
||||||
GET {{baseUrl}}/admin/tests/4
|
GET {{baseUrl}}/admin/tests/1
|
||||||
Authorization: Bearer {{$global.accessToken}}
|
Authorization: Bearer {{$global.accessToken}}
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
PATCH {{baseUrl}}/admin/tests/4
|
PATCH {{baseUrl}}/admin/tests/2
|
||||||
Authorization: Bearer {{$global.accessToken}}
|
Authorization: Bearer {{$global.accessToken}}
|
||||||
Content-Type: application/json
|
Content-Type: application/json
|
||||||
|
|
||||||
{
|
{
|
||||||
"accessType": "login",
|
// "accessType": "login",
|
||||||
"isActive": false
|
// "isActive": false
|
||||||
|
"status": "published"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ Content-Type: application/json
|
|||||||
Authorization: Bearer {{$global.accessToken}}
|
Authorization: Bearer {{$global.accessToken}}
|
||||||
|
|
||||||
{
|
{
|
||||||
"title": "Test One",
|
"title": "Test Two",
|
||||||
"description": "Description One",
|
"description": "Description Two",
|
||||||
"accessType": "login",
|
"accessType": "login",
|
||||||
"isActive": true
|
"isActive": true
|
||||||
}
|
}
|
||||||
@@ -3,14 +3,15 @@ Authorization: Bearer {{$global.accessToken}}
|
|||||||
Content-Type: application/json
|
Content-Type: application/json
|
||||||
|
|
||||||
{
|
{
|
||||||
"testId": 1
|
"testId": 2
|
||||||
}
|
}
|
||||||
|
|
||||||
POST {{baseUrl}}/submissions/2/answer
|
POST {{baseUrl}}/submissions/1/answer
|
||||||
Authorization: Bearer {{$global.accessToken}}
|
Authorization: Bearer {{$global.accessToken}}
|
||||||
Content-Type: application/json
|
Content-Type: application/json
|
||||||
|
|
||||||
{
|
{
|
||||||
// "choiceId": 2
|
// "choiceId": 17
|
||||||
"numericValue": 8
|
// "numericValue": 12
|
||||||
|
"choiceIds": [19,21]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,7 +77,6 @@ export class StartSubmissionProvider {
|
|||||||
relations: {
|
relations: {
|
||||||
toQuestion: {
|
toQuestion: {
|
||||||
choices: true,
|
choices: true,
|
||||||
rangeRules: true,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
order: {
|
order: {
|
||||||
|
|||||||
@@ -14,9 +14,13 @@ export class SubmissionAnswerValidator implements ValidatorConstraintInterface {
|
|||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||||
const obj = validationArguments?.object as any;
|
const obj = validationArguments?.object as any;
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
// 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 {
|
defaultMessage?(): string {
|
||||||
@@ -24,7 +28,7 @@ export class SubmissionAnswerValidator implements ValidatorConstraintInterface {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
i18n?.t('submissions.errors.choiceNumericConstraint') ??
|
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