Skip to content

Commit

Permalink
Change question type in db queries (#52)
Browse files Browse the repository at this point in the history
Co-authored-by: Tomasz Smolarek <[email protected]>
  • Loading branch information
dyfero and dyfero authored Feb 23, 2024
1 parent 02ad66c commit d633d1e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/Repository/QuestionAnswerRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
3 changes: 2 additions & 1 deletion tests/Api/QuestionnaireReportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -28,7 +29,7 @@ protected function setUp(): void

Question::factory()
->count(20)
->create();
->create(['type' => QuestionTypeEnum::REVIEW]);

QuestionAnswer::factory()
->count(200)
Expand Down

0 comments on commit d633d1e

Please sign in to comment.