Skip to content

Commit

Permalink
Add get_task by id
Browse files Browse the repository at this point in the history
  • Loading branch information
vtm9 committed Jun 5, 2024
1 parent f1fd407 commit c215eaf
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ defmodule CodebattleWeb.TournamentAdminChannel do
{:noreply, socket}
end

def handle_in("tournament:get_task", %{"task_id" => task_id}, socket) do
task_id |> Codebattle.Task.get() |> Map.take([:id, :level, :name, :description_ru, :description_en, :examples])
end

def handle_in("tournament:get_results", %{"params" => params}, socket) do
tournament = socket.assigns.tournament_info

Expand All @@ -89,10 +93,8 @@ defmodule CodebattleWeb.TournamentAdminChannel do
TournamentResult.get_tasks_ranking(tournament)

%{"type" => "task_duration_distribution", "task_id" => task_id} ->
TournamentResult.get_task_duration_distribution(
tournament,
task_id
)

|> TournamentResult.get_task_duration_distribution(task_id)

%{"type" => "clans_bubble_distribution"} ->
TournamentResult.get_clans_bubble_distribution(
Expand Down

0 comments on commit c215eaf

Please sign in to comment.