]> git.localhorst.tv Git - alttp.git/commitdiff
show points in sync with scoreboard
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Wed, 4 Feb 2026 09:45:32 +0000 (10:45 +0100)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Wed, 4 Feb 2026 09:45:32 +0000 (10:45 +0100)
resources/js/components/results/DetailDialog.jsx
resources/js/components/results/TableRow.jsx
resources/js/helpers/Result.jsx

index 2ebd59349ce2cef13677ea91c916107f648faec1..9609621a1589c825de24708c5c705f2a997893c6 100644 (file)
@@ -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,
index 5815527e733aec40c9918830c1ff9505f8ef61e2..ff9cb7ca8afc529aad33352132176b7b4a335412 100644 (file)
@@ -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 ?
                        <td className="result-placement">
                                {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')}
                        </td>
                : null}
index efa592e0f51aa5dd94115dc521ef39926b5d2546..84a253e821aafeb7c4453cbe50d3a8d0ba371cc2 100644 (file)
@@ -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 <Icon.FINISHED className="text-success" size="lg" />;
 };
 
+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;