move ScoreCalculator fom helpers to services
This commit is contained in:
@ -4,7 +4,7 @@ namespace backend\modules\questionnaire\controllers;
|
||||
|
||||
use backend\modules\questionnaire\models\Questionnaire;
|
||||
use backend\modules\questionnaire\models\QuestionnaireCategory;
|
||||
use common\helpers\ScoreCalculatorHelper;
|
||||
use common\services\ScoreCalculatorService;
|
||||
use Yii;
|
||||
use backend\modules\questionnaire\models\UserQuestionnaire;
|
||||
use backend\modules\questionnaire\models\UserQuestionnaireSearch;
|
||||
@ -169,7 +169,7 @@ class UserQuestionnaireController extends Controller
|
||||
public function actionRateResponses($id)
|
||||
{
|
||||
$user_questionnaire = $this->findModel($id);
|
||||
ScoreCalculatorHelper::rateResponses($user_questionnaire);
|
||||
ScoreCalculatorService::rateResponses($user_questionnaire);
|
||||
|
||||
return $this->actionView($id);
|
||||
}
|
||||
@ -177,7 +177,7 @@ class UserQuestionnaireController extends Controller
|
||||
public function actionCalculateScore($id)
|
||||
{
|
||||
$user_questionnaire = $this->findModel($id);
|
||||
ScoreCalculatorHelper::calculateScore($user_questionnaire);
|
||||
ScoreCalculatorService::calculateScore($user_questionnaire);
|
||||
|
||||
return $this->actionView($id);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
use common\helpers\ScoreCalculatorHelper;
|
||||
use common\services\ScoreCalculatorService;
|
||||
use common\helpers\AnswerHelper;
|
||||
use common\helpers\StatusHelper;
|
||||
use yii\bootstrap\Modal;
|
||||
@ -23,20 +23,8 @@ $this->params['breadcrumbs'][] = ['label' => 'User Questionnaires', 'url' => ['i
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
YiiAsset::register($this);
|
||||
?>
|
||||
|
||||
<?php
|
||||
//$this->registerJs(
|
||||
// '$("document").ready(function(){
|
||||
// $("#new_note").on("pjax:end", function() {
|
||||
// $.pjax.reload({container:"#user_responses"}); //Reload GridView
|
||||
// });
|
||||
// });'
|
||||
//);
|
||||
?>
|
||||
<div class="user-questionnaire-view">
|
||||
|
||||
<!-- --><?php //var_dump($model->setPercentCorrectAnswers(4)); die();?>
|
||||
|
||||
<p>
|
||||
<?= Html::a('Список', ['index'], ['class' => 'btn btn-primary']) ?>
|
||||
<?= Html::a('Изменить', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
|
||||
@ -98,7 +86,7 @@ YiiAsset::register($this);
|
||||
'class' => 'btn btn-success',
|
||||
],
|
||||
]);
|
||||
if(ScoreCalculatorHelper::checkAnswerFlagsForNull($model))
|
||||
if(ScoreCalculatorService::checkAnswerFlagsForNull($model))
|
||||
{
|
||||
echo 'Ответы проверены. Посчитать баллы?';
|
||||
echo Html::a('Посчитать баллы', ['calculate-score', 'id' => $model->id], [
|
||||
@ -169,5 +157,4 @@ YiiAsset::register($this);
|
||||
]);
|
||||
?>
|
||||
<?php Pjax::end(); ?>
|
||||
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user