-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Solution #1228
Solution #1228
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your hard work on this project! 😊 While your implementation is quite solid and meets many of the task requirements, there are a couple of critical issues that need to be addressed before we can approve the pull request:
-
Logical Issue in
go_to_cafe
Function: The current logic stops checking friends as soon as it encounters one who is not vaccinated. This means that not all friends are checked, which might not be the intended behavior. Consider modifying the logic to accumulate results for all friends before returning a message. This will ensure that all friends are evaluated, and a comprehensive decision can be made. -
Vaccine Expiration Date Comparison: The comparison of the vaccine expiration date assumes that it is a
datetime.date
object. Please ensure that theexpiration_date
is indeed adatetime.date
object before performing the comparison. If it's not, you may need to convert it appropriately to avoid potential errors.
Once these issues are resolved, your code will be in great shape! Keep up the great work, and don't hesitate to reach out if you have any questions or need further assistance. 🚀
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
🔄 Fix the issues, commit the changes, and then re-request my review using the Re-request review
button in the Reviewers tab.
app/cafe.py
Outdated
def visit_cafe(self, visitor: dict) -> str: | ||
if "vaccine" not in visitor: | ||
raise NotVaccinatedError("Visitor is not vaccinated.") | ||
elif visitor["vaccine"]["expiration_date"] < datetime.date.today(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comparison visitor['vaccine']['expiration_date'] < datetime.date.today()
assumes that expiration_date
is a datetime.date
object. Ensure that the expiration_date
is indeed a datetime.date
object before this comparison. If it's a string or another type, you may need to convert it to a datetime.date
object first.
app/main.py
Outdated
except VaccineError: | ||
return "All friends should be vaccinated" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current logic returns immediately if any friend is not vaccinated, which means it will not check the rest of the friends. If the intention is to ensure all friends are checked before deciding, consider accumulating the results and returning a message after the loop.
No description provided.