Skip to content

1. Веснина Мария Александровна. 613 - #26

Open
mvesnina91-debug wants to merge 6 commits into
python-department:mainfrom
mvesnina91-debug:main
Open

mvesnina91-debug wants to merge 6 commits into
python-department:mainfrom
mvesnina91-debug:main

Conversation

@mvesnina91-debug

Copy link
Copy Markdown

No description provided.

@mvesnina91-debug mvesnina91-debug changed the title Solve task 1 1. Веснина Мария Александровна. 613 Sep 24, 2026
@github-actions github-actions Bot added the 613 label Sep 24, 2026
Comment thread src/part1/snowflake.py
print("Timestaps overflows")
return None
return (
(time_ms << (NODE_ID_BITS + SEQUENCE_ID_BITS))

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.

Вычисление сдвига дублировано в функции decode_timestamp_ms. Это может быть опасно, так как если логика поменяется, то надо будет исправлять в 2х местах, а это можно забыть, поэтому лучше было вынести вычисление в отдельную константу.
Пункт S1, минус балл.

Comment thread src/part3/crud.py

new_id = generate_product_id(storage)
normal_price = normalize_price(fields[1])
quantity = fields[2]

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.

Магические константы. Для индексов есть константы.
Пункт S3

Comment thread src/part3/utils.py
PRICE_PRECISION: Final[int] = 0
PRICE_STEP: Final = Decimal(0)
PRICE_PRECISION: Final[int] = 2
PRICE_STEP: Final = Decimal(1).scaleb(PRICE_PRECISION)

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.

Decimal(1).scaleb(-PRICE_PRECISION)

Comment thread src/part3/utils.py
# measured per call from the data (see the function).
# TODO: задайте заголовки столбцов таблицы
TABLE_HEADERS: Final[tuple[str, ...]] = ()
TABLE_HEADERS: Final[tuple[str, ...]] = ("ID", "name", "price", "quanyity")

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.

Должно быть quantity. У меня даже тесты упали, но снижать не буду. Будьте внимательнее.

Comment thread src/part3/crud.py
normal_price = normalize_price(fields[1])
quantity = fields[2]

update_product = (product_id, normal_name, normal_price, quantity)

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.

А обновление storage где?

Comment thread src/part3/crud.py
return None

if target_index == -1:
print(f"no product with id {product_id}")

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.

Тут, наверное планировался return None

Comment thread src/part3/run_admin.py
args = words[1:]
len_args = len(args)

if cmd == "help" and len_args == 0:

@Avshugan Avshugan Oct 22, 2026 •

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.

match case был бы проще и нагляднее
В результате постоянная проверка len_args, копипастой
Пункт S1

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants