feat: QA fixes, new APIs (assignments, rubrics, custom exams), Generation page enhancements

- Fix ELAI video generation (correct render endpoint, script splitting for 60s limit)
- Fix speaking script generation error handling and empty response display
- Add custom exam list API (GET /api/exam/custom/list)
- Add assignments REST API (list, create, get)
- Add rubrics REST API (list, create)
- Enhance Generation page: dynamic exam structures, auto-module selection, preview dialog, audio player
- Improve submit feedback with exam ID and status in toast notifications
- Fix ExamsListPage to show both custom exams and exam sessions
- Connect RubricsPage to backend API with fallback data
- Add Dockerfile, docker-compose.yml, requirements.txt for deployment
- Fix placement, grading, scoring, and auth controllers
- Add ErrorBoundary component for frontend resilience
- Add QA report and credentials documentation

Made-with: Cursor
This commit is contained in:
Yamen Ahmad
2026-04-12 14:26:39 +04:00
parent 571a08d0f7
commit 82ec3debcc
38 changed files with 2324 additions and 243 deletions

View File

@@ -9,22 +9,22 @@ import type {
import type { ApiSuccessResponse } from "@/types";
export const adaptiveEngineService = {
getDashboard: () => api.get<AdaptiveDashboardMetrics>("/adaptive-engine/dashboard"),
getDashboard: () => api.get<AdaptiveDashboardMetrics>("/adaptive/dashboard"),
getStudents: (params?: { page?: number; limit?: number }) =>
api.get<{ data: AdaptiveEngineStudentRow[]; pagination?: { total: number; page: number } }>(
"/adaptive-engine/students",
"/adaptive/students",
params as Record<string, string | number | boolean | undefined>,
),
getStudentSignals: (studentId: number) =>
api.get<StudentAdaptiveSignal[]>(`/adaptive-engine/students/${studentId}/signals`),
api.get<StudentAdaptiveSignal[]>(`/adaptive/student/${studentId}/signals`),
getStudentAbility: (studentId: number) =>
api.get<StudentAbilityModel>(`/adaptive-engine/students/${studentId}/ability`),
api.get<StudentAbilityModel>(`/adaptive/student/${studentId}/ability`),
getSettings: () => api.get<AdaptiveThresholdSettings>("/adaptive-engine/settings"),
getSettings: () => api.get<AdaptiveThresholdSettings>("/adaptive/settings"),
updateSettings: (data: AdaptiveThresholdSettings) =>
api.put<ApiSuccessResponse>("/adaptive-engine/settings", data),
api.put<ApiSuccessResponse>("/adaptive/settings", data),
};

View File

@@ -11,14 +11,14 @@ export const entityOnboardingService = {
validateCsv: (file: File) => {
const fd = new FormData();
fd.append("file", file);
return api.upload<CSVValidationReport>("/entity/students/csv/validate", fd);
return api.upload<CSVValidationReport>("/entity/students/validate-csv", fd);
},
bulkCreate: (payload: { validate_session_id?: string }) =>
api.post<BulkCreateResult>("/entity/students/bulk-create", payload),
sendCredentials: (studentIds: number[]) =>
api.post<ApiSuccessResponse>("/entity/students/send-credentials", { student_ids: studentIds }),
api.post<ApiSuccessResponse>("/entity/students/send-credentials", { user_ids: studentIds }),
getCredentialStatuses: (
filters?: CredentialFilters & { page?: number; limit?: number },
@@ -29,8 +29,8 @@ export const entityOnboardingService = {
),
resendCredential: (studentId: number) =>
api.post<ApiSuccessResponse>(`/entity/students/${studentId}/resend-credential`),
api.post<ApiSuccessResponse>(`/entity/students/${studentId}/resend-credentials`),
resendAllPending: () =>
api.post<ApiSuccessResponse>("/entity/students/resend-credentials/pending"),
api.post<ApiSuccessResponse>("/entity/students/resend-all-pending"),
};

View File

@@ -14,4 +14,7 @@ export const examSessionService = {
getStatus: (examId: number) =>
api.get<{ status: string; scores_available: boolean }>(`/exam/${examId}/status`),
getResults: (examId: number) =>
api.get(`/exam/${examId}/results`),
};

View File

@@ -1,11 +1,15 @@
import { api } from "@/lib/api-client";
const API_BASE_URL = (import.meta.env.VITE_API_BASE_URL?.trim() || "/api").replace(/\/$/, "");
export const reportService = {
downloadPdf: async (attemptId: number): Promise<void> => {
const response = await fetch(`/api/reports/exam/${attemptId}/pdf`, {
headers: {
Authorization: `Bearer ${localStorage.getItem("encoach_token")}`,
},
const token = localStorage.getItem("encoach_token");
const headers: Record<string, string> = {};
if (token) {
headers["Authorization"] = `Bearer ${token}`;
}
const response = await fetch(`${API_BASE_URL}/reports/exam/${attemptId}/pdf`, {
headers,
});
if (!response.ok) throw new Error("Failed to generate report");
const blob = await response.blob();
@@ -13,7 +17,9 @@ export const reportService = {
const link = document.createElement("a");
link.href = url;
link.download = `exam-report-${attemptId}.pdf`;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
window.URL.revokeObjectURL(url);
},
};