Updated to hopefully avoid weird crash upon moving student to another class.
Build and Test App / Build-and-test-App (push) Successful in 33s Details
Build and Test API / Build-and-test-API (push) Successful in 53s Details

This commit is contained in:
Andrew Lalis 2025-02-24 18:29:22 -05:00
parent fc4fb21f53
commit 317e85ef35
2 changed files with 8 additions and 1 deletions

View File

@ -218,6 +218,7 @@ void getStudentOverview(ref HttpRequestContext ctx) {
void moveStudentToOtherClass(ref HttpRequestContext ctx) {
Connection conn = getDb();
scope(exit) conn.close();
conn.setAutoCommit(false);
User user = getUserOrThrow(ctx, conn);
auto student = getStudentOrThrow(ctx, conn, user);

View File

@ -188,7 +188,13 @@ export class ClassroomComplianceAPIClient extends APIClient {
studentId: number,
newClassId: number,
): APIResponse<void> {
return super.put(`/classes/${classId}/students/${studentId}/class`, { classId: newClassId })
const url = `/classes/${classId}/students/${studentId}/class`
const promise = fetch(this.baseUrl + url, {
headers: this.getAuthHeaders(),
method: 'PUT',
body: JSON.stringify({ classId: newClassId }),
})
return new APIResponse(this.handleAPIResponseWithNoBody(promise))
}
deleteStudent(classId: number, studentId: number): APIResponse<void> {