};
};
+export const patchUser = (tournament, user) => {
+ if (!tournament || !tournament.participants || !user) return tournament;
+ if (!tournament.participants.find(p => p.user_id == user.id)) return tournament;
+ return {
+ ...tournament,
+ participants: tournament.participants.map(p => Participant.patchUser(p, user)),
+ };
+};
+
export const sortParticipants = tournament => {
if (!tournament || !tournament.participants || !tournament.participants.length) {
return tournament;
compareScore,
findParticipant,
patchResult,
+ patchRound,
+ patchUser,
sortParticipants,
};