Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
vtm9 committed Dec 3, 2023
1 parent 273b683 commit 6a49caf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const Players = ({
{playersCount === 0 ? (
<p className="test-nowrap">NO_PARTICIPANTS_YET</p>
) : (
Object.values(players).map(player => (
Object.values(players).slice(0, 30).map(player => (
<div key={player.id} className="my-3 d-flex">
<div className="ml-1">
<UserInfo user={player} hideOnlineIndicator />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,15 +275,17 @@ defmodule CodebattleWeb.TournamentChannel do
when type in ["swiss", "ladder", "stairway"] do
current_user = socket.assigns.current_user

{matches, players} =
players =
Enum.uniq(
[Helpers.get_player(tournament, current_user.id)] ++
Helpers.get_top_players(tournament, 0, 30)
)

matches =
if Helpers.can_moderate?(tournament, current_user) do
{Helpers.get_matches(tournament),
[Helpers.get_player(tournament, current_user.id)] ++
Helpers.get_paginated_players(tournament, 0, 30)}
Helpers.get_matches(tournament, Enum.map(players, & &1.id))
else
{Helpers.get_matches_by_players(tournament, [current_user.id]),
[Helpers.get_player(tournament, current_user.id)] ++
Helpers.get_top_players(tournament)}
Helpers.get_matches_by_players(tournament, [current_user.id])
end

%{
Expand Down

0 comments on commit 6a49caf

Please sign in to comment.