mirror of
https://gitlab.com/megazordpobeda/DataRush.git
synced 2026-05-23 00:27:11 +00:00
Merge branch 'master' of gitlab.prodcontest.ru:team-15/project
This commit is contained in:
@@ -10,15 +10,15 @@ from apps.team.models import Team
|
|||||||
router = Router()
|
router = Router()
|
||||||
|
|
||||||
|
|
||||||
@router.post(
|
# @router.post(
|
||||||
"",
|
# "",
|
||||||
response={
|
# response={
|
||||||
201: TeamSchemaOut,
|
# 201: TeamSchemaOut,
|
||||||
400: BadRequestError,
|
# 400: BadRequestError,
|
||||||
401: UnauthorizedError,
|
# 401: UnauthorizedError,
|
||||||
},
|
# },
|
||||||
description="Create team. Note: members array must have team members uuid, default can be empty",
|
# description="Create team. Note: members array must have team members uuid, default can be empty",
|
||||||
)
|
# )
|
||||||
def create_team(request, team_data: CreateTeamSchema) -> (int, TeamSchemaOut):
|
def create_team(request, team_data: CreateTeamSchema) -> (int, TeamSchemaOut):
|
||||||
team = Team(name=team_data.name, owner=request.auth)
|
team = Team(name=team_data.name, owner=request.auth)
|
||||||
team.members.add(request.auth)
|
team.members.add(request.auth)
|
||||||
@@ -26,13 +26,13 @@ def create_team(request, team_data: CreateTeamSchema) -> (int, TeamSchemaOut):
|
|||||||
return 201, team
|
return 201, team
|
||||||
|
|
||||||
|
|
||||||
@router.get(
|
# @router.get(
|
||||||
"{team_id}",
|
# "{team_id}",
|
||||||
response={
|
# response={
|
||||||
200: TeamSchemaOut,
|
# 200: TeamSchemaOut,
|
||||||
401: UnauthorizedError,
|
# 401: UnauthorizedError,
|
||||||
404: NotFoundError,
|
# 404: NotFoundError,
|
||||||
},
|
# },
|
||||||
)
|
# )
|
||||||
def get_team(request, team_id: UUID) -> (int, TeamSchemaOut):
|
def get_team(request, team_id: UUID) -> (int, TeamSchemaOut):
|
||||||
return get_object_or_404(Team, pk=team_id)
|
return get_object_or_404(Team, pk=team_id)
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
from django.contrib import admin
|
|
||||||
|
|
||||||
from apps.team.models import Team
|
|
||||||
|
|
||||||
|
|
||||||
@admin.register(Team)
|
|
||||||
class TeamAdmin(admin.ModelAdmin):
|
|
||||||
list_display = ("name", "owner")
|
|
||||||
search_fields = (
|
|
||||||
"name",
|
|
||||||
"owner",
|
|
||||||
"members",
|
|
||||||
)
|
|
||||||
@@ -38,7 +38,10 @@ const CompetitionPage = () => {
|
|||||||
const tasks = await getCompetitionTasks(competitionId);
|
const tasks = await getCompetitionTasks(competitionId);
|
||||||
|
|
||||||
if (tasks && tasks.length > 0) {
|
if (tasks && tasks.length > 0) {
|
||||||
navigate(`/competition/${competitionId}/tasks/${tasks[0].id}`);
|
const sortedTasks = [...tasks].sort((a, b) => {
|
||||||
|
return a.in_competition_position - b.in_competition_position;
|
||||||
|
});
|
||||||
|
navigate(`/competition/${competitionId}/tasks/${sortedTasks[0].id}`);
|
||||||
} else {
|
} else {
|
||||||
navigate(`/competition/${competitionId}/tasks`);
|
navigate(`/competition/${competitionId}/tasks`);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user