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

kobotoolbox / kpi / 12357779115
81%
master: 76%

Build:
Build:
LAST BUILD BRANCH: dev-1257-remove-v1-forms-endpoint
DEFAULT BRANCH: master
Ran 16 Dec 2024 05:51PM UTC
Jobs 1
Files 608
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

16 Dec 2024 05:15PM UTC coverage: 80.455% (-0.02%) from 80.477%
12357779115

push

github

web-flow
fix(billing): return service/asset usage for current period TASK-1327 (#5326)

### 📣 Summary
Update asset and service usage code to return only a single set of data for the current billing cycle, regardless of whether that cycle is monthly or yearly and adjust frontend accordingly.

### 📖 Description
Currently, the `ServiceUsageSerializer` and `AssetUsageSerializer` return usage information calculated according to a monthly billing cycle and a yearly billing cycle, regardless of what kind of billing cycle a user is actually subscribed to. So if a user is on a monthly plan, we make up a hypothetical yearly cycle and return data for that in addition to the actual monthly cycle they are on. The frontend, in turn, selects the correct cycle information to display based on a separate request fetching the user’s subscription information. The hypothetical cycle is never displayed and doesn’t seem to be used for anything at all. 

This PR merges the functionality of the `get_monthly_billing_dates()` and `get_yearly_billing_dates()` utils into a single function that, once it determines which cycle an account is on, returns the relevant `period_start` and `period_end` dates. 

### 👀 Preview steps
For frontend preview:

1. Create a new user on a Stripe-enabled instance

2. Navigate to usage page. Observe that user is on community plan with start date corresponding to account creation date. Displayed usage period should correspond to either first day of this month or last day of previous month (most likely the latter, though it currently depends on one’s timezone) and the last day of this month.

3. Purchase a monthly plan and sync djstripe Subscriptions, navigate to usage page. Observe that start date is still account creation date. Displayed usage period should now correspond to start date and one month after start date.

4. Cancel plan as the user, then cancel the plan via Stripe (or ask someone to do this), and sync subscriptions. Visit 
usag... (continued)

5746 of 9222 branches covered (62.31%)

25 of 26 new or added lines in 5 files covered. (96.15%)

21977 of 27316 relevant lines covered (80.45%)

0.8 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
1
95.45
0.22% kobo/apps/organizations/utils.py
Jobs
ID Job ID Ran Files Coverage
1 12357779115.1 16 Dec 2024 05:51PM UTC 608
80.45
Source Files on build 12357779115
  • Tree
  • List 608
  • Changed 5
  • Source Changed 0
  • Coverage Changed 5
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • 4e3e5fd6 on github
  • Prev Build on main (#12355253744)
  • Next Build on main (#12372708252)
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