Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

feat: 411 add available paid plans resolver#181

Merged
adrian-codecov merged 7 commits intomainfrom
411-add-available-paid-plans-resolver
Oct 10, 2023
Merged

feat: 411 add available paid plans resolver#181
adrian-codecov merged 7 commits intomainfrom
411-add-available-paid-plans-resolver

Conversation

@adrian-codecov
Copy link
Copy Markdown
Contributor

@adrian-codecov adrian-codecov commented Oct 6, 2023

Purpose/Motivation

We want to surface the plans available to a customer based on some parameters. This is adding a resolver to expose that information. This resolver mimics a function shown in via a REST endpoint, with the intent to transition to gql only.

This is not the final version of this change, as I want some input on how to keep parity with this very similar function, https://github.com/codecov/codecov-api/blob/main/billing/helpers.py#L23. There's two main differences with this and the newly added resolver: (Edit: these have been addressed)

  • Original fn doesn't have logic to add Lite plans if we want to use those (can be added)
  • Offers just the basic plan rather than the free plan representation, which I'm unsure if I'm making the right assumption
  • Original fn only adds sentry plans to sentry users and not pro plans

What does this PR do?

  • Adds availablePlans resolver to an owner
  • Adds tests
  • Adds fn in plan service to get the available_plans
  • Adjusted existing available_plans function to include lite plans

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.

@codecov
Copy link
Copy Markdown

codecov Bot commented Oct 6, 2023

Codecov Report

Merging #181 (79ffda8) into main (0741b80) will increase coverage by 0.07%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##            main    #181     +/-   ##
=======================================
+ Coverage   95.46   95.53   +0.07     
=======================================
  Files        714     714             
  Lines      15314   15551    +237     
=======================================
+ Hits       14619   14856    +237     
  Misses       695     695             
Flag Coverage Δ
unit 95.63% <100.00%> (+0.07%) ⬆️
unit-latest-uploader 95.63% <100.00%> (+0.07%) ⬆️

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

Files Coverage Δ
billing/helpers.py 100.00% <100.00%> (ø)
graphql_api/types/owner/owner.py 91.93% <100.00%> (+0.33%) ⬆️
plan/constants.py 100.00% <100.00%> (ø)
plan/service.py 96.55% <100.00%> (+0.43%) ⬆️
plan/test_plan.py 100.00% <100.00%> (ø)

@codecov-qa
Copy link
Copy Markdown

codecov-qa Bot commented Oct 6, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (0741b80) 95.56% compared to head (79ffda8) 95.63%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #181      +/-   ##
==========================================
+ Coverage   95.56%   95.63%   +0.07%     
==========================================
  Files         599      599              
  Lines       14913    15150     +237     
==========================================
+ Hits        14251    14489     +238     
+ Misses        662      661       -1     
Flag Coverage Δ
unit 95.63% <100.00%> (+0.07%) ⬆️
unit-latest-uploader 95.63% <100.00%> (+0.07%) ⬆️

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.

@codecov-public-qa
Copy link
Copy Markdown

codecov-public-qa Bot commented Oct 6, 2023

Codecov Report

Merging #181 (79ffda8) into main (0741b80) will increase coverage by 0.07%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #181      +/-   ##
==========================================
+ Coverage   95.56%   95.63%   +0.07%     
==========================================
  Files         599      599              
  Lines       14913    15150     +237     
==========================================
+ Hits        14251    14489     +238     
+ Misses        662      661       -1     
Flag Coverage Δ
unit 95.63% <100.00%> (+0.07%) ⬆️
unit-latest-uploader 95.63% <100.00%> (+0.07%) ⬆️

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

Files Coverage Δ
billing/helpers.py 100.00% <100.00%> (ø)
graphql_api/types/owner/owner.py 91.93% <100.00%> (+0.33%) ⬆️
plan/constants.py 100.00% <100.00%> (ø)
plan/service.py 96.55% <100.00%> (+1.40%) ⬆️
plan/test_plan.py 100.00% <100.00%> (ø)

Impacted file tree graph

Comment thread billing/helpers.py Outdated
plan_service.trial_status == TrialStatus.ONGOING.value
or plan_service.trial_status == TrialStatus.EXPIRED.value
or plan_service.plan_name in LITE_PLAN_REPRESENTATIONS
) and plan_service.plan_user_count <= 10:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It would be better to put the 10 into constants file

ownerid: Int!
plan: Plan
pretrialPlan: PlanRepresentation
availablePlans: [PlanRepresentation!]!
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What's the difference between [PlanRepresentation!]! and [PlanRepresentation]!?

Comment thread plan/service.py Outdated
self.trial_status == TrialStatus.ONGOING.value
or self.trial_status == TrialStatus.EXPIRED.value
or self.plan_name in LITE_PLAN_REPRESENTATIONS
) and self.plan_user_count <= 10:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

same here

@adrian-codecov adrian-codecov merged commit c1cd5f9 into main Oct 10, 2023
@adrian-codecov adrian-codecov deleted the 411-add-available-paid-plans-resolver branch October 10, 2023 14:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants