X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=resources%2Fjs%2Fcomponents%2Fresults%2FItem.js;h=84395222407e1d50854e283a282a31002b73a328;hb=82b95e7542824bcdf4f1b245559cb1c93f4eafdd;hp=0d0d34e81a11553f7535be8a883d1fabb7df378d;hpb=878ceac3fc16d0c611c5002ae5d0605f1a07a8b4;p=alttp.git
diff --git a/resources/js/components/results/Item.js b/resources/js/components/results/Item.js
index 0d0d34e..8439522 100644
--- a/resources/js/components/results/Item.js
+++ b/resources/js/components/results/Item.js
@@ -9,27 +9,27 @@ import { findResult } from '../../helpers/Participant';
import { maySeeResults } from '../../helpers/permissions';
import { withUser } from '../../helpers/UserContext';
-const getIcon = (result, index) => {
+const getIcon = (result, maySee) => {
if (!result || !result.has_finished) {
return ;
}
- if (result.forfeit) {
+ if (result.forfeit && maySee) {
return ;
}
- if (index === 0) {
+ if (result.placement === 1) {
return ;
}
- if (index === 1) {
+ if (result.placement === 2) {
return ;
}
- if (index === 2) {
+ if (result.placement === 3) {
return ;
}
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) {
@@ -42,26 +42,25 @@ const getTime = (user, tournament, round, result) => {
};
const Item = ({
- index,
participant,
round,
tournament,
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, maySee)}
;
};
Item.propTypes = {
- index: PropTypes.number,
participant: PropTypes.shape({
user: PropTypes.shape({
}),