Skip to content
Draft
Show file tree
Hide file tree
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
142 changes: 78 additions & 64 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/backend/services/edit-game/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import EditGameService from '@/backend/services/edit-game/EditGameService';
import { QuestionType } from '@/models/questions/question-type';
import { RoundData } from '@/models/rounds/round';
import { RoundType } from '@/models/rounds/round-type';

export const addRoundToGame = async (gameId: string, roundTitle: string, roundType: RoundType) => {
Expand Down Expand Up @@ -29,7 +30,7 @@ export const removeQuestionFromRound = async (
return service.removeQuestionFromRound(questionType, roundId, questionId);
};

export const updateRound = async (gameId: string, roundId: string, roundData: any) => {
export const updateRound = async (gameId: string, roundId: string, roundData: RoundData) => {
const service = new EditGameService(gameId);
return service.updateRound(roundId, roundData);
};
Expand Down
5 changes: 0 additions & 5 deletions src/backend/services/question/GameBuzzerQuestionService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,19 +271,14 @@ export default class GameBuzzerQuestionService extends GameQuestionService {
const points = (round as BuzzerRound).rewardsPerQuestion;

await this.roundScoreRepo.increaseTeamScoreTransaction(transaction, questionId, teamId, points);

// Update the winner player status
await this.playerRepo.updatePlayerStatusTransaction(transaction, playerId, PlayerStatus.CORRECT);

// Update the question winner team
await (this.gameQuestionRepo as GameBuzzerQuestionRepository).updateQuestionWinnerTransaction(
transaction,
questionId,
playerId,
teamId
);
await this.soundRepo.addSoundTransaction(transaction, 'anime_wow');

await this.endQuestionTransaction(transaction, questionId);

this.log.info({ question: questionId, type: this.questionType, player: playerId }, 'Answer validated');
Expand Down
12 changes: 6 additions & 6 deletions src/backend/services/question/quote/GameQuoteQuestionService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import GameBuzzerQuestionService from '@/backend/services/question/GameBuzzerQue
import { isObjectEmpty } from '@/backend/utils/objects';
import { BuzzerQuestionPlayers } from '@/models/questions/buzzer';
import { QuestionType } from '@/models/questions/question-type';
import { GameQuoteQuestion, QuoteQuestion } from '@/models/questions/quote';
import { GameQuoteQuestion, QuotePart, QuoteQuestion } from '@/models/questions/quote';
import { QuoteRound } from '@/models/rounds/quote';
import { PlayerStatus } from '@/models/users/player';

Expand Down Expand Up @@ -44,8 +44,8 @@ export default class GameQuoteQuestionService extends GameBuzzerQuestionService
{}
);
if ((toGuess as string[]).includes('quote')) {
initialRevealed['quote'] = (baseQuestion.quoteParts as unknown[]).reduce(
(acc: Record<string, Record<string, unknown>>, _: unknown, idx: number) => {
initialRevealed['quote'] = (baseQuestion.quoteParts as QuotePart[]).reduce(
(acc: Record<string, Record<string, unknown>>, _: QuotePart, idx: number) => {
acc[idx] = {};
return acc;
},
Expand Down Expand Up @@ -264,14 +264,14 @@ export default class GameQuoteQuestionService extends GameBuzzerQuestionService
}

const toGuess = baseQuestion.toGuess;
const quoteParts = baseQuestion.quoteParts;
const quoteParts = baseQuestion.quoteParts as QuotePart[];

const temp1 = (toGuess as string[]).every(
(elem: string) => newRevealed[elem] && !isObjectEmpty(newRevealed[elem])
);
const newRevealedQuote = newRevealed['quote'];
const temp2 = (quoteParts as unknown[]).every(
(_: unknown, idx: number) =>
const temp2 = quoteParts.every(
(_: QuotePart, idx: number) =>
newRevealedQuote[idx] && !isObjectEmpty(newRevealedQuote[idx] as Record<string, unknown>)
);
const allRevealed = temp1 && temp2;
Expand Down
4 changes: 2 additions & 2 deletions src/frontend/components/game-editor/EditRoundInGame.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ import defineMessages from '@/frontend/i18n/defineMessages';
import globalMessages from '@/frontend/i18n/globalMessages';
import { GameStatus } from '@/models/games/game-status';
import { QuestionType } from '@/models/questions/question-type';
import { Round } from '@/models/rounds/round';
import { Round, RoundData } from '@/models/rounds/round';
import { RoundType, roundTypeToEmoji, roundTypeToTitle } from '@/models/rounds/round-type';
import { AnyRound } from '@/models/rounds/RoundFactory';
import { Timer } from '@/models/timer';
Expand Down Expand Up @@ -180,7 +180,7 @@ export const EditGameRoundCard = memo(function EditGameRoundCard({
const v = val as { toDate?: () => Date } | null | undefined;
return v?.toDate?.() ? v.toDate().toISOString() : val;
};
const updatedRoundData = {
const updatedRoundData: RoundData = {
...roundObj,
questions: reorderedQuestions,
createdAt: toDateSafe(roundObj.createdAt),
Expand Down
Loading