diff --git a/composer.json b/composer.json index 7a0e316..fd8b7d0 100644 --- a/composer.json +++ b/composer.json @@ -5,7 +5,8 @@ "require": { "php": ">=7.4|>=8", "escolalms/core": "^1", - "laravel/framework": ">=8.0" + "laravel/framework": ">=8.0", + "doctrine/dbal": "^2|^3" }, "require-dev": { "phpunit/phpunit": "^9.0", diff --git a/src/Repository/QuestionAnswerRepository.php b/src/Repository/QuestionAnswerRepository.php index 4017087..fb80b7c 100644 --- a/src/Repository/QuestionAnswerRepository.php +++ b/src/Repository/QuestionAnswerRepository.php @@ -156,7 +156,7 @@ private function getQueryReport( ->model ->newQuery() ->join('questions', 'question_id', '=', 'questions.id') - ->where('questions.type', '=', QuestionTypeEnum::RATE) + ->where('questions.type', '=', QuestionTypeEnum::REVIEW) ->when($questionnaireId, fn ($q) => $q->where('questions.questionnaire_id', '=', $questionnaireId)) ->when($modelTypeId, fn ($q) => $q ->join('questionnaire_models', 'questionnaire_models.id', '=', 'questionnaire_model_id') diff --git a/tests/Api/QuestionnaireReportTest.php b/tests/Api/QuestionnaireReportTest.php index 6511dd3..f25b12b 100644 --- a/tests/Api/QuestionnaireReportTest.php +++ b/tests/Api/QuestionnaireReportTest.php @@ -3,6 +3,7 @@ namespace EscolaLms\Questionnaire\Tests\Api; use EscolaLms\Questionnaire\Database\Seeders\QuestionnairePermissionsSeeder; +use EscolaLms\Questionnaire\Enums\QuestionTypeEnum; use EscolaLms\Questionnaire\Models\Question; use EscolaLms\Questionnaire\Models\QuestionAnswer; use EscolaLms\Questionnaire\Models\Questionnaire; @@ -28,7 +29,7 @@ protected function setUp(): void Question::factory() ->count(20) - ->create(); + ->create(['type' => QuestionTypeEnum::REVIEW]); QuestionAnswer::factory() ->count(200)