fix enrollment for the new school-year
Tests / PHPUnit (push) Successful in 1m26s

This commit is contained in:
root
2026-08-07 23:43:31 -04:00
parent b6f3b14e7b
commit 1ef2800f12
66 changed files with 8997 additions and 498 deletions
+12 -12
View File
@@ -2,10 +2,10 @@
namespace App\Controllers\View;
use App\Controllers\BaseController;
use App\Models\StudentModel;
use App\Models\StudentClassModel;
use App\Models\ConfigurationModel;
use CodeIgniter\Controller;
use CodeIgniter\Events\Events;
use App\Models\HomeworkModel;
use App\Models\QuizModel;
@@ -35,7 +35,7 @@ use App\Services\NavbarService;
//use App\Models\ScoreModel;
class GradingController extends Controller
class GradingController extends BaseController
{
protected $semesterScoreService;
protected $db;
@@ -1119,15 +1119,6 @@ public function belowSixty()
]);
}
private function currentSchoolYearName(?string $fallback = null): string
{
try {
return service('schoolYearContext')->resolve($this->request)->yearName();
} catch (\Throwable) {
return trim((string) ($fallback ?? ''));
}
}
public function editBelowSixtyEmail()
{
$studentId = (int)$this->request->getGet('student_id');
@@ -2329,7 +2320,8 @@ public function belowSixty()
public function belowSixtyDecisions()
{
$configuredYear = (string) $this->schoolYear;
$schoolYearContext = $this->resolveSchoolYearContext();
$configuredYear = $schoolYearContext->yearName();
$schoolYear = trim((string)($this->request->getGet('school_year') ?? ''));
@@ -2541,11 +2533,15 @@ public function belowSixty()
'schoolYear' => $schoolYear,
'schoolYears' => $schoolYears,
'canViewGrading' => $canViewGrading,
'isEditable' => ! $schoolYearContext->isReadonly(),
]);
}
public function saveBelowSixtyDecision()
{
$schoolYearContext = $this->resolveSchoolYearContext();
$this->assertSchoolYearWritable($schoolYearContext);
$studentId = (int)($this->request->getPost('student_id') ?? 0);
$semester = strtolower(trim((string)($this->request->getPost('semester') ?? 'year')));
$schoolYear = trim((string)($this->request->getPost('school_year') ?? ''));
@@ -2556,6 +2552,10 @@ public function saveBelowSixtyDecision()
return redirect()->back()->with('error', 'Missing student or school year.');
}
if ($schoolYear !== $schoolYearContext->yearName()) {
return redirect()->back()->with('error', 'Selected school year does not match the submitted decision.');
}
// This decision page should feed certificate decisions as whole-year decisions.
// Force year mode here so certificate logic receives final year decision.
$semester = 'year';