fix parent pages and teachers and admin
API CI/CD / Validate (composer + pint) (push) Successful in 3m8s
API CI/CD / Build frontend assets (push) Successful in 1m2s
API CI/CD / Test (PHPUnit) (push) Failing after 6m5s
API CI/CD / Security audit (push) Failing after 52s
API CI/CD / Deploy to shared hosting (PHP) (push) Has been skipped
API CI/CD / Validate (composer + pint) (push) Successful in 3m8s
API CI/CD / Build frontend assets (push) Successful in 1m2s
API CI/CD / Test (PHPUnit) (push) Failing after 6m5s
API CI/CD / Security audit (push) Failing after 52s
API CI/CD / Deploy to shared hosting (PHP) (push) Has been skipped
This commit is contained in:
@@ -25,6 +25,23 @@ class ClassProgressQueryServiceTest extends TestCase
|
||||
'teacher_id' => $user->id,
|
||||
'class_section_id' => 202,
|
||||
]);
|
||||
DB::table('classSection')->insert([
|
||||
'id' => 1,
|
||||
'class_id' => 1,
|
||||
'class_section_id' => 101,
|
||||
'class_section_name' => '1-A',
|
||||
'semester' => 'Fall',
|
||||
'school_year' => '2025-2026',
|
||||
]);
|
||||
DB::table('teacher_class')->insert([
|
||||
'class_section_id' => 1,
|
||||
'teacher_id' => $user->id,
|
||||
'position' => 'main',
|
||||
'semester' => 'Fall',
|
||||
'school_year' => '2025-2026',
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
|
||||
$service = new ClassProgressQueryService(new ClassProgressRuleService);
|
||||
$results = $service->listReports($user, ['class_section_id' => 101]);
|
||||
@@ -32,6 +49,78 @@ class ClassProgressQueryServiceTest extends TestCase
|
||||
$this->assertSame(1, $results->total());
|
||||
}
|
||||
|
||||
public function test_list_reports_filters_by_equivalent_legacy_section_ids(): void
|
||||
{
|
||||
$user = $this->createUser();
|
||||
DB::table('classSection')->insert([
|
||||
'id' => 1,
|
||||
'class_id' => 1,
|
||||
'class_section_id' => 101,
|
||||
'class_section_name' => '1-A',
|
||||
'semester' => 'Fall',
|
||||
'school_year' => '2025-2026',
|
||||
]);
|
||||
DB::table('teacher_class')->insert([
|
||||
'class_section_id' => 101,
|
||||
'teacher_id' => $user->id,
|
||||
'position' => 'main',
|
||||
'semester' => 'Fall',
|
||||
'school_year' => '2025-2026',
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
$report = ClassProgressReport::factory()->create([
|
||||
'teacher_id' => 999,
|
||||
'class_section_id' => 1,
|
||||
'school_year' => '2025-2026',
|
||||
]);
|
||||
|
||||
$service = new ClassProgressQueryService(new ClassProgressRuleService);
|
||||
$results = $service->listReports($user, ['class_section_id' => 101]);
|
||||
|
||||
$this->assertSame(1, $results->total());
|
||||
$this->assertSame($report->id, $results->items()[0]->id);
|
||||
}
|
||||
|
||||
public function test_teacher_assignments_prefer_section_code_over_colliding_primary_key(): void
|
||||
{
|
||||
$user = $this->createUser();
|
||||
DB::table('classSection')->insert([
|
||||
[
|
||||
'id' => 1,
|
||||
'class_id' => 1,
|
||||
'class_section_id' => 10,
|
||||
'class_section_name' => '1',
|
||||
'semester' => 'Fall',
|
||||
'school_year' => '2025-2026',
|
||||
],
|
||||
[
|
||||
'id' => 10,
|
||||
'class_id' => 3,
|
||||
'class_section_id' => 31,
|
||||
'class_section_name' => '3-A',
|
||||
'semester' => 'Fall',
|
||||
'school_year' => '2025-2026',
|
||||
],
|
||||
]);
|
||||
DB::table('teacher_class')->insert([
|
||||
'class_section_id' => 10,
|
||||
'teacher_id' => $user->id,
|
||||
'position' => 'main',
|
||||
'semester' => 'Fall',
|
||||
'school_year' => '2025-2026',
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
|
||||
$service = new ClassProgressQueryService(new ClassProgressRuleService);
|
||||
$assignments = $service->teacherAssignments($user, '2025-2026', 'Fall');
|
||||
|
||||
$this->assertCount(1, $assignments);
|
||||
$this->assertSame(10, $assignments[0]['class_section_id']);
|
||||
$this->assertSame('1', $assignments[0]['class_section_name']);
|
||||
}
|
||||
|
||||
private function createUser(): User
|
||||
{
|
||||
DB::table('users')->insert([
|
||||
|
||||
Reference in New Issue
Block a user