add test batches

This commit is contained in:
root
2026-06-08 23:45:55 -04:00
parent c792b8be05
commit 8d4d610b82
1480 changed files with 22587 additions and 10762 deletions
@@ -94,9 +94,8 @@ class ClassProgressController extends BaseApiController
$filters['semester'] = $filters['semester'] ?? ($meta['semester'] ?? null);
$paginator = $this->queryService->listReports($auth, $filters);
if (! empty($filters['group_by_week'])) {
if (!empty($filters['group_by_week'])) {
$grouped = ClassProgressGroupCollection::fromPaginator($paginator);
return $this->respondSuccess($grouped, 'Progress reports retrieved.');
}
@@ -136,7 +135,6 @@ class ClassProgressController extends BaseApiController
Log::error('Failed to create class progress reports.', [
'error' => $e->getMessage(),
]);
return $this->respondError('Unable to save progress reports.', 500);
}
@@ -172,7 +170,6 @@ class ClassProgressController extends BaseApiController
Log::error('Failed to update class progress report.', [
'error' => $e->getMessage(),
]);
return $this->respondError('Unable to update progress report.', 500);
}
@@ -187,7 +184,6 @@ class ClassProgressController extends BaseApiController
Log::error('Failed to delete class progress report.', [
'error' => $e->getMessage(),
]);
return $this->respondError('Unable to delete progress report.', 500);
}
@@ -197,7 +193,7 @@ class ClassProgressController extends BaseApiController
public function downloadAttachment(int $attachment): BinaryFileResponse|JsonResponse
{
$record = ClassProgressAttachment::query()->find($attachment);
if (! $record || ! $record->file_path) {
if (!$record || !$record->file_path) {
return $this->respondError('Attachment not found.', 404);
}
@@ -206,12 +202,11 @@ class ClassProgressController extends BaseApiController
}
$path = $this->attachmentService->resolvePath($record->file_path);
if (! $path) {
if (!$path) {
return $this->respondError('Attachment missing.', 404);
}
$downloadName = $record->original_name ?: basename($path);
return response()->download($path, $downloadName);
}
@@ -219,12 +214,12 @@ class ClassProgressController extends BaseApiController
{
$this->authorize('view', $class_progress);
if (! $class_progress->attachment_path) {
if (!$class_progress->attachment_path) {
return $this->respondError('Attachment not found.', 404);
}
$path = $this->attachmentService->resolvePath($class_progress->attachment_path);
if (! $path) {
if (!$path) {
return $this->respondError('Attachment missing.', 404);
}
@@ -233,18 +228,19 @@ class ClassProgressController extends BaseApiController
/**
* @param mixed $user
* @return User|JsonResponse
*/
private function requireAuthenticatedUser($user): User|JsonResponse
{
if (! $user instanceof User) {
if (!$user instanceof User) {
$user = auth()->user();
}
if (! $user instanceof User) {
if (!$user instanceof User) {
$user = $this->laravelRequest->user();
}
if (! $user instanceof User) {
if (!$user instanceof User) {
return $this->respondError('Unauthorized.', Response::HTTP_UNAUTHORIZED);
}