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

Solution #880

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Solution #880

wants to merge 1 commit into from

Conversation

Le0n-K
Copy link

@Le0n-K Le0n-K commented Nov 20, 2024

{FF099769-5666-44C5-AFEC-9CACAC663A8C}
{49F6CBF7-7EA4-4F55-889C-DD2865290A57}
{E5089722-05EA-48D6-A6D4-620DDB28DD65}
{89E55303-F5B9-4B62-A11F-E91AEF05AF70}
{07498D56-0B82-4B3E-A887-300456E8D362}
{5DDE84D2-833A-4278-98DF-4745C0BB745E}

Copy link

@yulia-pl yulia-pl left a comment

Choose a reason for hiding this comment

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

Cool! 🔥🔥🔥

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Great job on implementing the task! 🎉 While there are a few minor issues, such as the typo in the template tag and the redundant increment of num_visits, these do not significantly impact the functionality. You've done well to meet the core requirements, and your attention to detail is evident. Keep up the good work and consider addressing the minor points for even cleaner code in the future! 😊

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨

Comment on lines +16 to +17
num_visits = request.session.get("num_visits", 0)
request.session["num_visits"] = num_visits + 1

Choose a reason for hiding this comment

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

The num_visits variable is incremented twice: once when retrieving it from the session and again when updating the session. This results in an off-by-one error in the context dictionary. Consider incrementing num_visits only once and using the updated value both for setting the session and in the context.


context = {
"num_drivers": num_drivers,
"num_cars": num_cars,
"num_manufacturers": num_manufacturers,
"num_visits": num_visits + 1,

Choose a reason for hiding this comment

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

The num_visits value in the context dictionary is incremented again, which is unnecessary since it was already incremented when updating the session. Use the num_visits variable directly without adding 1 again.

<li><a href="{% url "taxi:manufacturer-list" %}">Manufacturers</a></li>
<li><a href="{% url "taxi:car-list" %}">Cars</a></li>
<li><a href="{% url "taxi:driver-list" %}">Drivers</a></li>
{% if user.is_authenticate %}

Choose a reason for hiding this comment

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

There is a typo in the template tag. It should be {% if user.is_authenticated %} instead of {% if user.is_authenticate %}. This will correctly check if the user is authenticated.

{% for driver in car.drivers.all %}
<li>{{ driver.first_name }} {{ driver.last_name }}</li>
{% endfor %}
{% for driver in car.drivers.all %}

Choose a reason for hiding this comment

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

The iteration over car.drivers.all should use parentheses: car.drivers.all(). This is necessary to call the method and retrieve the list of drivers.

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.

3 participants