isRunner,
mayAddRounds,
mayExportTournament,
+ maySeeRound,
mayUpdateTournament,
mayViewProtocol,
} from '../../helpers/permissions';
})
}, []);
+ 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}>
: 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>;
import * as Episode from './Episode';
import Round from './Round';
+import * as Tournament from './Tournament';
import User from './User';
export const hasGlobalRole = (user, role) =>
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;