add filters, update api, update api docs

This commit is contained in:
iIronside 2021-11-12 14:30:01 +03:00
parent 560de1c05e
commit 12914e9f8f
27 changed files with 8734 additions and 111 deletions

View File

@ -2,9 +2,12 @@
namespace backend\modules\questionnaire\controllers; namespace backend\modules\questionnaire\controllers;
use console\controllers\MovingController;
use Yii; use Yii;
use backend\modules\questionnaire\models\Answer; use backend\modules\questionnaire\models\Answer;
use backend\modules\questionnaire\models\AnswerSearch; use backend\modules\questionnaire\models\AnswerSearch;
use yii\helpers\Console;
use yii\helpers\Html;
use yii\web\Controller; use yii\web\Controller;
use yii\web\NotFoundHttpException; use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter; use yii\filters\VerbFilter;

View File

@ -83,12 +83,10 @@ class QuestionController extends Controller
if ($model->load(Yii::$app->request->post()) && $model->save()) { if ($model->load(Yii::$app->request->post()) && $model->save()) {
if ($questionnaire_id !== null ) if ($questionnaire_id !== null) {
{
return $this->redirect(['questionnaire/view', 'id' => $questionnaire_id]); return $this->redirect(['questionnaire/view', 'id' => $questionnaire_id]);
} }
elseif ($question_type_id !== null) elseif ($question_type_id !== null) {
{
return $this->redirect(['question-type/view', 'id' => $question_type_id]); return $this->redirect(['question-type/view', 'id' => $question_type_id]);
} }
@ -113,12 +111,10 @@ class QuestionController extends Controller
if ($model->load(Yii::$app->request->post()) && $model->save()) { if ($model->load(Yii::$app->request->post()) && $model->save()) {
if ($questionnaire_id !== null) if ($questionnaire_id !== null) {
{
return $this->redirect(['questionnaire/view', 'id' => $questionnaire_id]); return $this->redirect(['questionnaire/view', 'id' => $questionnaire_id]);
} }
elseif ($question_type_id !== null) elseif ($question_type_id !== null) {
{
return $this->redirect(['question-type/view', 'id' => $question_type_id]); return $this->redirect(['question-type/view', 'id' => $question_type_id]);
} }
@ -139,15 +135,12 @@ class QuestionController extends Controller
*/ */
public function actionDelete(int $id, $questionnaire_id = null, $question_type_id = null) public function actionDelete(int $id, $questionnaire_id = null, $question_type_id = null)
{ {
$this->findModel($id)->delete(); $this->findModel($id)->delete();
if ($questionnaire_id !== null) if ($questionnaire_id !== null) {
{
return $this->redirect(['questionnaire/view', 'id' => $questionnaire_id]); return $this->redirect(['questionnaire/view', 'id' => $questionnaire_id]);
} }
elseif ($question_type_id !== null) elseif ($question_type_id !== null) {
{
return $this->redirect(['question-type/view', 'id' => $question_type_id]); return $this->redirect(['question-type/view', 'id' => $question_type_id]);
} }
@ -169,4 +162,16 @@ class QuestionController extends Controller
throw new NotFoundHttpException('The requested page does not exist.'); throw new NotFoundHttpException('The requested page does not exist.');
} }
// protected function goToView($questionnaire_id = null, $question_type_id = null)
// {
// if ($questionnaire_id !== null)
// {
// return $this->redirect(['questionnaire/view', 'id' => $questionnaire_id]);
// }
// elseif ($question_type_id !== null)
// {
// return $this->redirect(['question-type/view', 'id' => $question_type_id]);
// }
// }
} }

View File

@ -153,7 +153,7 @@ class UserQuestionnaireController extends Controller
$parents = $_POST['depdrop_parents']; $parents = $_POST['depdrop_parents'];
if ($parents != null) { if ($parents != null) {
$cat_id = $parents[0]; $cat_id = $parents[0];
$categories = Questionnaire::questionnairesOfCategoryArr($cat_id); $categories = Questionnaire::questionnairesByCategoryArr($cat_id);
$formattedCatArr = array(); $formattedCatArr = array();
foreach ($categories as $key => $value){ foreach ($categories as $key => $value){

View File

@ -4,13 +4,14 @@ namespace backend\modules\questionnaire\models;
use yii\base\Model; use yii\base\Model;
use yii\data\ActiveDataProvider; use yii\data\ActiveDataProvider;
use backend\modules\questionnaire\models\Answer;
/** /**
* AnswerSearch represents the model behind the search form of `backend\modules\questionnaire\models\Answer`. * AnswerSearch represents the model behind the search form of `backend\modules\questionnaire\models\Answer`.
*/ */
class AnswerSearch extends Answer class AnswerSearch extends Answer
{ {
public $questionnaire;
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
@ -18,7 +19,7 @@ class AnswerSearch extends Answer
{ {
return [ return [
[['id', 'question_id', 'answer_flag', 'status'], 'integer'], [['id', 'question_id', 'answer_flag', 'status'], 'integer'],
[['answer_body', 'created_at', 'updated_at'], 'safe'], [['answer_body', 'questionnaire', 'created_at', 'updated_at'], 'safe'],
]; ];
} }
@ -40,13 +41,17 @@ class AnswerSearch extends Answer
*/ */
public function search($params) public function search($params)
{ {
$query = Answer::find()->with('question'); $query = Answer::find()->with('question')->joinWith('questionnaire');
// add conditions that should always apply here // add conditions that should always apply here
$dataProvider = new ActiveDataProvider([ $dataProvider = new ActiveDataProvider([
'query' => $query, 'query' => $query,
]); ]);
$dataProvider->sort->attributes['title'] = [
'asc' => ['questionnaire.title' => SORT_ASC],
'desc' => ['questionnaire.title' => SORT_DESC],
];
$this->load($params); $this->load($params);
@ -68,6 +73,10 @@ class AnswerSearch extends Answer
$query->andFilterWhere(['like', 'answer_body', $this->answer_body]); $query->andFilterWhere(['like', 'answer_body', $this->answer_body]);
$query->joinWith(['questionnaire' => function($q) {
$q->andFilterWhere(['like', 'questionnaire.id', $this->questionnaire]);
}]);
return $dataProvider; return $dataProvider;
} }
} }

View File

@ -0,0 +1,34 @@
<?php
use backend\modules\questionnaire\models\Questionnaire;
use kartik\select2\Select2;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\modules\questionnaire\models\AnswerSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="answer-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<?= $form->field($model, 'questionnaire')->widget(Select2::className(),[
'data' => Questionnaire::find()->select(['title', 'id'])->indexBy('id')->column(),
'options' => ['placeholder' => 'Выберите анкету'],
'pluginOptions' => [
'allowClear' => true
],
])->label('Анкета') ?>
<div class="form-group">
<?= Html::submitButton('Поиск', ['class' => 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -1,12 +1,11 @@
<?php <?php
use backend\modules\questionnaire\models\Question; use backend\modules\questionnaire\models\Question;
use backend\modules\questionnaire\models\Questionnaire;
use common\helpers\AnswerHelper; use common\helpers\AnswerHelper;
use common\helpers\StatusHelper; use common\helpers\StatusHelper;
use kartik\select2\Select2;
use yii\helpers\Html; use yii\helpers\Html;
use yii\grid\GridView; use yii\grid\GridView;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $searchModel backend\modules\questionnaire\models\AnswerSearch */ /* @var $searchModel backend\modules\questionnaire\models\AnswerSearch */
@ -17,33 +16,32 @@ $this->params['breadcrumbs'][] = $this->title;
?> ?>
<div class="answer-index"> <div class="answer-index">
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
<p> <p>
<?= Html::a('Создать новый ответ', ['create'], ['class' => 'btn btn-success']) ?> <?= Html::a('Создать новый ответ', ['create'], ['class' => 'btn btn-success']) ?>
</p> </p>
<!-- --><?php <?= $this->render('_search_by_questionnaire', [
// 'model' => $searchModel,
// echo Select2::widget([ ]) ?>
// 'model' => \backend\modules\questionnaire\models\Questionnaire::findOne()->where(['id'=>1]),
// 'attribute' => 'state_2',
// 'data' => 1,
// 'options' => ['placeholder' => 'Select a state ...'],
// 'pluginOptions' => [
// 'allowClear' => true
// ],
// ]);
//
// ?>
<?= GridView::widget([ <?= GridView::widget([
'dataProvider' => $dataProvider, 'dataProvider' => $dataProvider,
'filterModel' => $searchModel, 'filterModel' => $searchModel,
'columns' => [ 'columns' => [
['class' => 'yii\grid\SerialColumn'], ['class' => 'yii\grid\SerialColumn'],
// [
// 'filter' => Questionnaire::find()->select(['title', 'id'])->indexBy('id')->column(),
// 'label' => 'Анкета',
// 'attribute' => 'questionnaire',
// 'value' => 'questionnaire.title'
// ],
[ [
'filter' => Question::find()->select(['question_body', 'id'])->where(['!=', 'question_type_id', '1'])->indexBy('id')->column(), 'filter' => Question::find()->select(['question_body', 'id'])->where(['!=', 'question_type_id', '1'])
->andWhere(['questionnaire_id' => ''])
->indexBy('id')->column(),
// 'filter' => function($model){
// return \yii\helpers\ArrayHelper::getValue(Question::find()->where(['questionnaire_id' => $model->questionnaire_id]), ['id', 'title']) ;
// },
'attribute' => 'question_id', 'attribute' => 'question_id',
'value' => 'question.question_body' 'value' => 'question.question_body'
], ],
@ -68,3 +66,4 @@ $this->params['breadcrumbs'][] = $this->title;
], ],
]); ?> ]); ?>
</div> </div>

View File

@ -42,7 +42,7 @@ $this->params['breadcrumbs'][] = $this->title;
<?= GridView::widget([ <?= GridView::widget([
'dataProvider' => $questionDataProvider, 'dataProvider' => $questionDataProvider,
'filterModel' => $questionSearchModel, // 'filterModel' => $questionSearchModel,
'columns' => [ 'columns' => [
['class' => 'yii\grid\SerialColumn'], ['class' => 'yii\grid\SerialColumn'],
'question_body', 'question_body',

View File

@ -0,0 +1,35 @@
<?php
use backend\modules\questionnaire\models\Questionnaire;
use kartik\select2\Select2;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\modules\questionnaire\models\QuestionSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="question-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<?= $form->field($model, 'questionnaire_id')->widget(Select2::className(),[
'data' => Questionnaire::find()->select(['title', 'id'])->indexBy('id')->column(),
'options' => ['placeholder' => 'Выберите анкету'],
'pluginOptions' => [
'allowClear' => true
],
])->label('Анкета') ?>
<div class="form-group">
<?= Html::submitButton('Поиск', ['class' => 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -20,6 +20,10 @@ $this->params['breadcrumbs'][] = $this->title;
<?= Html::a('Создать вопрос', ['create'], ['class' => 'btn btn-success']) ?> <?= Html::a('Создать вопрос', ['create'], ['class' => 'btn btn-success']) ?>
</p> </p>
<?= $this->render('_search_by_questionnaire', [
'model' => $searchModel,
]) ?>
<?= GridView::widget([ <?= GridView::widget([
'dataProvider' => $dataProvider, 'dataProvider' => $dataProvider,
'filterModel' => $searchModel, 'filterModel' => $searchModel,
@ -31,11 +35,11 @@ $this->params['breadcrumbs'][] = $this->title;
'filter' => QuestionType::find()->select(['question_type', 'id'])->indexBy('id')->column(), 'filter' => QuestionType::find()->select(['question_type', 'id'])->indexBy('id')->column(),
'value' => 'questionType.question_type' 'value' => 'questionType.question_type'
], ],
[ // [
'attribute' => 'questionnaire_id', // 'attribute' => 'questionnaire_id',
'filter' => Questionnaire::find()->select(['title', 'id'])->indexBy('id')->column(), // 'filter' => Questionnaire::find()->select(['title', 'id'])->indexBy('id')->column(),
'value' => 'questionnaire.title', // 'value' => 'questionnaire.title',
], // ],
'question_priority', 'question_priority',
'next_question', 'next_question',
[ [

View File

@ -72,7 +72,7 @@ $this->params['breadcrumbs'][] = $this->title;
<?= GridView::widget([ <?= GridView::widget([
'dataProvider' => $answerDataProvider, 'dataProvider' => $answerDataProvider,
'filterModel' => $answerSearchModel, // 'filterModel' => $answerSearchModel,
'columns' => [ 'columns' => [
['class' => 'yii\grid\SerialColumn'], ['class' => 'yii\grid\SerialColumn'],
'answer_body', 'answer_body',

View File

@ -50,7 +50,7 @@ YiiAsset::register($this);
<?= GridView::widget([ <?= GridView::widget([
'dataProvider' => $questionnaireDataProvider, 'dataProvider' => $questionnaireDataProvider,
'filterModel' => $questionnaireSearchModel, // 'filterModel' => $questionnaireSearchModel,
'columns' => [ 'columns' => [
['class' => 'yii\grid\SerialColumn'], ['class' => 'yii\grid\SerialColumn'],
'title', 'title',

View File

@ -65,7 +65,7 @@ YiiAsset::register($this);
<?= GridView::widget([ <?= GridView::widget([
'dataProvider' => $questionDataProvider, 'dataProvider' => $questionDataProvider,
'filterModel' => $questionSearchModel, // 'filterModel' => $questionSearchModel,
'columns' => [ 'columns' => [
['class' => 'yii\grid\SerialColumn'], ['class' => 'yii\grid\SerialColumn'],
'question_body', 'question_body',

View File

@ -0,0 +1,38 @@
<?php
use backend\modules\questionnaire\models\Questionnaire;
use backend\modules\questionnaire\models\UserQuestionnaire;
use kartik\select2\Select2;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\modules\questionnaire\models\QuestionSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="question-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<?= $form->field($model, 'user_questionnaire_uuid')->widget(Select2::className(),[
// 'data' => Questionnaire::find()->select(['title', 'id'])->indexBy('id')->column(),
'data' => Questionnaire::find()->joinWith('userQuestionnaires')->select(['title', 'uuid',])->column(),
'options' => ['placeholder' => 'Выберите анкету'],
'pluginOptions' => [
'allowClear' => true
],
])->label('Анкета') ?>
<div class="form-group">
<?= Html::submitButton('Поиск', ['class' => 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
<?php

View File

@ -20,6 +20,13 @@ $this->params['breadcrumbs'][] = $this->title;
<?= Html::a('Новый ответ пользователя', ['create'], ['class' => 'btn btn-success']) ?> <?= Html::a('Новый ответ пользователя', ['create'], ['class' => 'btn btn-success']) ?>
</p> </p>
<?php
//echo $this->render('_search_by_questionnaire', [
// 'model' => $searchModel,
// ])
?>
<?= GridView::widget([ <?= GridView::widget([
'dataProvider' => $dataProvider, 'dataProvider' => $dataProvider,
'filterModel' => $searchModel, 'filterModel' => $searchModel,

View File

@ -45,21 +45,15 @@ class AnswerHelper
$class = 'label label-warning'; $class = 'label label-warning';
$content = 'Не проверен'; $content = 'Не проверен';
if ($answer_flag > 0) if ($answer_flag > 0) {
{
$class = 'label label-success'; $class = 'label label-success';
$answer_flag < 1 ? $content = $answer_flag *100 . '%' : $content = 'Верен'; $answer_flag < 1 ? $content = $answer_flag *100 . '%' : $content = 'Верен';
} }
else if ($answer_flag === 0.0) else if ($answer_flag === 0.0) {
{
$class = 'label label-danger'; $class = 'label label-danger';
$content = 'Не верен'; $content = 'Не верен';
} }
return Html::tag('span', $content, return Html::tag('span', $content, ['class' => $class,]);
[
'class' => $class,
]
);
} }
} }

View File

@ -13,21 +13,17 @@ class ScoreCalculatorHelper
{ {
$responses = $user_questionnaire->getUserResponses()->all(); $responses = $user_questionnaire->getUserResponses()->all();
foreach ($responses as $response) foreach ($responses as $response) {
{
self::rateOneResponse($response); self::rateOneResponse($response);
} }
} }
public static function rateOneResponse(UserResponse $response) public static function rateOneResponse(UserResponse $response)
{ {
if ($response->answer_flag === null && $response->getQuestionTypeValue() != 1) // not open question if ($response->getQuestionTypeValue() != 1) { // not open question
{
$correct_answers = $response->getCorrectAnswers(); $correct_answers = $response->getCorrectAnswers();
foreach ($correct_answers as $correct_answer) foreach ($correct_answers as $correct_answer) {
{ if ($response->response_body === $correct_answer['answer_body']) {
if ($response->response_body === $correct_answer['answer_body'])
{
$response->answer_flag = 1; $response->answer_flag = 1;
$response->save(); $response->save();
return; return;
@ -41,8 +37,7 @@ class ScoreCalculatorHelper
public static function checkAnswerFlagsForNull(UserQuestionnaire $userQuestionnaire): bool public static function checkAnswerFlagsForNull(UserQuestionnaire $userQuestionnaire): bool
{ {
$responses = $userQuestionnaire->getUserResponses()->AsArray()->all(); $responses = $userQuestionnaire->getUserResponses()->AsArray()->all();
foreach ($responses as $response) foreach ($responses as $response) {
{
if (ArrayHelper::isIn(null, $response)) if (ArrayHelper::isIn(null, $response))
return false; return false;
} }
@ -56,13 +51,10 @@ class ScoreCalculatorHelper
$score = null; $score = null;
$user_correct_answers_num = null; $user_correct_answers_num = null;
foreach ($responses_questions as $response_question) foreach ($responses_questions as $response_question) {
{ if(self::isCorrect($response_question['answer_flag'])) {
if(self::isCorrect($response_question['answer_flag']))
{
$user_correct_answers_num += 1; $user_correct_answers_num += 1;
switch ($response_question['question']['question_type_id']) switch ($response_question['question']['question_type_id']) {
{
case '1': // open question case '1': // open question
$score += $response_question['answer_flag'] * $response_question['question']['score']; $score += $response_question['answer_flag'] * $response_question['question']['score'];
break; break;

View File

@ -10,8 +10,7 @@ class TimeHelper
{ {
public static function limitTime($time_limit) public static function limitTime($time_limit)
{ {
if ($time_limit === null) if ($time_limit === null) {
{
return 'Не ограничено'; return 'Не ограничено';
} }

View File

@ -2,6 +2,7 @@
namespace common\models; namespace common\models;
use yii\base\InvalidConfigException;
use yii\behaviors\TimestampBehavior; use yii\behaviors\TimestampBehavior;
use yii\db\ActiveQuery; use yii\db\ActiveQuery;
use yii\db\Expression; use yii\db\Expression;
@ -79,6 +80,20 @@ class Answer extends \yii\db\ActiveRecord
return $this->hasOne(Question::className(), ['id' => 'question_id']); return $this->hasOne(Question::className(), ['id' => 'question_id']);
} }
/**
* @throws InvalidConfigException
*/
public function getQuestionnaire(): ActiveQuery
{
return $this->hasOne(Questionnaire::className(), ['id' => 'questionnaire_id'])
->viaTable('question', ['id' => 'question_id']);
}
// public function getUserQuestionnaire()
// {
// return $this->hasOne(\backend\modules\questionnaire\models\UserQuestionnaire::className(), ['id'])
// }
static function numCorrectAnswers($question_id) static function numCorrectAnswers($question_id)
{ {
return Answer::find() return Answer::find()

View File

@ -123,7 +123,7 @@ class Questionnaire extends ActiveRecord
return $this->hasMany(UserQuestionnaire::className(), ['questionnaire_id' => 'id']); return $this->hasMany(UserQuestionnaire::className(), ['questionnaire_id' => 'id']);
} }
public static function questionnairesOfCategoryArr($category_id): array public static function questionnairesByCategoryArr($category_id): array
{ {
$categories = self::find()->where(['category_id' => $category_id, 'status' => '1'])->all(); $categories = self::find()->where(['category_id' => $category_id, 'status' => '1'])->all();
return ArrayHelper::map($categories, 'id', 'title'); return ArrayHelper::map($categories, 'id', 'title');

View File

@ -3,6 +3,8 @@
namespace common\models; namespace common\models;
use common\helpers\UUIDHelper; use common\helpers\UUIDHelper;
use Exception;
use yii\base\InvalidConfigException;
use yii\behaviors\TimestampBehavior; use yii\behaviors\TimestampBehavior;
use yii\db\ActiveQuery; use yii\db\ActiveQuery;
use yii\db\ActiveRecord; use yii\db\ActiveRecord;
@ -134,26 +136,18 @@ class UserQuestionnaire extends ActiveRecord
return $this->getUser()->one()->username; return $this->getUser()->one()->username;
} }
public static function getQuestionnaireByUser($id): array /**
{ * @throws InvalidConfigException
$questionnaire = ArrayHelper::map(self::find()->where(['user_id' => $id]) */
->with('questionnaire')->asArray()->all(),'id','questionnaire.title');
$formatQuestionnaireArr = array();
foreach ($questionnaire as $key => $value){
$formatQuestionnaireArr[] = array('id' => $key, 'name' => $value);
}
return $formatQuestionnaireArr;
}
public function getQuestions() public function getQuestions()
{ {
return $this->hasMany(Question::className(), ['id' => 'question_id']) return $this->hasMany(Question::className(), ['id' => 'question_id'])
->viaTable('user_response', ['user_questionnaire_uuid' => 'uuid']); ->viaTable('user_response', ['user_questionnaire_uuid' => 'uuid']);
} }
/**
* @throws InvalidConfigException
*/
public function numCorrectAnswersWithoutOpenQuestions() public function numCorrectAnswersWithoutOpenQuestions()
{ {
return $this->hasMany(Answer::className(), ['question_id' => 'question_id']) return $this->hasMany(Answer::className(), ['question_id' => 'question_id'])
@ -163,6 +157,9 @@ class UserQuestionnaire extends ActiveRecord
->count(); ->count();
} }
/**
* @throws InvalidConfigException
*/
public function numOpenQuestionsAnswers() public function numOpenQuestionsAnswers()
{ {
return $this->hasMany(Question::className(), ['id' => 'question_id']) return $this->hasMany(Question::className(), ['id' => 'question_id'])
@ -171,7 +168,15 @@ class UserQuestionnaire extends ActiveRecord
->count(); ->count();
} }
public static function findActiveUserQuestionnaires($user_id) /**
* @throws Exception
*/
public static function getQuestionnaireId($uuid)
{
return ArrayHelper::getValue(self::find()->where(['uuid' => $uuid])->one(), 'id');
}
public static function findActiveUserQuestionnaires($user_id): array
{ {
return self::find()->where(['user_id' => $user_id]) return self::find()->where(['user_id' => $user_id])
->andWhere(['status' => '1']) ->andWhere(['status' => '1'])

View File

@ -435,3 +435,411 @@
`https://guild.craft-group.xyz/api/reports/update?id=18&created_at=2021-09-17&today=0&difficulties=diff&tomorrow=new task&status=1` `https://guild.craft-group.xyz/api/reports/update?id=18&created_at=2021-09-17&today=0&difficulties=diff&tomorrow=new task&status=1`
## Анкеты
###Список анкет
`https://guild.craft-group.xyz/api/user-questionnaire/questionnaires-list`
<p>
Для получения списка анкет необходимо отправить <b>GET</b> запрос на URL https://guild.craft-group.xyz/api/user-questionnaire/questionnaires-list
</p>
<p>
Требуемые параметры запроса:
</p>
<table>
<tr>
<th>
Параметры
</th>
<th>
Значение
</th>
</tr>
<tr>
<td>
user_id
</td>
<td>
ID пользователя(int)
</td>
</tr>
</table>
<p>
Пример запроса:
</p>
`https://guild.craft-group.xyz/api/user-questionnaire/questionnaires-list?user_id=1`
<p>
Возвращает <b>массив</b> объектов записи <b>Назначенная анкета</b>. <br>
Каждый объектимеет такой вид:
</p>
```json5
{
"user_id": 1,
"uuid": "d222f858-60fd-47fb-8731-dc9d5fc384c5",
"score": 20,
"status": 1,
"percent_correct_answers": 0.8
}
```
<p>
Передаваемые параметры объекта вопроса:
</p>
<table>
<tr>
<th>
Параметры
</th>
<th>
Значение
</th>
</tr>
<tr>
<td>
user_id
</td>
<td>
ID пользователя(int)
</td>
</tr>
<tr>
<td>
score
</td>
<td>
Полученные балы(int)
</td>
</tr>
<tr>
<td>
percent_correct_answers
</td>
<td>
Процент правильных ответов(float)
</td>
</tr>
</table>
<p>
Если пользователь не найден или у пользователя нет активных анкет будет отправлено следующее сообщение:
</p>
```json5
{
"name": "Not Found",
"message": "Active questionnaire not found",
"code": 0,
"status": 404,
"type": "yii\\web\\NotFoundHttpException"
}
```
### Вопросы анкеты
`https://guild.craft-group.xyz/api/question/get-questions`
<p>
Для получения вопросов анкеты необходимо отправить <b>GET</b> запрос на URL https://guild.craft-group.xyz/api/question/get-questions
</p>
<p>
Требуемые параметры запроса:
</p>
<table>
<tr>
<th>
Параметры
</th>
<th>
Значение
</th>
</tr>
<tr>
<td>
uuid
</td>
<td>
UUID анкеты назначеной пользователю
</td>
</tr>
</table>
<p>
Пример запроса:
</p>
`https://guild.craft-group.xyz/api/question/get-questions?uuid=d222f858-60fd-47fb-8731-dc9d5fc384c5`
<p>
Возвращает <b>массив</b> объектов <b>Вопросов</b>. <br>
Каждый объект <b>Вопрос</b> имеет такой вид:
</p>
```json5
{
"id": "4",
"question_type_id": "2",
"question_body": "Один ответ1",
"question_priority": null,
"next_question": null,
"time_limit": "00:22:00"
}
```
<p>
Передаваемые параметры объекта вопроса:
</p>
<table>
<tr>
<th>
Параметры
</th>
<th>
Значение
</th>
</tr>
<tr>
<td>
id
</td>
<td>
ID вопроса(int)
</td>
</tr>
<tr>
<td>
question_type_id
</td>
<td>
ID типа вопроса(int)
</td>
</tr>
<tr>
<td>
question_body
</td>
<td>
Вопрос(string)
</td>
</tr>
<tr>
<td>
question_priority
</td>
<td>
Приоритет вопроса(int)(не используется)
</td>
</tr>
<tr>
<td>
next_question
</td>
<td>
Следующий вопрос(int)(не используется)
</td>
</tr>
<tr>
<td>
time_limit
</td>
<td>
Ограничение времени на ответ(time)
</td>
</tr>
</table>
<p>
Если вопрос не найден или не предпологает передачу ответов будет отправлено следующее сообщение:
</p>
```json5
{
"name": "Not Found",
"message": "Questions not found",
"code": 0,
"status": 404,
"type": "yii\\web\\NotFoundHttpException"
}
```
### Ответы на вопрос
`https://guild.craft-group.xyz/api/answer/get-answers`
<p>
Для получения вариантов ответов на вопрос анкеты нужно сделать <b>GET</b> запрос на URL https://guild.craft-group.xyz/api/answer/get-answers
</p>
<p>
Требуемые параметры:
</p>
<table>
<tr>
<th>
Параметры
</th>
<th>
Значение
</th>
</tr>
<tr>
<td>
question_id
</td>
<td>
ID вопроса
</td>
</tr>
</table>
<p>
Пример запроса:
</p>
`https://guild.craft-group.xyz/api/answer/get-answers?question_id=7`
<p>
Возвращает <b>массив</b> объектов <b>Ответов</b>. <br>
Каждый объект <b>Ответа</b> имеет такой вид:
</p>
```json5
[
{
"id": "12",
"question_id": "7",
"answer_body": "Неск вар1 отв1 истина"
},
]
```
<p>
Передаваемые параметры объекта вопроса:
</p>
<table>
<tr>
<th>
Параметры
</th>
<th>
Значение
</th>
</tr>
<tr>
<td>
id
</td>
<td>
ID вопроса(int)
</td>
</tr>
<tr>
<td>
question_id
</td>
<td>
ID вопроса(int)
</td>
</tr>
<tr>
<td>
answer_body
</td>
<td>
Ответ(string)
</td>
</tr>
</table>
<p>
Если ответы не найдены или вопрос не предпологает их наличие(открытый вопрос) будет отправлено следующее сообщение:
</p>
```json5
{
"name": "Not Found",
"message": "Answer not found or question inactive",
"code": 0,
"status": 404,
"type": "yii\\web\\NotFoundHttpException"
}
```
### Ответ пользователя
`https://guild.craft-group.xyz/api/user-response/set-response`
<p>
Для добавления ответа на вопрос от пользователся необходимо сделать <b>POST</b> запрос на URL https://guild.craft-group.xyz/api/user-response/set-response
</p>
<p>
Тело запроса содержит:
</p>
<table>
<tr>
<th>
Параметры
</th>
<th>
Значение
</th>
</tr>
<tr>
<td>
question_id
</td>
<td>
ID вопроса(int)
</td>
</tr>
<tr>
<td>
response_body
</td>
<td>
Ответ пользователя(string 255)
</td>
</tr>
<tr>
<td>
uuid
</td>
<td>
UUID анкеты назначенной пользователю(string 36)
</td>
</tr>
</table>
<p>
Пример запроса:
</p>
`http://guild.loc/api/user-response/set-responses?user_id=1&user_questionnaire_id=1&question_id=7&response_body=user response string`
<p>
Возвращает объект <b>Ответа</b>. <br>
Объект <b>Ответа</b> имеет такой вид:
</p>
```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
}
```
<p>
В случаии ошибки в запросе будет отправлено сообщение следующего вида:
</p>
```json5
{
"name": "Bad Request",
"message": "{\"question_id\":[\"\В\о\п\р\о\с is invalid.\"]}",
"code": 0,
"status": 400,
"type": "yii\\web\\BadRequestHttpException"
}
```

File diff suppressed because it is too large Load Diff

View File

@ -657,3 +657,92 @@ Stack trace:
2021/10/28 12:07:59 [error] 728#728: *363 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /api/answer/get-answers?question_id=7 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc" 2021/10/28 12:07:59 [error] 728#728: *363 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /api/answer/get-answers?question_id=7 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/10/29 16:02:38 [error] 712#712: *805 FastCGI sent in stderr: "PHP message: PHP Fatal error: Declaration of backend\modules\questionnaire\models\AnswerSearch::rules() must be compatible with common\models\Answer::rules(): array in /var/www/guild.loc/backend/modules/questionnaire/models/AnswerSearch.php on line 17" while reading response header from upstream, client: 127.0.0.1, server: backend.guild.loc, request: "GET /questionnaire/answer/index?AnswerSearch%5Bquestion_id%5D=&AnswerSearch%5Banswer_body%5D=&AnswerSearch%5Banswer_flag%5D=&AnswerSearch%5Bstatus%5D=0 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "backend.guild.loc", referrer: "http://backend.guild.loc/questionnaire/answer/index?AnswerSearch%5Bquestion_id%5D=&AnswerSearch%5Banswer_body%5D=&AnswerSearch%5Banswer_flag%5D=&AnswerSearch%5Bstatus%5D=" 2021/10/29 16:02:38 [error] 712#712: *805 FastCGI sent in stderr: "PHP message: PHP Fatal error: Declaration of backend\modules\questionnaire\models\AnswerSearch::rules() must be compatible with common\models\Answer::rules(): array in /var/www/guild.loc/backend/modules/questionnaire/models/AnswerSearch.php on line 17" while reading response header from upstream, client: 127.0.0.1, server: backend.guild.loc, request: "GET /questionnaire/answer/index?AnswerSearch%5Bquestion_id%5D=&AnswerSearch%5Banswer_body%5D=&AnswerSearch%5Banswer_flag%5D=&AnswerSearch%5Bstatus%5D=0 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "backend.guild.loc", referrer: "http://backend.guild.loc/questionnaire/answer/index?AnswerSearch%5Bquestion_id%5D=&AnswerSearch%5Banswer_body%5D=&AnswerSearch%5Banswer_flag%5D=&AnswerSearch%5Bstatus%5D="
2021/11/03 10:16:14 [error] 743#743: *45 FastCGI sent in stderr: "PHP message: PHP Fatal error: Cannot declare class kartik\time\TimePickerAsset, because the name is already in use in /var/www/guild.loc/backend/components/timepicker/src/TimePickerAsset.php on line 0" while reading response header from upstream, client: 127.0.0.1, server: backend.guild.loc, request: "GET /questionnaire/questionnaire/create HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "backend.guild.loc", referrer: "http://backend.guild.loc/questionnaire/questionnaire" 2021/11/03 10:16:14 [error] 743#743: *45 FastCGI sent in stderr: "PHP message: PHP Fatal error: Cannot declare class kartik\time\TimePickerAsset, because the name is already in use in /var/www/guild.loc/backend/components/timepicker/src/TimePickerAsset.php on line 0" while reading response header from upstream, client: 127.0.0.1, server: backend.guild.loc, request: "GET /questionnaire/questionnaire/create HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "backend.guild.loc", referrer: "http://backend.guild.loc/questionnaire/questionnaire"
2021/11/10 10:23:40 [error] 764#764: *107 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "POST /api/user/login?login=testUser HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 10:28:33 [error] 764#764: *111 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" 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"
2021/11/10 10:28:33 [error] 764#764: *111 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /debug/default/toolbar?tag=618b74a119d35 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc", referrer: "http://guild.loc/"
2021/11/10 10:34:18 [error] 764#764: *116 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /api/skills/skills-on-main-page HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 10:34:37 [error] 764#764: *116 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /api/question/get-questions?questionnaire_id=1 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 10:35:05 [error] 764#764: *116 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /api/question/get-questions?questionnaire_uuid=1 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 10:37:46 [error] 764#764: *120 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /api/question/get-questions?questionnaire_uuid=1 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 10:40:25 [error] 764#764: *122 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /api/question/get-questions?questionnaire_uuid=1 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 10:40:37 [error] 764#764: *122 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /api/question/get-questions?questionnaire_uuid=1 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 10:41:41 [error] 764#764: *122 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /api/question/get-questions?questionnaire_uuid=d222f858-60fd-47fb-8731-dc9d5fc384c5 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 10:45:06 [error] 764#764: *126 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /api/question/get-questions?questionnaire_uuid=d222f858-60fd-47fb-8731-dc9d5fc384c5 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 10:45:19 [error] 764#764: *126 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /api/question/get-questions?questionnaire_uuid=d222f858-60fd-47fb-8731-dc9d5fc384c5 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 10:58:54 [error] 764#764: *159 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /api/question/get-questions?questionnaire_uuid=d222f858-60fd-47fb-8731-dc9d5fc384c5 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 11:00:07 [error] 764#764: *161 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /api/question/get-questions?questionnaire_uuid=d222f858-60fd-47fb-8731-dc9d5fc384c5 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 11:00:39 [error] 764#764: *163 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /api/question/get-questions?questionnaire_uuid=d222f858-60fd-47fb-8731-dc9d5fc384c5 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 11:02:41 [error] 764#764: *165 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /api/question/get-questions?questionnaire_uuid=d222f858-60fd-47fb-8731-dc9d5fc384c5 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 11:02:47 [error] 764#764: *165 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /api/question/get-questions?questionnaire_uuid=d222f858-60fd-47fb-8731-dc9d5fc384c5 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 11:07:05 [error] 764#764: *168 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "POST /api/question/get-questions?questionnaire_uuid=d222f858-60fd-47fb-8731-dc9d5fc384c5 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 11:07:12 [error] 764#764: *168 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /api/question/get-questions?questionnaire_uuid=d222f858-60fd-47fb-8731-dc9d5fc384c5 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 11:23:39 [error] 764#764: *171 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /api/question/get-questions?uuid=d222f858-60fd-47fb-8731-dc9d5fc384c5 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 11:25:30 [error] 764#764: *173 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /api/question/get-questions?uuid=d222f858-60fd-47fb-8731-dc9d5fc384c5 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 11:31:53 [error] 764#764: *175 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /api/answer/get-answers?question_id=7 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 11:32:22 [error] 764#764: *175 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /api/answer/get-answers?question_id=7 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 11:32:25 [error] 764#764: *175 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "POST /api/answer/get-answers?question_id=7 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 11:32:30 [error] 764#764: *175 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /api/answer/get-answers?question_id=7 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 11:33:51 [error] 764#764: *186 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /api/answer/get-answers?question_id=3 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 11:35:16 [error] 764#764: *195 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /api/answer/get-answers?question_id=30 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 11:41:59 [error] 764#764: *197 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /api/answer/get-answers?question_id=3 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 11:42:06 [error] 764#764: *197 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /api/answer/get-answers?question_id=3 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 11:42:11 [error] 764#764: *197 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /api/answer/get-answers?question_id=7 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 11:42:56 [error] 764#764: *197 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /api/answer/get-answers?question_id=4 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 11:43:06 [error] 764#764: *197 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /api/answer/get-answers?question_id=3 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 11:44:49 [error] 764#764: *203 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /api/answer/get-answers?question_id=3 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 11:45:58 [error] 764#764: *205 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "POST /api/answer/get-answers?question_id=3 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 11:49:21 [error] 764#764: *207 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /api/answer/get-answers?question_id=7 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 11:51:40 [error] 764#764: *209 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /api/answer/get-answers?question_id=7 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 11:55:19 [error] 764#764: *211 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /api/answer/get-answers?question_id=70 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 12:01:08 [error] 764#764: *213 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /api/answer/get-answers?question_id=7 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 12:04:24 [error] 764#764: *215 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /api/question/get-questions?uuid=d222f858-60fd-47fb-8731-dc9d5fc384c5 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 12:15:33 [error] 764#764: *217 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /api/question/get-questions?uuid=d222f858-60fd-47fb-8731-dc9d5fc384c6 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 12:16:16 [error] 764#764: *217 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /api/question/get-questions?uuid=d222f858-60fd-47fb-8731-dc9d5fc384c6 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 12:18:15 [error] 764#764: *220 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /api/question/get-questions?uuid=d222f858-60fd-47fb-8731-dc9d5fc384c5 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 12:38:05 [error] 764#764: *222 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /api/question/get-questions?uuid=d222f858-60fd-47fb-8731-dc9d5fc384c5 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 12:38:57 [error] 764#764: *222 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /api/user-questionnaire/questionnaires-list?user_id=1 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 12:39:10 [error] 764#764: *222 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /api/user-questionnaire/questionnaires-list?user_id=1 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 12:41:01 [error] 764#764: *226 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /api/user-questionnaire/questionnaires-list?user_id=1 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 12:41:46 [error] 764#764: *226 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /api/user-questionnaire/questionnaires-list?user_id=1 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 12:42:19 [error] 764#764: *226 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /api/user-questionnaire/questionnaires-list?user_id=1 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 12:43:42 [error] 764#764: *230 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /api/user-questionnaire/questionnaires-list?user_id=1 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 12:44:06 [error] 764#764: *230 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /api/user-questionnaire/questionnaires-list?user_id=1 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 12:53:23 [error] 764#764: *233 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /api/user-questionnaire/questionnaires-list?user_id=2 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 12:55:44 [error] 764#764: *235 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /api/user-questionnaire/questionnaires-list?user_id=1 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 12:56:14 [error] 764#764: *235 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /api/question/get-questions?uuid=d222f858-60fd-47fb-8731-dc9d5fc384c5 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 12:56:27 [error] 764#764: *235 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /api/answer/get-answers?question_id=7 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 13:42:53 [error] 764#764: *241 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "POST /api/user-response/create HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 13:43:07 [error] 764#764: *241 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "POST /api/user-response/create HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 13:45:02 [error] 764#764: *244 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "POST /api/user-response/create HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 13:45:12 [error] 764#764: *244 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" 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"
2021/11/10 13:45:50 [error] 764#764: *244 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "PUT /api/user-response/set-response HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
2021/11/10 13:46:47 [error] 764#764: *244 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" 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"
2021/11/10 13:51:12 [error] 764#764: *249 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" 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"
2021/11/10 13:54:50 [error] 764#764: *251 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" 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"
2021/11/10 13:56:18 [error] 764#764: *253 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" 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"
2021/11/10 13:56:36 [error] 764#764: *253 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" 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"
2021/11/10 13:58:22 [error] 764#764: *256 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" 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"
2021/11/10 13:58:33 [error] 764#764: *256 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" 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"
2021/11/10 13:58:45 [error] 764#764: *256 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" 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"
2021/11/10 13:58:55 [error] 764#764: *256 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" 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"
2021/11/10 13:59:03 [error] 764#764: *256 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" 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"
2021/11/10 13:59:22 [error] 764#764: *256 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" 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"
2021/11/10 13:59:27 [error] 764#764: *256 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" 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"
2021/11/10 14:06:46 [error] 764#764: *264 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" 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"
2021/11/10 14:07:30 [error] 764#764: *264 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" 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"
2021/11/10 14:08:27 [error] 764#764: *264 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" 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"
2021/11/10 14:08:36 [error] 764#764: *264 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" 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"
2021/11/10 14:12:07 [error] 764#764: *269 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" 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"
2021/11/10 14:12:19 [error] 764#764: *269 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" 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"
2021/11/10 14:14:30 [error] 764#764: *272 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" 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"
2021/11/10 14:14:51 [error] 764#764: *272 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" 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"
2021/11/10 14:15:14 [error] 764#764: *272 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" 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"
2021/11/10 14:16:45 [error] 764#764: *276 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" 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"
2021/11/10 14:17:35 [error] 764#764: *276 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" 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"
2021/11/10 14:17:42 [error] 764#764: *276 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" 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"
2021/11/10 14:17:47 [error] 764#764: *276 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" 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"
2021/11/10 14:17:56 [error] 764#764: *276 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" 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"
2021/11/10 14:18:21 [error] 764#764: *276 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" 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"
2021/11/10 14:18:53 [error] 764#764: *276 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" 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"
2021/11/10 14:19:50 [error] 764#764: *276 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" 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"
2021/11/10 14:26:39 [error] 764#764: *285 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 101PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 102" 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"

View File

@ -34,22 +34,22 @@ class AnswerController extends Controller
public function actionGetAnswers(): array public function actionGetAnswers(): array
{ {
$question_id = Yii::$app->request->get('question_id'); $question_id = Yii::$app->request->get('question_id');
if(empty($question_id) or !is_numeric($question_id)) if(empty($question_id) or !is_numeric($question_id))
{ {
throw new NotFoundHttpException('Incorrect questionnaire ID'); throw new NotFoundHttpException('Incorrect question ID');
} }
$answers = Answer::activeAnswers($question_id); $answers = Answer::activeAnswers($question_id);
if(empty($answers)) { if(empty($answers)) {
throw new NotFoundHttpException('Active questionnaire not found'); throw new NotFoundHttpException('Answers not found or question inactive');
} }
array_walk( $answers, function(&$arr){ array_walk( $answers, function(&$arr){
unset( unset(
$arr['created_at'], $arr['created_at'],
$arr['updated_at'], $arr['updated_at'],
$arr['answer_flag'] $arr['answer_flag'],
$arr['status']
); );
}); });

View File

@ -2,22 +2,22 @@
namespace frontend\modules\api\controllers; namespace frontend\modules\api\controllers;
use common\helpers\UUIDHelper;
use common\models\Question; use common\models\Question;
use common\models\Questionnaire; use common\models\UserQuestionnaire;
use Yii; use Yii;
use yii\filters\auth\HttpBearerAuth; use yii\filters\auth\HttpBearerAuth;
use yii\rest\Controller;
use yii\web\NotFoundHttpException; use yii\web\NotFoundHttpException;
class QuestionController extends \yii\rest\Controller class QuestionController extends Controller
{ {
public function behaviors() public function behaviors()
{ {
$behaviors = parent::behaviors(); $behaviors = parent::behaviors();
$behaviors['authenticator']['authMethods'] = [ $behaviors['authenticator']['authMethods'] = [
HttpBearerAuth::className(), HttpBearerAuth::className(),
]; ];
return $behaviors; return $behaviors;
} }
@ -30,19 +30,22 @@ class QuestionController extends \yii\rest\Controller
/** /**
* @throws NotFoundHttpException * @throws NotFoundHttpException
* @throws \Exception
*/ */
public function actionGetQuestions() public function actionGetQuestions(): array
{ {
$questionnaire_id = Yii::$app->request->get('questionnaire_id'); $uuid = Yii::$app->request->get('uuid');
if(empty($questionnaire_id) or !is_numeric($questionnaire_id)) if(empty($uuid) or !UUIDHelper::is_valid($uuid))
{ {
throw new NotFoundHttpException('Incorrect questionnaire ID'); throw new NotFoundHttpException('Incorrect questionnaire UUID');
} }
$questionnaire_id = UserQuestionnaire::getQuestionnaireId($uuid);
$questions = Question::activeQuestions($questionnaire_id); $questions = Question::activeQuestions($questionnaire_id);
if(empty($questions)) { if(empty($questions)) {
throw new NotFoundHttpException('Active questionnaire not found'); throw new NotFoundHttpException('Questions not found');
} }
array_walk( $questions, function(&$arr){ array_walk( $questions, function(&$arr){
@ -51,6 +54,7 @@ class QuestionController extends \yii\rest\Controller
$arr['created_at'], $arr['created_at'],
$arr['updated_at'], $arr['updated_at'],
$arr['status'], $arr['status'],
$arr['questionnaire_id']
); );
}); });

View File

@ -47,11 +47,10 @@ class UserQuestionnaireController extends Controller
array_walk( $userQuestionnaireModel, function(&$arr){ array_walk( $userQuestionnaireModel, function(&$arr){
unset( unset(
$arr['uuid'], $arr['questionnaire_id'],
$arr['created_at'], $arr['created_at'],
$arr['updated_at'], $arr['updated_at'],
$arr['score'], $arr['id'],
$arr['percent_correct_answers']
); );
}); });

View File

@ -2,16 +2,15 @@
namespace frontend\modules\api\controllers; namespace frontend\modules\api\controllers;
use common\models\Reports;
use common\models\UserResponse; use common\models\UserResponse;
use Yii; use Yii;
use yii\base\InvalidConfigException;
use yii\filters\auth\HttpBearerAuth; use yii\filters\auth\HttpBearerAuth;
use yii\helpers\Url;
use yii\rest\ActiveController; use yii\rest\ActiveController;
use yii\web\BadRequestHttpException; use yii\web\BadRequestHttpException;
use yii\web\ServerErrorHttpException; use yii\web\ServerErrorHttpException;
class UserResponseController extends \yii\rest\ActiveController class UserResponseController extends ActiveController
{ {
public $modelClass = 'common\models\UserResponse'; public $modelClass = 'common\models\UserResponse';
@ -29,8 +28,7 @@ class UserResponseController extends \yii\rest\ActiveController
public function verbs(): array public function verbs(): array
{ {
return [ return [
// 'set-responses' => ['post'], 'set-response' => ['post'],
'create' => ['post'],
]; ];
} }
@ -41,16 +39,28 @@ class UserResponseController extends \yii\rest\ActiveController
return $actions; return $actions;
} }
public function actionCreate() /**
* @throws InvalidConfigException
* @throws BadRequestHttpException
* @throws ServerErrorHttpException
*/
public function actionSetResponse(): UserResponse
{ {
$model = new UserResponse(); $model = new UserResponse();
$model->load(Yii::$app->getRequest()->getBodyParams(), ''); $model->load(Yii::$app->getRequest()->getBodyParams(), '');
if(!$model->validate()){
throw new BadRequestHttpException(json_encode($model->errors));
}
if (empty($model->user_id) or empty($model->question_id) or empty($model->user_questionnaire_uuid)) {
throw new BadRequestHttpException(json_encode($model->errors));
}
if ($model->save()) { if ($model->save()) {
$response = Yii::$app->getResponse(); $response = Yii::$app->getResponse();
$response->setStatusCode(201); $response->setStatusCode(201);
// $id = implode(',', array_values($model->getPrimaryKey(true)));
// $response->getHeaders()->set('Location', Url::toRoute(['view', 'id' => $id], true));
} elseif (!$model->hasErrors()) { } elseif (!$model->hasErrors()) {
throw new ServerErrorHttpException('Failed to create the object for unknown reason.'); throw new ServerErrorHttpException('Failed to create the object for unknown reason.');
} }