Skip to content

Commit

Permalink
Small readability fixes (#905)
Browse files Browse the repository at this point in the history
  • Loading branch information
evroon authored Sep 10, 2024
1 parent 388afa5 commit 66c9251
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
7 changes: 3 additions & 4 deletions backend/bracket/routes/teams.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,7 @@ async def update_team_logo(
_: UserPublic = Depends(user_authenticated_for_tournament),
team: Team = Depends(team_dependency),
) -> SingleTeamResponse:
team_id = team.id
old_logo_path = await get_team_logo_path(tournament_id, team_id)
old_logo_path = await get_team_logo_path(tournament_id, team.id)
filename: str | None = None
new_logo_path: str | None = None

Expand All @@ -144,10 +143,10 @@ async def update_team_logo(
logger.error(f"Could not remove logo that should still exist: {old_logo_path}\n{exc}")

await database.execute(
teams.update().where(teams.c.id == team_id),
teams.update().where(teams.c.id == team.id),
values={"logo_path": filename},
)
return SingleTeamResponse(data=assert_some(await get_team_by_id(team_id, tournament_id)))
return SingleTeamResponse(data=assert_some(await get_team_by_id(team.id, tournament_id)))


@router.delete("/tournaments/{tournament_id}/teams/{team_id}", response_model=SuccessResponse)
Expand Down
9 changes: 3 additions & 6 deletions backend/bracket/sql/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,9 @@ async def get_user(email: str) -> UserInDB | None:

async def delete_user_and_owned_clubs(user_id: UserId) -> None:
for club in await get_clubs_for_user_id(user_id):
club_id = club.id
for tournament in await sql_get_tournaments((club.id,), None):
await sql_delete_tournament_completely(tournament.id)

for tournament in await sql_get_tournaments((club_id,), None):
tournament_id = tournament.id
await sql_delete_tournament_completely(tournament_id)

await sql_delete_club(club_id)
await sql_delete_club(club.id)

await delete_user(user_id)
2 changes: 1 addition & 1 deletion backend/tests/unit_tests/swiss_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def test_constraints() -> None:
created=MOCK_NOW,
),
RoundWithMatches(
id=RoundId(-1),
id=RoundId(-2),
matches=[],
is_draft=True,
stage_item_id=StageItemId(-1),
Expand Down

0 comments on commit 66c9251

Please sign in to comment.