Skip to content

Development#1

Open
MatrikSer wants to merge 29 commits into
mainfrom
development
Open

Development#1
MatrikSer wants to merge 29 commits into
mainfrom
development

Conversation

@MatrikSer
Copy link
Copy Markdown
Owner

@MatrikSer MatrikSer commented Sep 1, 2025

No description provided.

@@ -0,0 +1,29 @@
CREATE TABLE IF NOT EXISTS visit_stats (
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

зачем так? почему не через orm?

Comment thread src/create_db.py Outdated
таблицы visit_stats, visit_uniques, visit_all, триггеры update_unique_after_insert
и update_total_after_insert.
"""
schema_path = os.path.join(os.path.dirname(__file__), '..', 'data', 'schema_for_create_db.sql')
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

через pathlib вся работа с файлами

Comment thread src/create_site.py Outdated
"""
Создает html-страницу со статистикой посещений, основываясь на переданных данных.
"""
html = """
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

а вот это наоборот надо унести в html файл и использовать шаблоны

Comment thread src/create_site.py Outdated
"""
Возвращает строку с информацией о периоде, основываясь на данных из БД.
"""
if row[0] == 'all':
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

  1. Мне не нравятся индексы, лучше использовать модель. Например,pydantic прекрасно с БД справляется
  2. Мб тут лучше match case?

Comment thread tests/test_insert_visit_data.py Outdated
Comment on lines +19 to +24
def test_insert_visit_data_db_error() -> None:
pass


def test_insert_visit_data_unknown_error() -> None:
pass
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

?

Comment thread tests/test_insert_visit_data.py Outdated
def test_insert_visit_data_success() -> None:
test_db_path = os.path.join(os.path.dirname(__file__), '..', 'data', 'test_visits.db')

with patch('insert_visit_data.os.path.join') as mock_join:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

давай как на паре через фикстуры

Comment thread tests/test_main.py Outdated
request.cookies = {}
request.remote = None

with patch('handlers.insert_visit_data.insert_visit_data') as mock_insert:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

тоже

Comment thread tests/test_main.py Outdated
request.cookies = {'user_hash': existing_hash}
request.remote = '192.168.1.100'

with patch('handlers.insert_visit_data.insert_visit_data') as mock_insert:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

везде, дальше писать не буду

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants