Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

quick fix #9

Merged
merged 2 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ services:
bot:
build: .
environment:
- SQLITE_DB_FILE_PATH=${SQLITE_DB_FILE_PATH}
- SQLITE_DB_FILE_PATH=/database/db.sqlite
- TELEGRAM_BOT_TOKEN=${TELEGRAM_BOT_TOKEN}
- DEVELOPER_CHAT_ID=${DEVELOPER_CHAT_ID}
volumes:
- sqlite_data:/database
entrypoint: ["/bin/sh", "-c"]
command:
- |
python -m sqlite3 ${SQLITE_DB_FILE_PATH} < src/sql/init.sql
python src/__main__.py
python -m sqlite3 ${SQLITE_DB_FILE_PATH} < src/sql/init.sql;
python src/__main__.py;
restart: always

sqlitebrowser:
Expand Down
11 changes: 0 additions & 11 deletions src/services/db_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,6 @@ async def save_playroom(playroom: Playroom) -> None:
logging.info(f"Playroom {playroom.name} already exists in the database")


async def save_playroom(playroom: Playroom) -> None:
"""Add a game room to the bot_data"""
try:
await execute(
"INSERT INTO playrooms (id, name) VALUES (?, ?)",
(playroom.telegram_chat_id, playroom.name),
)
except sqlite3.IntegrityError:
logging.info(f"Playroom {playroom.name} already exists in the database")


async def save_player(player: Player) -> None:
"""Add a player to the bot_data"""
try:
Comment on lines 44 to 49
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 NOTE
This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [1-10]

There are duplicate imports for logging, sqlite3, and data model classes. Removing these duplicates will improve the code's cleanliness and maintainability.

-import logging
-import sqlite3
-
-from src.data_models.Playroom import Playroom
-import logging
-import sqlite3
-
-from src.data_models.Game import Game
-from src.data_models.Player import Player

Expand Down