added user response verification before saving

This commit is contained in:
iironside 2022-03-14 13:06:20 +03:00
parent fef52d8ff7
commit 60ad6c0e00
5 changed files with 218 additions and 39 deletions

View File

@ -4,7 +4,7 @@ namespace common\helpers;
use backend\modules\questionnaire\models\Answer;
use backend\modules\questionnaire\models\UserQuestionnaire;
use backend\modules\questionnaire\models\UserResponse;
use common\models\UserResponse;
use yii\helpers\ArrayHelper;
class ScoreCalculatorHelper

View File

@ -818,6 +818,14 @@
</th>
</tr>
<tr>
<td>
user_id
</td>
<td>
ID пользователя
</td>
</tr>
<tr>
<td>
question_id
</td>
@ -835,7 +843,7 @@
</tr>
<tr>
<td>
uuid
user_questionnaire_uuid
</td>
<td>
UUID анкеты назначенной пользователю(string 36)
@ -843,10 +851,18 @@
</tr>
</table>
<p>
Пример запроса:
Пример тела запроса:
</p>
`https://guild.craft-group.xyz/api/user-response/set-responses?user_id=1&user_questionnaire_id=1&question_id=7&response_body=user response string`
```json5
{
"user_id": "1",
"question_id": "7",
"response_body": "oooooooooooo111111111",
"user_questionnaire_uuid": "d222f858-60fd-47fb-8731-dc9d5fc384c5"
}
```
`https://guild.craft-group.xyz/api/user-response/set-response`
<p>
Возвращает объект <b>Ответа</b>. <br>
@ -855,21 +871,76 @@
```json5
{
"user_id": "1",
"question_id": "7",
"response_body": "user response string",
"user_questionnaire_uuid": "d222f858-60fd-47fb-8731-dc9d5fc384c5",
"created_at": {
"expression": "NOW()",
"params": []
},
"updated_at": {
"expression": "NOW()",
"params": []
},
"id": 90
"user_id": "1",
"question_id": "7",
"response_body": "oooooooooooo111111111",
"user_questionnaire_uuid": "d222f858-60fd-47fb-8731-dc9d5fc384c5",
"created_at": {
"expression": "NOW()",
"params": []
},
"updated_at": {
"expression": "NOW()",
"params": []
},
"id": 191,
"answer_flag": 0
}
```
<p>
Ответ содержит:
</p>
<table>
<tr>
<th>
Параметры
</th>
<th>
Значение
</th>
</tr>
<tr>
<td>
user_id
</td>
<td>
ID пользователя
</td>
</tr>
<tr>
<td>
question_id
</td>
<td>
ID вопроса(int)
</td>
</tr>
<tr>
<td>
response_body
</td>
<td>
Ответ пользователя(string 255)
</td>
</tr>
<tr>
<td>
user_questionnaire_uuid
</td>
<td>
UUID анкеты назначенной пользователю(string 36)
</td>
</tr>
<tr>
<td>
answer_flag
</td>
<td>
Флаг ответа(1 - верно, 0 - ложно)
</td>
</tr>
</table>
<p>
В случаии ошибки в запросе будет отправлено сообщение следующего вида:
</p>
@ -901,6 +972,14 @@
<th>
Значение
</th>
</tr>
<tr>
<td>
user_id
</td>
<td>
ID пользователя
</td>
</tr>
<tr>
<td>
@ -920,7 +999,7 @@
</tr>
<tr>
<td>
uuid
user_questionnaire_uuid
</td>
<td>
UUID анкеты назначенной пользователю(string 36)
@ -970,12 +1049,13 @@
"expression": "NOW()",
"params": []
},
"id": 137
"id": 192,
"answer_flag": 0
},
{
"user_id": "1",
"question_id": "4",
"response_body": "oooooooooooo2222222",
"question_id": "7",
"response_body": "oooooooooooo111111111",
"user_questionnaire_uuid": "d222f858-60fd-47fb-8731-dc9d5fc384c5",
"created_at": {
"expression": "NOW()",
@ -985,10 +1065,64 @@
"expression": "NOW()",
"params": []
},
"id": 138
"id": 193,
"answer_flag": 0
}
]
```
<p>
Ответ содержит:
</p>
<table>
<tr>
<th>
Параметры
</th>
<th>
Значение
</th>
</tr>
<tr>
<td>
user_id
</td>
<td>
ID пользователя
</td>
</tr>
<tr>
<td>
question_id
</td>
<td>
ID вопроса(int)
</td>
</tr>
<tr>
<td>
response_body
</td>
<td>
Ответ пользователя(string 255)
</td>
</tr>
<tr>
<td>
user_questionnaire_uuid
</td>
<td>
UUID анкеты назначенной пользователю(string 36)
</td>
</tr>
<tr>
<td>
answer_flag
</td>
<td>
Флаг ответа(1 - верно, 0 - ложно)
</td>
</tr>
</table>
<p>
В случаии ошибки в запросе будет отправлено сообщение следующего вида:
</p>

View File

@ -93286,3 +93286,34 @@
127.0.0.1 - - [08/Mar/2022:14:44:53 +0300] "GET /favicon.ico HTTP/1.1" 200 318 "http://backend.guild.loc/reports/reports" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
127.0.0.1 - - [08/Mar/2022:14:44:53 +0300] "GET /reports/ajax/get-reports-for-month-by-id-year-month?&month=03&year=2022 HTTP/1.1" 200 77 "http://backend.guild.loc/reports/reports" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
127.0.0.1 - - [08/Mar/2022:14:44:53 +0300] "GET /reports/ajax/get-reports-for-day-by-date?date=2022-03-08 HTTP/1.1" 200 458 "http://backend.guild.loc/reports/reports" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
127.0.0.1 - - [14/Mar/2022:12:34:10 +0300] "GET /questionnaire/user-response HTTP/1.1" 200 13946 "http://backend.guild.loc/questionnaire/user-questionnaire" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
127.0.0.1 - - [14/Mar/2022:12:34:11 +0300] "GET /assets/cd83ad4b/img/user2-160x160.jpg HTTP/1.1" 200 7070 "http://backend.guild.loc/questionnaire/user-response" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
127.0.0.1 - - [14/Mar/2022:12:34:11 +0300] "GET /css/site.css HTTP/1.1" 200 805 "http://backend.guild.loc/questionnaire/user-response" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
127.0.0.1 - - [14/Mar/2022:12:34:11 +0300] "GET /assets/ccdf1f3a/css/font-awesome.min.css HTTP/1.1" 200 31000 "http://backend.guild.loc/questionnaire/user-response" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
127.0.0.1 - - [14/Mar/2022:12:34:11 +0300] "GET /assets/cd83ad4b/css/AdminLTE.min.css HTTP/1.1" 200 106548 "http://backend.guild.loc/questionnaire/user-response" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
127.0.0.1 - - [14/Mar/2022:12:34:11 +0300] "GET /assets/cd83ad4b/css/skins/_all-skins.min.css HTTP/1.1" 200 41635 "http://backend.guild.loc/questionnaire/user-response" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
127.0.0.1 - - [14/Mar/2022:12:34:11 +0300] "GET /assets/ccdf1f3a/fonts/fontawesome-webfont.woff2?v=4.7.0 HTTP/1.1" 200 77160 "http://backend.guild.loc/assets/ccdf1f3a/css/font-awesome.min.css" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
127.0.0.1 - - [14/Mar/2022:12:34:11 +0300] "GET /debug/default/toolbar?tag=622f0c1274df8 HTTP/1.1" 200 3428 "http://backend.guild.loc/questionnaire/user-response" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
127.0.0.1 - - [14/Mar/2022:12:34:11 +0300] "GET /favicon.ico HTTP/1.1" 200 318 "http://backend.guild.loc/questionnaire/user-response" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
127.0.0.1 - - [14/Mar/2022:12:38:12 +0300] "POST /api/user-response/set-responses HTTP/1.1" 200 469 "-" "PostmanRuntime/7.28.4"
127.0.0.1 - - [14/Mar/2022:12:38:39 +0300] "POST /api/user-response/set-responses HTTP/1.1" 200 16 "-" "PostmanRuntime/7.28.4"
127.0.0.1 - - [14/Mar/2022:12:39:03 +0300] "POST /api/user-response/set-response HTTP/1.1" 201 32 "-" "PostmanRuntime/7.28.4"
127.0.0.1 - - [14/Mar/2022:12:39:23 +0300] "POST /api/user-response/set-response HTTP/1.1" 201 11 "-" "PostmanRuntime/7.28.4"
127.0.0.1 - - [14/Mar/2022:12:39:35 +0300] "POST /api/user-response/set-response HTTP/1.1" 201 14 "-" "PostmanRuntime/7.28.4"
127.0.0.1 - - [14/Mar/2022:12:40:15 +0300] "POST /api/user-response/set-response HTTP/1.1" 201 348 "-" "PostmanRuntime/7.28.4"
127.0.0.1 - - [14/Mar/2022:12:42:58 +0300] "POST /api/user-response/set-response HTTP/1.1" 201 370 "-" "PostmanRuntime/7.28.4"
127.0.0.1 - - [14/Mar/2022:12:45:29 +0300] "GET /questionnaire/user-response HTTP/1.1" 200 14420 "http://backend.guild.loc/questionnaire/user-response" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
127.0.0.1 - - [14/Mar/2022:12:45:30 +0300] "GET /debug/default/toolbar?tag=622f0eb9c99fd HTTP/1.1" 200 3425 "http://backend.guild.loc/questionnaire/user-response" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
127.0.0.1 - - [14/Mar/2022:12:45:37 +0300] "GET /questionnaire/user-questionnaire HTTP/1.1" 200 14485 "http://backend.guild.loc/questionnaire/user-response" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
127.0.0.1 - - [14/Mar/2022:12:45:37 +0300] "GET /debug/default/toolbar?tag=622f0ec1a3ac1 HTTP/1.1" 200 3427 "http://backend.guild.loc/questionnaire/user-questionnaire" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
127.0.0.1 - - [14/Mar/2022:12:45:41 +0300] "GET /questionnaire/user-questionnaire/view?id=1 HTTP/1.1" 200 13726 "http://backend.guild.loc/questionnaire/user-questionnaire" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
127.0.0.1 - - [14/Mar/2022:12:45:41 +0300] "GET /assets/9c1d1a99/jquery.pjax.js HTTP/1.1" 200 29273 "http://backend.guild.loc/questionnaire/user-questionnaire/view?id=1" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
127.0.0.1 - - [14/Mar/2022:12:45:41 +0300] "GET /debug/default/toolbar?tag=622f0ec4e4776 HTTP/1.1" 200 3419 "http://backend.guild.loc/questionnaire/user-questionnaire/view?id=1" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
127.0.0.1 - - [14/Mar/2022:12:49:28 +0300] "POST /api/user-response/set-response HTTP/1.1" 500 1639 "-" "PostmanRuntime/7.28.4"
127.0.0.1 - - [14/Mar/2022:12:51:51 +0300] "POST /api/user-response/set-response HTTP/1.1" 201 370 "-" "PostmanRuntime/7.28.4"
127.0.0.1 - - [14/Mar/2022:12:52:11 +0300] "GET /questionnaire/user-questionnaire/rate-responses?id=1 HTTP/1.1" 200 13813 "http://backend.guild.loc/questionnaire/user-questionnaire/view?id=1" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
127.0.0.1 - - [14/Mar/2022:12:52:11 +0300] "GET /debug/default/toolbar?tag=622f104b0de7c HTTP/1.1" 200 3434 "http://backend.guild.loc/questionnaire/user-questionnaire/rate-responses?id=1" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
127.0.0.1 - - [14/Mar/2022:12:56:04 +0300] "POST /api/user-response/set-responses HTTP/1.1" 201 862 "-" "PostmanRuntime/7.28.4"
127.0.0.1 - - [14/Mar/2022:12:57:39 +0300] "POST /api/user-response/set-response HTTP/1.1" 201 370 "-" "PostmanRuntime/7.28.4"
127.0.0.1 - - [14/Mar/2022:12:57:43 +0300] "POST /api/user-response/set-responses HTTP/1.1" 201 862 "-" "PostmanRuntime/7.28.4"
127.0.0.1 - - [14/Mar/2022:13:03:57 +0300] "POST /api/user-response/set-responses HTTP/1.1" 201 862 "-" "PostmanRuntime/7.28.4"

View File

@ -15371,3 +15371,16 @@ Stack trace:
2022/03/08 09:58:09 [error] 852#852: *5 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 102PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 103" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /debug/default/toolbar?tag=6226fe80ac65e HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc", referrer: "http://guild.loc/gii/crud"
2022/03/08 09:58:18 [error] 853#853: *8 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 102PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 103" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc", referrer: "http://guild.loc/reports/reports/index?id=5"
2022/03/08 09:58:19 [error] 853#853: *8 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 102PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 103" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /debug/default/toolbar?tag=6226fe8aa581c HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc", referrer: "http://guild.loc/"
2022/03/14 12:38:12 [error] 812#812: *8 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 102PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 103" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "POST /api/user-response/set-responses HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2022/03/14 12:38:39 [error] 812#812: *8 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 102PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 103" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "POST /api/user-response/set-responses HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2022/03/14 12:39:03 [error] 812#812: *8 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 102PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 103" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "POST /api/user-response/set-response HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2022/03/14 12:39:23 [error] 812#812: *8 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 102PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 103" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "POST /api/user-response/set-response HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2022/03/14 12:39:35 [error] 812#812: *8 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 102PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 103" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "POST /api/user-response/set-response HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2022/03/14 12:40:15 [error] 812#812: *8 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 102PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 103" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "POST /api/user-response/set-response HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2022/03/14 12:42:58 [error] 812#812: *15 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 102PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 103" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "POST /api/user-response/set-response HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2022/03/14 12:49:28 [error] 812#812: *24 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 102PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 103" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "POST /api/user-response/set-response HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2022/03/14 12:51:51 [error] 812#812: *26 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 102PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 103" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "POST /api/user-response/set-response HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2022/03/14 12:56:04 [error] 812#812: *31 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 102PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 103" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "POST /api/user-response/set-responses HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2022/03/14 12:57:39 [error] 812#812: *33 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 102PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 103" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "POST /api/user-response/set-response HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2022/03/14 12:57:43 [error] 812#812: *33 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 102PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 103" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "POST /api/user-response/set-responses HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2022/03/14 13:03:57 [error] 812#812: *36 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 102PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 103" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "POST /api/user-response/set-responses HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"

View File

@ -2,6 +2,7 @@
namespace frontend\modules\api\controllers;
use common\helpers\ScoreCalculatorHelper;
use common\models\UserResponse;
use Exception;
use Yii;
@ -15,16 +16,16 @@ class UserResponseController extends ApiController
{
public $modelClass = 'common\models\UserResponse';
public function behaviors(): array
{
$behaviors = parent::behaviors();
$behaviors['authenticator']['authMethods'] = [
HttpBearerAuth::className(),
];
return $behaviors;
}
// public function behaviors(): array
// {
// $behaviors = parent::behaviors();
//
// $behaviors['authenticator']['authMethods'] = [
// HttpBearerAuth::className(),
// ];
//
// return $behaviors;
// }
public function verbs(): array
{
@ -34,12 +35,12 @@ class UserResponseController extends ApiController
];
}
public function actions()
{
$actions = parent::actions();
unset($actions['create']);
return $actions;
}
// public function actions()
// {
// $actions = parent::actions();
// unset($actions['create']);
// return $actions;
// }
/**
* @throws InvalidConfigException
@ -57,7 +58,6 @@ class UserResponseController extends ApiController
$this->saveModel($model);
return $model;
}
/**
@ -106,6 +106,7 @@ class UserResponseController extends ApiController
protected function saveModel($model)
{
if ($model->save()) {
ScoreCalculatorHelper::rateOneResponse($model);
$response = Yii::$app->getResponse();
$response->setStatusCode(201);
} elseif (!$model->hasErrors()) {