Skip to content

Commit

Permalink
fixed?
Browse files Browse the repository at this point in the history
  • Loading branch information
bomzheg committed Jul 27, 2024
1 parent b24f221 commit d318c1f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 3 additions & 1 deletion shvatka/infrastructure/db/dao/rdb/game.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ async def get_full(self, id_: int) -> dto.FullGame:

async def add_levels(self, game: dto.Game) -> dto.FullGame:
levels_db: ScalarResult[models.Level] = await self.session.scalars(
select(models.Level).where(models.Level.game_id == game.id)
select(models.Level)
.where(models.Level.game_id == game.id)
.order_by(models.Level.number_in_game)
)
levels = [lvl.to_dto(game.author) for lvl in levels_db]
return game.to_full_game(levels=levels)
Expand Down
10 changes: 5 additions & 5 deletions tests/integration/test_game_stat.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ async def test_game_spy_with_first_and_last_hint(
assert started_game.start_at is not None
clock.clear()
clock.add_mock(tz=tz_utc, result=started_game.start_at + timedelta(seconds=10))
clock.add_mock(tz=tz_utc, result=started_game.start_at + timedelta(hours=10))
clock.add_mock(tz=tz_utc, result=started_game.start_at + timedelta(minutes=6, seconds=1))
game_stat = await get_game_spy(started_game, started_game.author, dao.game_stat)
assert len(clock.calls) == 2
assert len(game_stat) == 2
Expand Down Expand Up @@ -82,9 +82,9 @@ async def test_game_spy_with_second_level_first_and_last_hint(
await dao.commit()
clock.clear()
clock.add_mock(tz=tz_utc, result=datetime.now(tz_utc) + timedelta(seconds=10))
clock.add_mock(tz=tz_utc, result=datetime.now(tz_utc) + timedelta(minutes=1))
clock.add_mock(tz=tz_utc, result=datetime.now(tz_utc) + timedelta(seconds=10))
clock.add_mock(tz=tz_utc, result=datetime.now(tz_utc) + timedelta(seconds=10))
clock.add_mock(tz=tz_utc, result=datetime.now(tz_utc) + timedelta(hours=10))
clock.add_mock(tz=tz_utc, result=datetime.now(tz_utc) + timedelta(minutes=5))
game_stat = await get_game_spy(started_game, started_game.author, dao.game_stat)
assert len(clock.calls) == 4
assert len(game_stat) == 2
Expand All @@ -93,7 +93,7 @@ async def test_game_spy_with_second_level_first_and_last_hint(
assert game_stat[1].is_finished is False
assert game_stat[1].level_number == 1

assert game_stat[0].hint.number == 0
assert game_stat[0].hint.time == 0
assert game_stat[0].hint.number == 1
assert game_stat[0].hint.time == 1
assert game_stat[0].is_finished is False
assert game_stat[0].level_number == 1

0 comments on commit d318c1f

Please sign in to comment.