-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add view counters to trips and user profiles #219
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.
PR Type: Enhancement
PR Summary: The pull request introduces view counters for trips and user profiles, ensuring that these counters are only incremented by views from other users and not by the creators themselves. It includes model updates, view logic to handle the incrementing of view counts, and migrations to add the necessary fields to the database.
General suggestions:
- Ensure that the control flow changes in the get_trips_context function are intentional and correctly handle the EmptyPage exception scenario.
- Consider refactoring the add_view method to maintain separation of concerns, possibly by moving the user check logic to the view or service layer.
- Review the implementation to prevent potential double counting of views, especially where bulk_update_view_count is called in multiple places.
- Reevaluate the placement of the add_profile_view method call within the setup method of the UserProfile view to align with the typical Django view lifecycle.
- Add a guard clause in the bulk_update_view_count function to gracefully handle the case where the trips iterable is empty.
Your trial expires on December 25, 2023. Please email tim@sourcery.ai to continue using Sourcery ✨
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #219 +/- ##
==========================================
+ Coverage 86.65% 86.74% +0.08%
==========================================
Files 89 89
Lines 4332 4360 +28
Branches 564 568 +4
==========================================
+ Hits 3754 3782 +28
Misses 482 482
Partials 96 96 ☔ View full report in Codecov by Sentry. |
Add view counters to trips and user profiles, which are only viewable by the user that created the object.