results page

This commit is contained in:
Kirill Ivlev 2024-10-31 01:32:02 +04:00
parent bcc2913d0f
commit 75080c29bb
4 changed files with 13 additions and 2 deletions

View file

@ -63,9 +63,10 @@ export class GameService implements OnApplicationBootstrap{
} else {
qItem = await this.gameQueueModel.findById(id).exec();
}
this.logger.verbose(`Set ${id} in queue as completed`);
this.logger.verbose(`Set ${qItem.id} in queue as completed`);
if (!qItem) {
throw new InternalServerErrorException('no such item');
}
qItem.completed = true;
await qItem.save();

View file

@ -30,6 +30,7 @@ export class QuizMessagingController {
async completeQueueItem(@Payload() data: any) {
this.logger.verbose(`complete item`)
await this.gameService.markQueueAsCompleted(null);
//await this.quizService.proceedWithGame();
}
@MessagePattern({ cmd: CommandsConsts.GetCards})

View file

@ -16,6 +16,11 @@ export class QuizController {
return await this.quizService.setQuestion(qustionDto);
}
@Get('question-results')
async GetQuestionResults() {
return await this.quizService.getQuestionResults();
}
@Post('proceed')
async Get() {
console.log('proceed with game')

View file

@ -122,7 +122,6 @@ export class QuizService {
async proceedWithGame() {
this.logger.verbose(`[proceedWithGame] Executing proceed with game`);
await this.calculateScore();
//this.sharedService.sendSocketNotificationToAllClients(SocketEvents.GameQueueItem, {});
await this.commandBus.execute(new ProceedGameQueueCommand());
return Promise.resolve(true);
}
@ -264,4 +263,9 @@ export class QuizService {
await newQuestion.save();
}
}
async getQuestionResults() {
const question = await this.get();
return question.userAnswers;
}
}