-
Notifications
You must be signed in to change notification settings - Fork 28
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
feat: improve querying capabilities #430
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
@@ Coverage Diff @@
## main #430 +/- ##
==========================================
+ Coverage 95.95% 96.03% +0.08%
==========================================
Files 643 643
Lines 16999 17044 +45
==========================================
+ Hits 16312 16369 +57
+ Misses 687 675 -12
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #430 +/- ##
==========================================
+ Coverage 95.95% 96.03% +0.08%
==========================================
Files 643 643
Lines 16999 17044 +45
==========================================
+ Hits 16312 16369 +57
+ Misses 687 675 -12
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@@ -54,7 +79,18 @@ def get_queryset(self): | |||
|
|||
owners = Owner.objects.all() | |||
|
|||
if self.q: | |||
owners = owners.filter(username__icontains=self.q) |
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.
swapping from icontains
to startswith
should help with speed
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.
I'm approving with some thoughts
[nit] I think it would be a good idea to put each of the contents of the if statements in to their own function
[nit] It might be worth it to test out some parts of the functionality added here.
2 things I could test:
- is the
self.q
splitting and routing to the desired filter statement working correctly? - are each of the separate queries returning what you'd expect?
c40fbae
to
318ef51
Compare
added tests and refactored per feedback |
Purpose/Motivation
Adds more natural querying to django admin for feature flags overrides. Should also speed up the query since no longer using
icontains
. Closes points 5 & 6 from here: codecov/engineering-team#1315Screen.Recording.2024-03-01.at.11.23.37.AM.mov
Legal Boilerplate
Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.