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: sort by Overage in sales dashboard #3858

Merged
merged 3 commits into from
Apr 30, 2024

Conversation

rolodato
Copy link
Contributor

@rolodato rolodato commented Apr 29, 2024

Thanks for submitting a PR! Please check the boxes below:

  • I have run pre-commit to check linting
  • I have added information to docs/ if required so people know about the feature!
  • I have filled in the "Changes" section below?
  • I have filled in the "How did you test this code" section below?
  • I have used a Conventional Commit title for this Pull Request

Changes

Allows sorting by Overage in the sales dashboard organisation list view.

image

image

We're changing the view's query set to use a calculated overage field instead of the get_api_call_overage method. In my local environment, this adds the following column to the result set:

SELECT ...,
       GREATEST(0, ("organisations_organisationsubscriptioninformationcache"."api_calls_30d" -
                    "organisations_organisationsubscriptioninformationcache"."allowed_30d_api_calls")) AS "overage",

How did you test this code?

Manually in a local environment. I have not tested this with a large number of organisations, but also don't foresee any issues.

This individual test can be run with pytest tests/unit/sales_dashboard.

Copy link

vercel bot commented Apr 29, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 30, 2024 1:43pm
flagsmith-frontend-preview ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 30, 2024 1:43pm
flagsmith-frontend-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 30, 2024 1:43pm

@github-actions github-actions bot added the api Issue related to the REST API label Apr 29, 2024
Copy link
Contributor

github-actions bot commented Apr 29, 2024

Uffizzi Preview deployment-51005 was deleted.

@rolodato rolodato marked this pull request as draft April 29, 2024 18:44
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.87%. Comparing base (b4e058a) to head (d12b50b).
Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3858   +/-   ##
=======================================
  Coverage   95.87%   95.87%           
=======================================
  Files        1129     1130    +1     
  Lines       35787    35791    +4     
=======================================
+ Hits        34309    34313    +4     
  Misses       1478     1478           

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

@rolodato rolodato marked this pull request as ready for review April 30, 2024 13:49
@rolodato rolodato requested a review from zachaysan April 30, 2024 13:58
@rolodato rolodato enabled auto-merge April 30, 2024 14:00
Copy link
Contributor

@zachaysan zachaysan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have one question but otherwise PR looks good to merge.

@@ -44,7 +44,8 @@ <h1 class="h2">Organisations</h1>
<option value="num_features" {% if sort_field == "num_features" %}selected{% endif %}>Flags</option>
<option value="subscription_information_cache__api_calls_24h" {% if sort_field == "subscription_information_cache__api_calls_24h" %}selected{% endif %}>24h API calls</option>
<option value="subscription_information_cache__api_calls_7d" {% if sort_field == "subscription_information_cache__api_calls_7d" %}selected{% endif %}>7d API calls</option>
<option value="subscription_information_cache__api_calls_30d" {% if sort_field == "subscription_information_cache__api_calls_30d" or not sort_field %}selected{% endif %}>30d API calls</option>
<option value="subscription_information_cache__api_calls_30d" {% if sort_field == "subscription_information_cache__a pi_calls_30d" or not sort_field %}selected{% endif %}>30d API calls</option>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand what subscription_information_cache__a does here. I understand it's part of a sort field, but what is the __a portion from the cache represent?

@rolodato rolodato added this pull request to the merge queue Apr 30, 2024
Merged via the queue into main with commit 2417f57 Apr 30, 2024
35 checks passed
@rolodato rolodato deleted the feat/sort-by-overage-sales-dashboard branch April 30, 2024 14:09
@rolodato rolodato mentioned this pull request Apr 30, 2024
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Issue related to the REST API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants