Skip to content

2. Шкрыль Роман Иванович. 614 - #84

Open
luvkis wants to merge 15 commits into
python-department:mainfrom
luvkis:second_assignment
Open

luvkis wants to merge 15 commits into
python-department:mainfrom
luvkis:second_assignment

Conversation

@luvkis

@luvkis luvkis commented Oct 2, 2026

Copy link
Copy Markdown

No description provided.

@github-actions github-actions Bot added the 614 label Oct 2, 2026
Comment thread src/part2/cart.py
if product is None:
return None

for i in range(len(storage)):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Нарушение критерия T5. Минус 0.25 балла

Comment thread src/part2/cart.py
return None

for i in range(len(storage)):
product = storage[i]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

В этом цикле очень много лишних в цикле. Часть операций можно вынести за пределы цикла, тогда код будет читаться легче.

Comment thread src/part2/cart.py

name, price = product[NAME_INDEX], product[PRICE_INDEX]
new_product = (product_id, name, price, quantity_storage - quantity)
storage[i] = new_product

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Это, фактически, дублирование логики функции апдейта хранилища из crud.py. Нарушение критерия S1. Минус балл

Вместо копипасты следовало вызвать уже реализованную в crud.py функцию для обновления состояния хранилища.

Comment thread src/part2/crud.py

def generate_product_id(storage: list[Product]) -> int:
"""Choose the identifier for the next product added to ``storage``.
if len(storage) == 0:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Нарушение критерия T4. Минус 0.25 балла

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants