From 0f856060bb0d6c751517da19303da8ac86b59e1b Mon Sep 17 00:00:00 2001 From: Timur Date: Tue, 4 Mar 2025 02:21:03 +0300 Subject: [PATCH 1/2] add position field to competition results --- services/backend/api/v1/task/schemas.py | 1 + services/backend/api/v1/task/views.py | 1 + 2 files changed, 2 insertions(+) diff --git a/services/backend/api/v1/task/schemas.py b/services/backend/api/v1/task/schemas.py index 95f2fb4..ec8d80a 100644 --- a/services/backend/api/v1/task/schemas.py +++ b/services/backend/api/v1/task/schemas.py @@ -68,3 +68,4 @@ class TaskStatusSchema(Schema): task_name: str result: int max_points: int + position: int diff --git a/services/backend/api/v1/task/views.py b/services/backend/api/v1/task/views.py index a0ce64c..6cf535d 100644 --- a/services/backend/api/v1/task/views.py +++ b/services/backend/api/v1/task/views.py @@ -210,6 +210,7 @@ def get_competition_results(request, competition_id: UUID): task_name=task.title, result=result, max_points=task.points, + position=task.in_competition_positions )) return status.OK, data From 82349859b546b32db30f2c3f7b025b2f7b527ef7 Mon Sep 17 00:00:00 2001 From: rngsurrounded Date: Tue, 4 Mar 2025 08:22:06 +0900 Subject: [PATCH 2/2] minor fixes --- .../CompetitionResultModal/index.tsx | 26 +++++++------- .../components/CodeSolution/index.tsx | 34 +++++++++---------- .../modules/TaskSolution/index.tsx | 4 +-- 3 files changed, 33 insertions(+), 31 deletions(-) diff --git a/services/frontend/src/pages/Competition/components/CompetitionResultModal/index.tsx b/services/frontend/src/pages/Competition/components/CompetitionResultModal/index.tsx index b691e77..080d9d6 100644 --- a/services/frontend/src/pages/Competition/components/CompetitionResultModal/index.tsx +++ b/services/frontend/src/pages/Competition/components/CompetitionResultModal/index.tsx @@ -1,4 +1,3 @@ -// src/components/competition/CompetitionResultsModal.tsx import React from 'react'; import { Dialog, @@ -12,7 +11,8 @@ import { Loader2 } from 'lucide-react'; export interface CompetitionResult { task_name: string; result: number; - max_points: number + max_points: number; + position: number; } interface CompetitionResultsModalProps { @@ -111,17 +111,19 @@ export const CompetitionResultsModal: React.FC = ( Произошла ошибка при загрузке результатов ) : results && results.length > 0 ? ( - results.map((result, index) => ( -
-
{result.task_name}
-
- {renderResultValue(result.result, result.max_points)} + [...results] + .sort((a, b) => a.position - b.position) + .map((result, index) => ( +
+
{result.task_name}
+
+ {renderResultValue(result.result, result.max_points)} +
-
- )) + )) ) : (
Нет доступных результатов diff --git a/services/frontend/src/pages/CompetitionSession/modules/TaskSolution/components/CodeSolution/index.tsx b/services/frontend/src/pages/CompetitionSession/modules/TaskSolution/components/CodeSolution/index.tsx index 0b386d2..906d2ac 100644 --- a/services/frontend/src/pages/CompetitionSession/modules/TaskSolution/components/CodeSolution/index.tsx +++ b/services/frontend/src/pages/CompetitionSession/modules/TaskSolution/components/CodeSolution/index.tsx @@ -116,29 +116,29 @@ const CodeSolution: React.FC = ({
-

Ограничения

+

Ограничение ресурсов

  • -
    -
    +
    +
    Максимум 1 посылка в 10 секунд
  • -
    -
    +
    +
    Максимальный размер решения 4MB
  • -
    -
    +
    +
    Максимальное время работы программы 1 минута
  • -
    -
    +
    +
    Выделяется 512MB на решение
  • @@ -146,35 +146,35 @@ const CodeSolution: React.FC = ({
-

Доступные библиотеки

+

Доступные библиотеки

- pandas + pandas 2.2.3
- numpy + numpy 2.2.3
- matplotlib + matplotlib 3.10.1
- scipy + scipy 1.15.2
- scikit-learn + scikit-learn 1.6.1
- seaborn + seaborn 0.13.2
- statsmodels + statsmodels 0.14.4
diff --git a/services/frontend/src/pages/CompetitionSession/modules/TaskSolution/index.tsx b/services/frontend/src/pages/CompetitionSession/modules/TaskSolution/index.tsx index 946939f..919da36 100644 --- a/services/frontend/src/pages/CompetitionSession/modules/TaskSolution/index.tsx +++ b/services/frontend/src/pages/CompetitionSession/modules/TaskSolution/index.tsx @@ -155,10 +155,10 @@ const TaskSolution: React.FC = ({ ? 'bg-blue-50 text-blue-700' : 'bg-red-50 text-red-700'}`} > - {hasSubmissionsLeft ? ( + {maxAttempts === -1 || hasSubmissionsLeft ? ( <> - Осталось посылок: {submissionsLeft === Infinity ? '∞' : submissionsLeft} + Осталось посылок: {maxAttempts === -1 ? '∞' : submissionsLeft} {maxAttempts !== -1 && (