fix new logic to calculator with required and optional subjects
Tests & Lint & Deploy to Railway / build (2.6.6, 20.x, 8.3) (push) Successful in 1m47s Details
Tests & Lint & Deploy to Railway / deploy (push) Successful in 34s Details

This commit is contained in:
aslan 2024-03-18 11:21:48 +03:00
parent 077eda117f
commit 68ccbf2910
1 changed files with 6 additions and 6 deletions

View File

@ -2,12 +2,12 @@
namespace App\Http\Controllers\Api;
use App\Enums\ExaminationTypeEnum;
use App\Http\Controllers\Controller;
use App\Models\Department;
use App\Models\Direction;
use App\Models\EntranceExamination;
use App\Models\Faculty;
use App\Models\SubjectType;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\URL;
@ -20,7 +20,8 @@ class CalculatorController extends Controller
$countUserSubjects = count($calcultatorSubjects);
$filteredDirectionIds = EntranceExamination::all()
->select("direction_id", "subject_id", "subject_type_id")
->select("direction_id", "subject_id", "subject_type_id", "examination_type_id")
->where('examination_type_id', '=', ExaminationTypeEnum::Ege->value)
->reduce(function (array $carry, $examine) {
[
@ -48,9 +49,8 @@ class CalculatorController extends Controller
$optionalSubjectsInCalculator = collect($subjectTypes[2])
->filter(fn($optionalSubject) => in_array($optionalSubject, $calcultatorSubjects));
return $optionalSubjectsInCalculator->count() !== 0;
})->map(fn ($subjectTypes, $directionId) => $directionId)
;
// dd($result);
})->map(fn($subjectTypes, $directionId) => $directionId);
$directions = Direction::whereIn('id', $result)->get();