Repository navigation
Conversation
added 2 commits
October 2, 2026 15:39
Avshugan
reviewed
Oct 22, 2026
| """ | ||
| # TODO: реализуйте функцию | ||
| return (0, 0) | ||
| def add_to_cart( |
Collaborator
There was a problem hiding this comment.
Лучше не экономить строки и оставлять пробелы (пустые строки) между логическими блоками. Так читабельность кода улучшается.
| product_new[0], | ||
| product_new[1], | ||
| product_new[2], | ||
| product_new[3] - quantity, |
Collaborator
There was a problem hiding this comment.
Магические константы (для которых даже константы есть)
Пункт S3
| f"not enough stock for product {product_id}: {product_new[QUANTITY_INDEX]} available, {quantity} requested" | ||
| ) | ||
| return None | ||
| index = next( |
Collaborator
There was a problem hiding this comment.
Надо было использовать функции из crud.py, а то в результате получилась копипаста.
Пункт S1
| if change is None: | ||
| cart.append((product_id, quantity)) | ||
| return (product_id, quantity) | ||
| else: |
| ) | ||
| return None | ||
| product_new = read_product(storage, product_id) | ||
| if product_new == None: |
| # TODO: реализуйте функцию | ||
| return 0 | ||
| for cor in storage: | ||
| if cor[NAME_INDEX] == fields[0]: |
Collaborator
There was a problem hiding this comment.
Не уловил, в чем смысл названия переменной cor
Пункт M2
| """ | ||
| # TODO: реализуйте функцию | ||
| return 0 | ||
| if len(storage) == 0: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.