Skip to content

Commit

Permalink
Merge pull request #107 from bomzheg/feature/#71
Browse files Browse the repository at this point in the history
#71 edit scn by hints
  • Loading branch information
bomzheg authored Oct 6, 2024
2 parents 28ead94 + 831282e commit 4a9926d
Show file tree
Hide file tree
Showing 47 changed files with 953 additions and 366 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,29 @@ jobs:
run: uv venv && uv pip install .[test]
- name: Test with pytest
run: source .venv/bin/activate && pytest
docs:
needs: [build]
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v4
- name: Install uv
run: pipx install uv
- name: Install graphviz
run: sudo apt install -y graphviz
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: "pip"
cache-dependency-path: pyproject.toml
- name: Install dependencies
run: uv venv && uv pip install .[test]
- name: Render Aiogram-dialogs transitions
run: source .venv/bin/activate && python -m shvatka.tgbot.dialogs.__init__
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: transitions
path: out/shvatka-dialogs.png

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ dmypy.json
/config/
/files/
/local-storage/
/out/

#pyro stuff
*.session
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ test = [
"mypy>=1.1.1,<2.0",
"aiogram-tests @ git+https://github.com/bomzheg/aiogram_tests.git@fix/aiogram3rc",
"asgi-lifespan>=2.1.0,<3.0",
"aiogram_dialog[tools]>=2.1,<2.2",
]

[project.scripts]
Expand Down
7 changes: 5 additions & 2 deletions shvatka/api/models/responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
from datetime import datetime
from typing import Sequence, Generic

from adaptix import Retort, dumper

from shvatka.core.games.dto import CurrentHints
from shvatka.core.models import dto, enums
from shvatka.core.models.dto import scn
from shvatka.core.models.enums import GameStatus

T = typing.TypeVar("T")
retort = Retort(recipe=[dumper(scn.HintsList, lambda x: x.hints)])


@dataclass
Expand Down Expand Up @@ -76,7 +79,7 @@ class Level:
db_id: int
name_id: str
author: Player
scenario: scn.LevelScenario
scenario: dict[str, typing.Any]
game_id: int | None = None
number_in_game: int | None = None

Expand All @@ -88,7 +91,7 @@ def from_core(cls, core: dto.Level | None = None):
db_id=core.db_id,
name_id=core.name_id,
author=Player.from_core(core.author),
scenario=core.scenario,
scenario=retort.dump(core.scenario),
game_id=core.game_id,
number_in_game=core.number_in_game,
)
Expand Down
Loading

0 comments on commit 4a9926d

Please sign in to comment.