feat: implement server-side detailed course grade export to CSV, replacing client-side generation and adding a new API endpoint.

This commit is contained in:
2026-02-17 22:53:56 -03:00
parent 4c96d6b225
commit fa52397330
4 changed files with 153 additions and 20 deletions
+8
View File
@@ -744,6 +744,14 @@ export const lmsApi = {
const query = cohortId ? `?cohort_id=${cohortId}` : '';
return apiFetch(`/courses/${id}/grades${query}`, {}, true);
},
exportGradesUrl: (courseId: string): string => {
const token = getToken();
// Since we are downloading via <a> tag, we might need a token in the query if headers are not possible,
// but let's assume the user is authenticated in the session or we use a temporary download link logic.
// For simplicity with standard anchor tags, we'll suggest using a blob fetch if headers are strictly required.
// However, standard API calls use headers.
return `${LMS_API_BASE_URL}/courses/${courseId}/export-grades`;
},
bulkEnroll: (courseId: string, emails: string[]): Promise<BulkEnrollResponse> =>
apiFetch('/bulk-enroll', { method: 'POST', body: JSON.stringify({ course_id: courseId, emails }) }, true),
// Peer Assessment