From: Daniel Karbach Date: Wed, 4 Feb 2026 09:45:32 +0000 (+0100) Subject: show points in sync with scoreboard X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=725aaa664e0ef6fe6bb32b8e0b8b32dee7bb54da;p=alttp.git show points in sync with scoreboard --- diff --git a/resources/js/components/results/DetailDialog.jsx b/resources/js/components/results/DetailDialog.jsx index 2ebd593..9609621 100644 --- a/resources/js/components/results/DetailDialog.jsx +++ b/resources/js/components/results/DetailDialog.jsx @@ -7,19 +7,11 @@ import { useTranslation } from 'react-i18next'; import ModifyForm from './ModifyForm'; import Verification from './Verification'; import Box from '../users/Box'; -import { formatTime, getTime } from '../../helpers/Result'; +import { formatTime, getPlacement, getTime } from '../../helpers/Result'; import { formatNumberAlways } from '../../helpers/Round'; import { mayModifyResult, maySeeResult, mayVerifyResult } from '../../helpers/permissions'; -import { getScoreFormatOptions } from '../../helpers/Tournament'; import { findResult } from '../../helpers/User'; import { useUser } from '../../hooks/user'; -import i18n from '../../i18n'; - -const getPlacement = (tournament, result, t) => - `${result.placement}. (${t('results.points', { - count: result.score, - score: i18n.number(result.score, getScoreFormatOptions(tournament)), - })})`; const DetailDialog = ({ actions, diff --git a/resources/js/components/results/TableRow.jsx b/resources/js/components/results/TableRow.jsx index 5815527..ff9cb7c 100644 --- a/resources/js/components/results/TableRow.jsx +++ b/resources/js/components/results/TableRow.jsx @@ -7,10 +7,9 @@ import VodLink from './VodLink'; import ResultProtocol from '../protocol/ResultProtocol'; import Box from '../users/Box'; import { maySeeResult, mayVerifyResult } from '../../helpers/permissions'; -import { getScoreFormatOptions } from '../../helpers/Tournament'; +import { getPlacement } from '../../helpers/Result'; import { findResult } from '../../helpers/User'; import { useUser } from '../../hooks/user'; -import i18n from '../../i18n'; const TableRow = ({ actions, @@ -59,10 +58,7 @@ const TableRow = ({ {showPlacement ? {maySee && result && result.placement - ? `${result.placement}. (${t('results.points', { - count: result.score, - score: i18n.number(result.score, getScoreFormatOptions(tournament)), - })})` + ? getPlacement(tournament, result, t) : t('results.pending')} : null} diff --git a/resources/js/helpers/Result.jsx b/resources/js/helpers/Result.jsx index efa592e..84a253e 100644 --- a/resources/js/helpers/Result.jsx +++ b/resources/js/helpers/Result.jsx @@ -1,7 +1,9 @@ import React from 'react'; -import Icon from '../components/common/Icon'; +import { getScoreFormatOptions } from './Tournament'; import { getUserName } from './User'; +import Icon from '../components/common/Icon'; +import i18n from '../i18n'; export const compareUsername = (a, b) => { const a_name = (a && getUserName(a.user)) || ''; @@ -66,6 +68,16 @@ export const getIcon = (result, maySee) => { return ; }; +export const getPlacement = (tournament, result, t) => { + if (tournament?.show_scoreboard) { + return `${result.placement}. (${t('results.points', { + count: result.score, + score: i18n.number(result.score, getScoreFormatOptions(tournament)), + })})`; + } + return `${result.placement}.`; +}; + export const getTime = (result, maySee) => { if (!result || !maySee) { return null;