From c215eaf780e6d4f91b5323e16ed0f9f8e7259871 Mon Sep 17 00:00:00 2001 From: vtm9 Date: Wed, 5 Jun 2024 14:50:53 +0200 Subject: [PATCH] Add get_task by id --- .../channels/tournament_admin_channel.ex | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/services/app/apps/codebattle/lib/codebattle_web/channels/tournament_admin_channel.ex b/services/app/apps/codebattle/lib/codebattle_web/channels/tournament_admin_channel.ex index afc42a2b4..8cb333d13 100644 --- a/services/app/apps/codebattle/lib/codebattle_web/channels/tournament_admin_channel.ex +++ b/services/app/apps/codebattle/lib/codebattle_web/channels/tournament_admin_channel.ex @@ -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 @@ -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(