From: Daniel Karbach Date: Tue, 15 Mar 2022 18:30:18 +0000 (+0100) Subject: only show DNFs for finished players X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=8078d2d7e3363679874caaa571a1c138438c95e2;p=alttp.git only show DNFs for finished players --- diff --git a/resources/js/components/results/Item.js b/resources/js/components/results/Item.js index 0d0d34e..2a1fc8c 100644 --- a/resources/js/components/results/Item.js +++ b/resources/js/components/results/Item.js @@ -9,11 +9,11 @@ import { findResult } from '../../helpers/Participant'; import { maySeeResults } from '../../helpers/permissions'; import { withUser } from '../../helpers/UserContext'; -const getIcon = (result, index) => { +const getIcon = (result, index, maySee) => { if (!result || !result.has_finished) { return ; } - if (result.forfeit) { + if (result.forfeit && maySee) { return ; } if (index === 0) { @@ -28,8 +28,8 @@ const getIcon = (result, index) => { return ; }; -const getTime = (user, tournament, round, result) => { - if (!result || !maySeeResults(user, tournament, round)) { +const getTime = (result, maySee) => { + if (!result || !maySee) { return null; } if (result.time) { @@ -49,13 +49,14 @@ const Item = ({ user, }) => { const result = findResult(participant, round); + const maySee = maySeeResults(user, tournament, round); return
- {getTime(user, tournament, round, result)} + {getTime(result, maySee)} - {getIcon(result, index)} + {getIcon(result, index, maySee)}
; };