mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-04-24 06:58:10 -05:00
Tournament: log about score undo + match reopen
This commit is contained in:
parent
be3afcc710
commit
dac0c79129
|
|
@ -53,6 +53,7 @@ import {
|
|||
} from "../tournament-bracket-utils";
|
||||
import bracketStyles from "../tournament-bracket.css";
|
||||
import * as TournamentRepository from "~/features/tournament/TournamentRepository.server";
|
||||
import { logger } from "~/utils/logger";
|
||||
|
||||
export const links: LinksFunction = () => [
|
||||
{
|
||||
|
|
@ -193,6 +194,10 @@ export const action: ActionFunction = async ({ params, request }) => {
|
|||
scores[1]--;
|
||||
}
|
||||
|
||||
logger.info(
|
||||
`Undoing score: Position: ${data.position}; User ID: ${user.id}; Match ID: ${match.id}`,
|
||||
);
|
||||
|
||||
sql.transaction(() => {
|
||||
deleteTournamentMatchGameResultById(lastResult.id);
|
||||
|
||||
|
|
@ -233,6 +238,10 @@ export const action: ActionFunction = async ({ params, request }) => {
|
|||
scores[1]--;
|
||||
}
|
||||
|
||||
logger.info(
|
||||
`Reopening match: User ID: ${user.id}; Match ID: ${match.id}`,
|
||||
);
|
||||
|
||||
try {
|
||||
sql.transaction(() => {
|
||||
deleteTournamentMatchGameResultById(lastResult.id);
|
||||
|
|
|
|||
8
app/utils/logger.ts
Normal file
8
app/utils/logger.ts
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
/* eslint-disable no-console */
|
||||
// stub file to enable different solution later
|
||||
|
||||
export const logger = {
|
||||
info: console.log,
|
||||
error: console.error,
|
||||
warn: console.warn,
|
||||
};
|
||||
Loading…
Reference in New Issue
Block a user