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

feat: improve querying capabilities #430

Merged
merged 4 commits into from
Mar 4, 2024

Conversation

daniel-codecov
Copy link
Contributor

@daniel-codecov daniel-codecov commented Mar 1, 2024

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

Screen.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.

Copy link

codecov-public-qa bot commented Mar 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (6a36168) 95.95% compared to head (feab5ee) 96.03%.

Impacted file tree graph

@@            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     
Flag Coverage Δ
unit 96.03% <100.00%> (+0.08%) ⬆️
unit-latest-uploader 96.03% <100.00%> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
codecov/views.py 100.00% <100.00%> (+35.29%) ⬆️

Impacted file tree graph

@codecov-qa
Copy link

codecov-qa bot commented Mar 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.03%. Comparing base (6a36168) to head (feab5ee).

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     
Flag Coverage Δ
unit 96.03% <100.00%> (+0.08%) ⬆️
unit-latest-uploader 96.03% <100.00%> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -54,7 +79,18 @@ def get_queryset(self):

owners = Owner.objects.all()

if self.q:
owners = owners.filter(username__icontains=self.q)
Copy link
Contributor Author

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

Copy link
Contributor

@joseph-sentry joseph-sentry left a 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:

  1. is the self.q splitting and routing to the desired filter statement working correctly?
  2. are each of the separate queries returning what you'd expect?

@daniel-codecov daniel-codecov force-pushed the daniel/admin-UX-improvements branch from c40fbae to 318ef51 Compare March 4, 2024 18:17
@daniel-codecov
Copy link
Contributor Author

added tests and refactored per feedback

@daniel-codecov daniel-codecov merged commit 3ff9a9d into main Mar 4, 2024
18 of 19 checks passed
@daniel-codecov daniel-codecov deleted the daniel/admin-UX-improvements branch March 4, 2024 18:58
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.

2 participants