Skip to content

Commit 3dccbcd

Browse files
committed
Fix the problems
1 parent 6b3be56 commit 3dccbcd

9 files changed

Lines changed: 82 additions & 70 deletions

File tree

services/app/apps/codebattle/assets/css/external.scss

Lines changed: 36 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -325,35 +325,6 @@ $dark-red: #b00020;
325325
padding-bottom: 16px;
326326
}
327327

328-
.cb-ticker-line-wrap {
329-
white-space: pre;
330-
overflow: hidden;
331-
332-
background: url('../static/images/eventStripesPink.svg');
333-
background-size: 200px 43px;
334-
background-position: bottom 0px right 25%;
335-
background-repeat: no-repeat;
336-
background-color: #8C64FF;
337-
}
338-
339-
.cb-ticker-line {
340-
display: inline-block;
341-
font-size: 18px;
342-
color: white;
343-
white-space: pre;
344-
white-space-collapse: collapse;
345-
}
346-
347-
.cb-ticker-line-head {
348-
animation: ticker_1 70s linear infinite;
349-
padding-left: 15px;
350-
animation-delay: -70s;
351-
}
352-
353-
.cb-ticker-line-tail {
354-
animation: ticker_2 70s linear infinite;
355-
animation-delay: -35s;
356-
}
357328

358329
.cb-custom-event-text-success {
359330
color: #2ae881;
@@ -806,3 +777,39 @@ $dark-red: #b00020;
806777
bottom: -15%;
807778
right: -5%;
808779
}
780+
781+
@keyframes ticker {
782+
0% {
783+
transform: translateX(0);
784+
}
785+
786+
100% {
787+
transform: translateX(-50%);
788+
}
789+
}
790+
791+
.cb-ticker-line-wrap {
792+
overflow: hidden;
793+
width: 100%;
794+
background: url('../static/images/eventStripesPink.svg');
795+
background-size: 200px 43px;
796+
background-position: bottom 0px right 25%;
797+
background-repeat: no-repeat;
798+
background-color: #8C64FF;
799+
padding: 10px 0;
800+
}
801+
802+
.cb-ticker-content {
803+
display: inline-block;
804+
white-space: nowrap;
805+
animation: ticker 60s linear infinite;
806+
will-change: transform;
807+
width: 200%;
808+
}
809+
810+
.cb-ticker-line {
811+
display: inline-block;
812+
font-size: 18px;
813+
color: white;
814+
padding-right: 25px;
815+
}

services/app/apps/codebattle/assets/css/style.scss

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1446,26 +1446,6 @@ a {
14461446
transform 200ms;
14471447
}
14481448

1449-
@keyframes ticker_1 {
1450-
0% {
1451-
transform: translateX(100%);
1452-
}
1453-
1454-
100% {
1455-
transform: translateX(-100%);
1456-
}
1457-
}
1458-
1459-
@keyframes ticker_2 {
1460-
0% {
1461-
transform: translateX(0);
1462-
}
1463-
1464-
100% {
1465-
transform: translateX(-200%);
1466-
}
1467-
}
1468-
14691449
@keyframes scale {
14701450
0% {
14711451
transform: scale(0.5);

services/app/apps/codebattle/assets/js/widgets/components/AccordeonBox.jsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ import Tooltip from 'react-bootstrap/Tooltip';
99
import i18n from '../../i18n';
1010
import color from '../config/statusColor';
1111

12+
// Custom JSON stringify function that preserves original key formats
13+
const safeJsonStringify = obj => {
14+
if (obj === undefined || obj === null) return '???';
15+
return JSON.stringify(obj, null, 0);
16+
};
17+
1218
const getMessage = status => {
1319
switch (status) {
1420
case 'error':
@@ -158,13 +164,13 @@ function SubMenu({
158164
</div>
159165
<pre className="my-1">
160166
<span className={assertClassName}>
161-
{`${i18n.t('Receive:')} ${result === undefined ? '???' : JSON.stringify(result)}`}
167+
{`${i18n.t('Receive:')} ${safeJsonStringify(result)}`}
162168
</span>
163169
<span className={assertClassName}>
164-
{`${i18n.t('Expected:')} ${assert.expected === undefined ? '???' : JSON.stringify(assert.expected)}`}
170+
{`${i18n.t('Expected:')} ${safeJsonStringify(assert.expected)}`}
165171
</span>
166172
<span className={assertClassName}>
167-
{`${i18n.t('Arguments:')} ${assert.arguments === undefined ? '???' : JSON.stringify(assert.arguments)}`}
173+
{`${i18n.t('Arguments:')} ${safeJsonStringify(assert.arguments)}`}
168174
</span>
169175
</pre>
170176
{hasOutput && (

services/app/apps/codebattle/lib/codebattle/code_check/output_parser_v2.ex

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,19 +152,21 @@ defmodule Codebattle.CodeCheck.OutputParser.V2 do
152152
end
153153

154154
check_result =
155-
token.solution_results
156-
|> Enum.filter(fn item -> item["type"] != "output" end)
157-
|> Enum.zip(token.task.asserts)
155+
token.task.asserts
156+
|> Enum.zip(
157+
Enum.filter(token.solution_results, fn item -> item["type"] != "output" end)
158+
)
158159
|> Enum.reduce(
159160
%Result.V2{output_error: output_error},
160-
fn {solution_result, assert_item}, acc ->
161+
fn {assert_item, solution_result}, acc ->
162+
161163
assert_result = %Result.V2.AssertResult{
162164
output: solution_result["output"],
163165
execution_time: solution_result["time"],
164166
result: solution_result["value"],
165167
status:
166168
if solution_result["type"] == "result" and
167-
AtomizedMap.atomize(solution_result["value"]) == assert_item.expected do
169+
AtomizedMap.atomize(solution_result["value"]) == AtomizedMap.atomize(assert_item.expected) do
168170
"success"
169171
else
170172
"failure"

services/app/apps/codebattle/lib/codebattle_web/controllers/ext_api/task_pack_controller.ex

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,17 @@ defmodule CodebattleWeb.ExtApi.TaskPackController do
1515

1616
task_names = Map.get(params, :task_names, [])
1717
tasks = Task.get_by_names(task_names)
18-
task_ids = Enum.map(task_names, fn name -> tasks |> Enum.find(fn task -> task.name == name end) |> Map.get(:id) end)
18+
19+
task_ids =
20+
task_names
21+
|> Enum.map(fn name ->
22+
task = Enum.find(tasks, fn task -> task.name == name end)
23+
24+
if task do
25+
task.id
26+
end
27+
end)
28+
|> Enum.filter(& &1)
1929

2030
params = Map.put(params, :task_ids, task_ids)
2131

services/app/apps/codebattle/lib/codebattle_web/live/admin/user_show_view.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,9 @@ defmodule CodebattleWeb.Live.Admin.UserShowView do
253253
</li>
254254
<li class="list-group-item">
255255
<strong>Clan:</strong>
256-
<%= if @user.clan do %>
256+
<%= if @user.clan_id do %>
257257
<div>
258-
<span class="badge bg-secondary"><%= @user.clan %></span>
258+
<span class="badge bg-secondary"><%= @user.clan_id %></span>
259259
<% clan = Clan.get(@user.clan_id) %>
260260
<%= if clan do %>
261261
<div class="mt-2 small">

services/app/apps/codebattle/lib/codebattle_web/templates/layout/external.html.heex

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!DOCTYPE html>
2-
<html lang="en">
2+
<html lang="en" class="bg-dark">
33
<head>
44
<meta charset="utf-8" />
55
<meta content="IE=edge" http-equiv="X-UA-Compatible" />
@@ -41,12 +41,6 @@
4141
<title><%= Application.get_env(:codebattle, :app_title) %></title>
4242
<meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport" />
4343

44-
<%= if @ticker_text do %>
45-
<div class="d-flex cb-ticker-line-wrap p-2 vw-100">
46-
<span class="cb-ticker-line cb-ticker-line-head"><%= @ticker_text %></span>
47-
<span class="cb-ticker-line cb-ticker-line-tail"><%= @ticker_text %></span>
48-
</div>
49-
<% end %>
5044
<link
5145
phx-track-static
5246
rel="stylesheet"
@@ -61,7 +55,7 @@
6155
</script>
6256
</head>
6357
<body>
64-
<div class="d-flex flex-column min-vh-100">
58+
<div class="d-flex flex-column min-vh-100 bg-dark">
6559
<%= if assigns[:show_header] do %>
6660
<div class="bg-dark">
6761
<div class="container-lg">
@@ -89,7 +83,7 @@
8983
src={collab_logo_minor(@current_user)}
9084
/>
9185
<% end %>
92-
<div class="d-none d-sm-none d-md-flex d-lg-flex flex-column text-gray ml-1 pb-1">
86+
<div class="d-none d-sm-none d-md-flex d-lg-flex flex-column text-gray ml-1 pb">
9387
<span class="font-weight-bold">
9488
<%= Application.get_env(:codebattle, :logo_title) %>
9589
</span>
@@ -167,9 +161,19 @@
167161
</div>
168162
</div>
169163
<% end %>
164+
<%= if @ticker_text do %>
165+
<div class="cb-ticker-line-wrap">
166+
<div class="cb-ticker-content">
167+
<%= for _ <- 1..20 do %>
168+
<span class="cb-ticker-line"><%= @ticker_text %></span>
169+
<% end %>
170+
</div>
171+
</div>
172+
<% end %>
170173

171174
<%= @inner_content %>
172175
</div>
176+
173177
<%= render_gon_script(@conn) %>
174178
</body>
175179
</html>

services/app/apps/codebattle/priv/gettext/ru/LC_MESSAGES/default.po

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,3 +1003,6 @@ msgstr "Время на этап"
10031003

10041004
msgid "You already passed this stage"
10051005
msgstr "Вы уже прошли этот этап"
1006+
1007+
msgid "Stage confirmation"
1008+
msgstr "Подтверждение этапа"

services/app/apps/codebattle/priv/repo/seeds.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ stages =
371371
access_type: "token",
372372
score_strategy: "win_loss",
373373
state: "waiting_participants",
374-
task_pack_name: "7_elementary",
374+
task_pack_name: "qualification",
375375
tournament_timeout_seconds: 75 * 60,
376376
players_limit: 128,
377377
ranking_type: "void",

0 commit comments

Comments
 (0)