]> git.localhorst.tv Git - alttp.git/commitdiff
hide rounds for qualifiers
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Mon, 5 Jan 2026 19:56:25 +0000 (20:56 +0100)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Mon, 5 Jan 2026 19:56:25 +0000 (20:56 +0100)
resources/js/components/tournament/Detail.jsx
resources/js/helpers/permissions.js

index 1a16ea459d262412809360435d4e47d8a239bc29..e90ab99db9c7b7eaa4c473f6b828d94ad7a4ca94 100644 (file)
@@ -19,6 +19,7 @@ import {
        isRunner,
        mayAddRounds,
        mayExportTournament,
+       maySeeRound,
        mayUpdateTournament,
        mayViewProtocol,
 } from '../../helpers/permissions';
@@ -65,6 +66,11 @@ const Detail = ({
                })
        }, []);
 
+       const rounds = React.useMemo(
+               () => tournament.rounds || []).filter((r) => maySeeRound(user, tournament, r),
+               [tournament.rounds, user],
+       );
+
        return <Container className={getClassName(tournament, user)} fluid>
                <Row>
                        <Col lg={8} xl={9}>
@@ -164,14 +170,12 @@ const Detail = ({
                                                : null}
                                        </div>
                                </div>
-                               {tournament.rounds ?
-                                       <Rounds
-                                               actions={actions}
-                                               resultView={resultView}
-                                               rounds={tournament.rounds}
-                                               tournament={tournament}
-                                       />
-                               : null}
+                               <Rounds
+                                       actions={actions}
+                                       resultView={resultView}
+                                       rounds={rounds}
+                                       tournament={tournament}
+                               />
                        </Col>
                </Row>
        </Container>;
index bac1559fb2d5aced4aa92daebdf28bad6e8e3a9d..10af0b0894d1761cec0d42b6f63c5a10d6eb2f57 100644 (file)
@@ -3,6 +3,7 @@
 
 import * as Episode from './Episode';
 import Round from './Round';
+import * as Tournament from './Tournament';
 import User from './User';
 
 export const hasGlobalRole = (user, role) =>
@@ -187,6 +188,19 @@ export const mayUpdateTournament = (user, tournament) =>
 export const mayViewProtocol = (user, tournament) =>
        isTournamentCrew(user, tournament);
 
+export const maySeeRound = (user, tournament, round) => {
+       if (!Tournament.hasAssignedGroups(tournament)) {
+               return true;
+       }
+       if (isTournamentCrew(user, tournament)) {
+               return true;
+       }
+       if (hasFinished(user, round)) {
+               return true;
+       }
+       return false;
+};
+
 export const maySeeResults = (user, tournament, round) => {
        if (tournament.result_reveal === 'always') {
                return true;