-
Notifications
You must be signed in to change notification settings - Fork 636
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 #676
base: master
Are you sure you want to change the base?
solution #676
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.
Hey there! 👋 You've done a fantastic job overall, but there are a few areas that need your attention. Please consider using a different database for production or add 'db.sqlite3' to your .gitignore file. Also, there's no need to split the date, as it's already in the correct format. Lastly, please correct the grouping of your import statements. Keep up the good work! 🚀
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
@@ -11,7 +12,7 @@ | |||
MovieSessionListSerializer, | |||
MovieDetailSerializer, | |||
MovieSessionDetailSerializer, | |||
MovieListSerializer, | |||
MovieListSerializer, OrderSerializer, OrderListSerializer, | |||
) |
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.
Code Style: Group imports using ()
if needed. The import statement for the serializers is not grouped correctly. The trailing comma should be removed from the last import inside the parentheses.
movie = self.request.query_params.get("movie") | ||
if date and movie: | ||
movie = self._params_to_int(movie) | ||
queryset = queryset.filter( |
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.
Code Efficiency: Don't split the date, it's already in the format needed. The date
variable is used in the filter without being split into year, month, and day.
queryset = queryset.filter( | ||
show_time__contains=date, | ||
movie__id__in=movie | ||
) |
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.
Code Efficiency: Don't split the date, it's already in the format needed. The date
variable is used in the filter without being split into year, month, and day.
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.
Great job on the code! The models, serializers, and URL configurations are well-structured and efficient. However, there is a critical security issue that needs your attention - never publish your secret key in your code, and always use environment variables or a separate config file for sensitive information. Additionally, there are a few improvements you could make to enhance the code quality and efficiency, which have been pointed out in the comments. Keep up the good work and continue learning from your mistakes. 🚀👍
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
movie = self.request.query_params.get("movie") | ||
if date and movie: | ||
movie = self._params_to_int(movie) | ||
queryset = queryset.filter( | ||
show_time__date=date, | ||
movie__id__in=movie | ||
) | ||
elif date: | ||
queryset = queryset.filter( | ||
show_time__date=date | ||
) |
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.
Code Efficiency issue: It seems you are splitting the date to filter the queryset (lines 101 and 107). According to the checklist, this is not an efficient way to filter by date. Try filtering the date directly without splitting it. Refer to the checklist for a good example.
|
||
date = self.request.query_params.get("date") | ||
movie = self.request.query_params.get("movie") | ||
if date and movie: | ||
movie = self._params_to_int(movie) | ||
queryset = queryset.filter( | ||
show_time__date=date, | ||
movie__id__in=movie | ||
) | ||
elif date: | ||
queryset = queryset.filter( | ||
show_time__date=date | ||
) | ||
elif movie: | ||
movie = self._params_to_int(movie) | ||
queryset = queryset.filter(movie__id__in=movie) | ||
return queryset |
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.
Code Quality issue: The if-elif-elif condition in lines 99-112 is not optimal. If the 'date' and 'movie' parameters are both present in the request, then the filter will be applied correctly. But if only 'movie' is present, it will be ignored because of the 'elif' condition. Consider changing the 'elif' conditions to 'if' so that each parameter is checked and applied independently.
No description provided.