Skip to content

Conversation

@Galyopa
Copy link
Owner

@Galyopa Galyopa commented May 25, 2020

No description provided.

USERS_DIR = os.path.join(FIXTURES_DIR, "users.csv")
GOODS_DIR = os.path.join(FIXTURES_DIR, "goods.csv")
STORES_DIR = os.path.join(FIXTURES_DIR, "stores.csv")
USERS_FILENAME = os.path.join(FIXTURES_DIR, "users.csv")
Copy link
Collaborator

Choose a reason for hiding this comment

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

it is actually PATH, not FILENAME


def get_goods():
with open(GOODS_DIR, "r") as f:
with open(GOODS_FILENAME, "r") as f:
Copy link
Collaborator

Choose a reason for hiding this comment

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

it would be great if you handled all the possible exceptions


class PopulateOrders(Command):
def run(self):
from grocery_store import app, db
Copy link
Collaborator

Choose a reason for hiding this comment

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

do not make local imports

"order_price": sum([good.good.price for good in order.order_lines]),
"order_goods": {good.good.name: good.good.price for good in order.order_lines}
}
orders_list.append(order_data)
Copy link
Collaborator

Choose a reason for hiding this comment

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

you can use here list comprehensions
and would be great if you use NamedTuple instead of dict (It is a great opportunity to get familiar with)

Sign Up
</a>
{% endif %}
{% if current_user.is_authenticated %}
Copy link
Collaborator

Choose a reason for hiding this comment

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

too many checks if the user is authenticated
Try to check it one time

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.

4 participants