Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix forfeit not retrieving snapshot #95

Merged
merged 2 commits into from
Nov 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion services/collaboration/src/controllers/roomController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export const closeRoomController = async (req: Request, res: Response) => {
export const updateUserStatusInRoomController = async (req: Request, res: Response) => {
const userId = req.user.id;
const { roomId } = req.params;
const { isForfeit, snapshot } = req.body;
const { isForfeit } = req.body;

// Validate that isForfeit is a boolean value
if (typeof isForfeit !== 'boolean') {
Expand All @@ -140,6 +140,9 @@ export const updateUserStatusInRoomController = async (req: Request, res: Respon
return handleHttpNotFound(res, 'User not found in room');
}

// Obtain code and language
const snapshot = await retrieveSnapshot(roomId);

// Record the forfeited status in the user's history
await produceUpdateHistory(roomId, userId, HistoryStatus.FORFEITED, snapshot);

Expand Down