1 import Round from './Round';
3 export const findParticipant = (tournament, user) => {
4 if (!tournament || !tournament.participants || !tournament.participants.length) return null;
5 if (!user || !user.id) return null;
6 return tournament.participants.find(p => p.user_id == user.id);
9 export const patchResult = (tournament, result) => {
10 if (!tournament || !tournament.rounds) return tournament;
13 rounds: tournament.rounds.map(round =>
14 round.id === result.round_id
15 ? Round.patchResult(round, result)