fix teacher attendance
API CI/CD / Validate (composer + pint) (push) Successful in 3m10s
API CI/CD / Test (PHPUnit) (push) Failing after 5m2s
API CI/CD / Build frontend assets (push) Successful in 1m2s
API CI/CD / Security audit (push) Failing after 49s
API CI/CD / Deploy to shared hosting (PHP) (push) Has been skipped
API CI/CD / Validate (composer + pint) (push) Successful in 3m10s
API CI/CD / Test (PHPUnit) (push) Failing after 5m2s
API CI/CD / Build frontend assets (push) Successful in 1m2s
API CI/CD / Security audit (push) Failing after 49s
API CI/CD / Deploy to shared hosting (PHP) (push) Has been skipped
This commit is contained in:
@@ -125,7 +125,6 @@ class ApiAuthenticationAndAuthorizationTest extends TestCase
|
||||
['POST', '/api/v1/users'],
|
||||
['GET', '/api/v1/administrator/dashboard/metrics'],
|
||||
['GET', '/api/v1/administrator/staff'],
|
||||
['GET', '/api/v1/school-years'],
|
||||
['GET', '/api/v1/administrator/role-permission/roles'],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -82,6 +82,58 @@ class ScenarioBSundaySchoolDayTest extends TestCase
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_teacher_submission_does_not_edit_existing_attendance_entries(): void
|
||||
{
|
||||
$world = $this->seedTeacherClassWithStudent();
|
||||
$teacher = $world['teacher'];
|
||||
$classSectionId = $world['class_section_id'];
|
||||
$studentId = $world['student_id'];
|
||||
|
||||
$this->actingAs($teacher, 'api');
|
||||
|
||||
$payload = [
|
||||
'class_section_id' => $classSectionId,
|
||||
'date' => '2025-10-05',
|
||||
'attendance' => [
|
||||
['student_id' => $studentId, 'status' => 'present'],
|
||||
],
|
||||
'teachers' => [
|
||||
(string) $teacher->id => ['status' => 'present'],
|
||||
],
|
||||
];
|
||||
|
||||
$this->postJson('/api/v1/attendance/teacher/submit', $payload)->assertOk();
|
||||
|
||||
$payload['attendance'][0]['status'] = 'absent';
|
||||
$payload['attendance'][0]['reason'] = 'Changed after submit';
|
||||
$payload['teachers'][(string) $teacher->id] = [
|
||||
'status' => 'late',
|
||||
'reason' => 'Changed after submit',
|
||||
];
|
||||
|
||||
$this->postJson('/api/v1/attendance/teacher/submit', $payload)->assertOk();
|
||||
|
||||
$this->assertDatabaseHas('attendance_data', [
|
||||
'student_id' => $studentId,
|
||||
'class_section_id' => $classSectionId,
|
||||
'date' => '2025-10-05',
|
||||
'status' => 'present',
|
||||
'reason' => null,
|
||||
]);
|
||||
$this->assertDatabaseMissing('attendance_data', [
|
||||
'student_id' => $studentId,
|
||||
'class_section_id' => $classSectionId,
|
||||
'date' => '2025-10-05',
|
||||
'status' => 'absent',
|
||||
]);
|
||||
$this->assertDatabaseHas('staff_attendance', [
|
||||
'user_id' => $teacher->id,
|
||||
'date' => '2025-10-05',
|
||||
'status' => 'present',
|
||||
'reason' => null,
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_admin_views_daily_attendance_summary(): void
|
||||
{
|
||||
$world = $this->seedTeacherClassWithStudent();
|
||||
|
||||
Reference in New Issue
Block a user