-
Notifications
You must be signed in to change notification settings - Fork 429
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
fix(get_permitted_projects): get rid of distinct #4320
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 3 Skipped Deployments
|
Uffizzi Preview |
a8040e5
to
4d03569
Compare
4d03569
to
4e35608
Compare
Use multiple small queries instead of distinct for better performance
db84759
to
ebe2dfb
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #4320 +/- ##
=======================================
Coverage 96.60% 96.61%
=======================================
Files 1196 1196
Lines 39113 39123 +10
=======================================
+ Hits 37787 37797 +10
Misses 1326 1326 ☔ View full report in Codecov by Sentry. |
|
|
|
|
|
4ada29b
to
3b26f65
Compare
3b26f65
to
44f4755
Compare
object_ids.update( | ||
list(for_model.objects.filter(group_filter).values_list("id", flat=True)) | ||
) | ||
if settings.IS_RBAC_INSTALLED: |
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.
if settings.IS_RBAC_INSTALLED: | |
if settings.IS_RBAC_INSTALLED: # pragma: no cover |
This will exclude all the code from the if branch.
44f4755
to
ed8727e
Compare
ed8727e
to
50d141e
Compare
@@ -3102,7 +3121,7 @@ def test_feature_list_last_modified_values( | |||
Feature.objects.create(name=f"feature_{i}", project=project) | |||
|
|||
# When | |||
with django_assert_num_queries(19): # TODO: reduce this number of queries! | |||
with django_assert_num_queries(18): # TODO: reduce this number of queries! |
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.
Nice! First time I've actually seen this number go down in a while! 😄
Thanks for submitting a PR! Please check the boxes below:
pre-commit
to check lintingdocs/
if required so people know about the feature!Changes
Refactor get_permitted_projects_for_user to use 4 small queries(each taking less than 1ms) instead of one giant query using distinct
Feature permission: Let view do the permission check for
list
actionHow did you test this code?
Adds/updates unit tests