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 #725

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

Conversation

VolodymyrSemchysyn
Copy link

No description provided.

Copy link

@dxrrkwm dxrrkwm left a comment

Choose a reason for hiding this comment

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

looks good i guess!

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.


Thank you for your hard work on this project! 😊 There are a few critical issues that need to be addressed before we can approve the pull request:

  1. Order Creation Issue: In cinema/serializers.py, the OrderSerializer has a critical issue where the create method does not handle the creation of related Ticket objects correctly. The tickets field is not set to read-only, which can lead to unexpected behavior. Please ensure that the order creation process maintains data integrity by addressing this issue.

  2. Security Concerns: In cinema_service/settings.py, the SECRET_KEY should be kept secret in production, and DEBUG should be set to False to avoid exposing sensitive information. These are critical for the security of your application.

  3. Missing Pagination Configuration: The task requires pagination to be configured in settings.py, but it is missing. Please add this configuration to meet the task requirements.

Once these issues are resolved, your code will be in great shape! Keep up the good work, and feel free 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.



class OrderSerializer(serializers.ModelSerializer):
tickets = TicketSerializer(many=True, read_only=False)

Choose a reason for hiding this comment

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

The tickets field in OrderSerializer is not set to read_only=True, which can cause issues when creating orders. Consider setting read_only=True if you do not intend to allow direct creation of tickets through the order serializer.

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 addressing many of the previous issues! 🎉 However, there are still some critical points that need attention to ensure your code meets all task requirements:

  1. Order Creation Issue: The OrderSerializer in cinema/serializers.py now handles the creation of related Ticket objects using the create method. However, the tickets field is still set to read-only, which prevents input data for creating tickets. Make sure to adjust this by either removing read_only=True or implementing a different logic to handle ticket creation.

  2. Security Concerns: The SECRET_KEY is hardcoded in cinema_service/settings.py. While setting DEBUG to False is correct for production, ensure the SECRET_KEY is kept secret by using environment variables or a separate configuration file.

  3. Pagination Configuration: Although the pagination configuration is present through the OrderPagination class, ensure it is explicitly mentioned in settings.py if required by the task.

These issues are important for the functionality and security of your application. Please address them to improve your code. Keep up the good work, and continue learning from these experiences! 🚀

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



class OrderSerializer(serializers.ModelSerializer):
tickets = TicketSerializer(many=True, read_only=True)

Choose a reason for hiding this comment

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

The tickets field is set to read_only=True, which means it will not be included in the input data for the create method. This will cause tickets_data to be empty, and no Ticket objects will be created. Consider removing read_only=True or handling ticket creation differently.


def create(self, validated_data):
with transaction.atomic():
tickets_data = validated_data.pop("tickets")

Choose a reason for hiding this comment

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

Since tickets is read-only, validated_data.pop("tickets") will not retrieve any ticket data. You need to adjust this logic to correctly handle ticket creation.

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