Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #404

Open
wants to merge 30 commits into
base: master
Choose a base branch
from
Open

Develop #404

wants to merge 30 commits into from

Conversation

ostboiko
Copy link

@ostboiko ostboiko commented Oct 8, 2023

No description provided.

app/car.py Outdated

Choose a reason for hiding this comment

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

The file is still not fixed. Try to recreate the file and rewrite the code.

Choose a reason for hiding this comment

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

File not fixed

app/customer.py Outdated

Choose a reason for hiding this comment

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

The file is still not fixed. Try to recreate the file and rewrite the code.

Choose a reason for hiding this comment

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

File not fixed

@ostboiko
Copy link
Author

ostboiko commented Oct 8, 2023

I rewrote the code, but it still didn't help, I don't understand how to do it

@ostboiko ostboiko requested a review from YukihiroSM October 8, 2023 17:06
Copy link

@ArsenPidhoretskyi ArsenPidhoretskyi left a comment

Choose a reason for hiding this comment

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

Problems are not fixed

README.md Outdated
Comment on lines 5 to 7


#You want to create an application that helps customers to choose the cheapest

Choose a reason for hiding this comment

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

Why do you change this?

README.md Outdated
Comment on lines 144 to 146


### Note: Check your code using this [checklist](checklist.md) before pushing your solution.

Choose a reason for hiding this comment

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

Restore this code

app/car.py Outdated

Choose a reason for hiding this comment

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

File not fixed

app/customer.py Outdated

Choose a reason for hiding this comment

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

File not fixed

Choose a reason for hiding this comment

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

This file was not fixed

Choose a reason for hiding this comment

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

Restore changes on it

app/customer.py Outdated

Choose a reason for hiding this comment

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

image File broken

app/shop.py Outdated
if product in self.products:
cost = self.products[product] * amount
spent_money += cost
if cost % 1 == 0:

Choose a reason for hiding this comment

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

You can use cost.is_integer()

Choose a reason for hiding this comment

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

Not fixed

car.py Outdated

Choose a reason for hiding this comment

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

Why you also need duplicate of file?

castomer.py Outdated

Choose a reason for hiding this comment

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

Why you also need duplicate of file?

cer.py Outdated

Choose a reason for hiding this comment

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

Remove this file

app/customer.py Outdated

Choose a reason for hiding this comment

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

Remove this file BTW

app/castomer.py Outdated

Choose a reason for hiding this comment

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

Rename this file into customer.py

app/shop.py Outdated
if product in self.products:
cost = self.products[product] * amount
spent_money += cost
if cost % 1 == 0:

Choose a reason for hiding this comment

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

Not fixed

car.py Outdated

Choose a reason for hiding this comment

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

Remove this file.

castomer.py Outdated

Choose a reason for hiding this comment

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

Remove this file.

cer.py Outdated

Choose a reason for hiding this comment

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

Remove this file.

app/castomer.py Outdated

Choose a reason for hiding this comment

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

just rename this file.

app/customer.py Outdated

Choose a reason for hiding this comment

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

remove this file.

@ostboiko ostboiko requested a review from YukihiroSM October 18, 2023 09:02
Copy link

@YukihiroSM YukihiroSM left a comment

Choose a reason for hiding this comment

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

Fix tests.

@ostboiko ostboiko requested a review from YukihiroSM November 5, 2023 17:54
Copy link

@YukihiroSM YukihiroSM left a comment

Choose a reason for hiding this comment

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

Remove not needed files from git, please.
https://sentry.io/answers/delete-a-file-from-a-git-repository/

@ostboiko ostboiko requested a review from YukihiroSM November 6, 2023 19:50
Copy link

@EdAlekseiev EdAlekseiev left a comment

Choose a reason for hiding this comment

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

You need to improve your files, because they are unreadable now

castomer.py Outdated

Choose a reason for hiding this comment

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

Delete this file, please

cer.py Outdated

Choose a reason for hiding this comment

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

Delete this file, pleaase

Copy link

@EdAlekseiev EdAlekseiev left a comment

Choose a reason for hiding this comment

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

You need to improve your files, because they are unreadable now

app/shop.py Outdated
Comment on lines 23 to 44
def generate_receipt(self, customer: str, current_time: str) -> str:
receipt = f"Date: {current_time}\nThanks, {customer.name}," \
f" for your purchase!\nYou have bought: \n"
total_cost = 0
for product, quantity in customer.product_cart.items():
if product in self.product_cart:
product_cost = self.product_cart[product]
product_total_cost = product_cost * quantity
if product_total_cost % 1 == 0:
receipt += (
f"{quantity} {product}s for "
f"{int(product_total_cost)} dollars\n"
)
else:
receipt += (
f"{quantity} {product}s for "
f"{product_total_cost} dollars"
)
total_cost += product_total_cost
receipt += f"\nTotal cost is {total_cost} dollars\nSee " \
f"you again!\n\n{customer.name} rides home"
return receipt
Copy link

@EdAlekseiev EdAlekseiev Nov 10, 2023

Choose a reason for hiding this comment

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

Suggested change
def generate_receipt(self, customer: str, current_time: str) -> str:
receipt = f"Date: {current_time}\nThanks, {customer.name}," \
f" for your purchase!\nYou have bought: \n"
total_cost = 0
for product, quantity in customer.product_cart.items():
if product in self.product_cart:
product_cost = self.product_cart[product]
product_total_cost = product_cost * quantity
if product_total_cost % 1 == 0:
receipt += (
f"{quantity} {product}s for "
f"{int(product_total_cost)} dollars\n"
)
else:
receipt += (
f"{quantity} {product}s for "
f"{product_total_cost} dollars"
)
total_cost += product_total_cost
receipt += f"\nTotal cost is {total_cost} dollars\nSee " \
f"you again!\n\n{customer.name} rides home"
return receipt
def generate_receipt(self, customer: str, current_time: str, fuel_price: float) -> str:
receipt = f"Date: {current_time}\nThanks, {customer.name}," \
f" for your purchase!\nYou have bought: \n"
total_cost = 0
for product, quantity in customer.product_cart.items():
if product in self.product_cart:
product_cost = self.product_cart[product]
product_total_cost = product_cost * quantity
if product_total_cost % 1 == 0:
receipt += (
f"{quantity} {product}s for "
f"{int(product_total_cost)} dollars\n"
)
else:
receipt += (
f"{quantity} {product}s for "
f"{product_total_cost} dollars"
)
total_cost = customer.calculate_trip_cost(self, fuel_price)
receipt += f"\nTotal cost is {total_cost} dollars\nSee " \
f"you again!\n\n{customer.name} rides home"
return receipt

@ostboiko ostboiko requested a review from EdAlekseiev November 11, 2023 10:40
Copy link

@EdAlekseiev EdAlekseiev left a comment

Choose a reason for hiding this comment

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

Small change

app/shop.py Outdated
fuel_price: float
) -> str:
receipt = f"Date: {current_time}\nThanks, {customer.name}," \
f" for your purchase!\nYou have bought: \n"

Choose a reason for hiding this comment

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

Suggested change
f" for your purchase!\nYou have bought: \n"
f" for your purchase!\nYou have bought:\n"

Copy link
Author

Choose a reason for hiding this comment

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

Знімок екрана 2023-11-11 о 13 48 03

Copy link
Author

Choose a reason for hiding this comment

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

I tried your option, but then the test crashes, doesn't want to, a space is needed there

Choose a reason for hiding this comment

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

the tests are fixed on git already. You have old version, so just remove the space here, please.

@ostboiko ostboiko requested a review from EdAlekseiev November 11, 2023 11:50
app/shop.py Outdated
fuel_price: float
) -> str:
receipt = f"Date: {current_time}\nThanks, {customer.name}," \
f" for your purchase!\nYou have bought: \n"

Choose a reason for hiding this comment

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

the tests are fixed on git already. You have old version, so just remove the space here, please.

@ostboiko ostboiko requested a review from YukihiroSM November 11, 2023 14:21

Choose a reason for hiding this comment

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

Please restore this file!

app/main.py Outdated


def shop_trip() -> str:
global shop

Choose a reason for hiding this comment

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

Why do you need this line?

app/main.py Outdated
shops_data = config_data["shops"]

customers = []
cars = []

Choose a reason for hiding this comment

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

This list is redundant no need to store cars

Copy link
Author

Choose a reason for hiding this comment

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

sorry can't delete it

Copy link
Author

Choose a reason for hiding this comment

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

Знімок екрана 2023-11-11 о 17 52 44

app/shop.py Outdated
Comment on lines 18 to 20
total_cost = 0
for product in product_cart.keys():
total_cost += self.product_cart[product] * product_cart[product]

Choose a reason for hiding this comment

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

Use sum() function
Also, use .items instead of .keys()

app/shop.py Outdated
Comment on lines 36 to 45
if product_total_cost % 1 == 0:
receipt += (
f"{quantity} {product}s for "
f"{int(product_total_cost)} dollars\n"
)
else:
receipt += (
f"{quantity} {product}s for "
f"{product_total_cost} dollars"
)

Choose a reason for hiding this comment

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

Suggested change
if product_total_cost % 1 == 0:
receipt += (
f"{quantity} {product}s for "
f"{int(product_total_cost)} dollars\n"
)
else:
receipt += (
f"{quantity} {product}s for "
f"{product_total_cost} dollars"
)
if product_total_cost.is_integer():
product_total_cost = int(product_total_cost)
receipt += (
f"{quantity} {product}s for "
f"{product_total_cost} dollars"
)

Copy link

@YukihiroSM YukihiroSM left a comment

Choose a reason for hiding this comment

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

Good job!

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