• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

kobotoolbox / kpi / 14131533802
81%
master: 76%

Build:
Build:
LAST BUILD BRANCH: beccagraber/dev-1497-show-most-recently-created-qual-answer
DEFAULT BRANCH: master
Ran 28 Mar 2025 03:24PM UTC
Jobs 1
Files 637
Run time 2min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

28 Mar 2025 02:45PM UTC coverage: 80.85% (-0.01%) from 80.863%
14131533802

push

github

web-flow
refactor(massEmails): refactor usage queries to make nlp easier (#5610)

### 📣 Summary
Developer-only changes.


### 💭 Notes

One of the goals of the refactor is to start standardizing some
terminology.
- "subscription" refers to a product with a recurring payment (either a
plan or an addon). Subscription limits DO NOT include one-time addons.
-  "plan" refers to a product with a collection of limits
- "default plan" is the collection of limits used for users who have no
paid plans
- "addon" refers to a subscription that only increases one type of
limit. Right now, the only addon we have is a storage addon
- "current billing period" refers to the billing period of a user's
plan. it does not factor in addons since the only addon we have is
storage, and storage is not calculated per period

This PR also to make some implicit assumptions more explicit.
Specifically:
- the only available recurring addon is for storage
- a user can only have one active plan and one active addon. if they
somehow have multiple, we only care about the most recent of each type
- the billing period of an addon doesn't matter since the only available
addon is for storage

The major refactor in this PR is calculating usage limits for all usage
types with a single query instead of only looking at one usage type at
once. In the future, this will mean we don't have to hit the database
twice when we are looking for the nlp limits (asr_seconds and
mt_characters). Doing this requires a little extra logic as not all
usage types are calculated the same. Specifically, we need to account
for the possibility of storage addons. Note that this PR does not deal
with one-time addons, as we won't need to account for them until we get
nlp usage or we start doing one-time submission addons.

The new logic fetches the most recent plan and the most recent addon for
all organizations. For each organization, for submission, character, and
second limits, it uses the value from the most recent plan or, ... (continued)

6094 of 9678 branches covered (62.97%)

135 of 142 new or added lines in 4 files covered. (95.07%)

19 existing lines in 1 file now uncovered.

23183 of 28674 relevant lines covered (80.85%)

0.81 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
7
87.06
-8.06% kobo/apps/stripe/utils.py

Uncovered Existing Lines

Lines Coverage ∆ File
19
87.06
-8.06% kobo/apps/stripe/utils.py
Jobs
ID Job ID Ran Files Coverage
1 14131533802.1 28 Mar 2025 03:24PM UTC 637
80.85
Source Files on build 14131533802
  • Tree
  • List 637
  • Changed 4
  • Source Changed 0
  • Coverage Changed 4
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • a98c505c on github
  • Prev Build on main (#14130185039)
  • Next Build on main (#14132738035)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc