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

kobotoolbox / kpi / 13681058140

Build:
Build:
LAST BUILD BRANCH: beccagraber/dev-1452-new_action
DEFAULT BRANCH: master
Ran 05 Mar 2025 05:25PM UTC
Jobs 1
Files 635
Run time 3min
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

05 Mar 2025 04:42PM UTC coverage: 80.845% (+0.009%) from 80.836%
13681058140

push

github

web-flow
feat(massEmail): query for users reaching their maximum storage limit TASK-1454 (#5562)

### 📣 Summary
Create the query for retrieving users who are >90% and >100% of their
storage limits.


### 📖 Description
The query returns a list of user uids. It will be used as part of a
MassEmailConfig. Emails that use that query will be sent to the list of
users generated by it. The usage calculated is the same as what is shown
on the Usage page.

### 💭 Notes

Part of this PR is taking the logic we use to determine the limits for
one organization and expanding it to be able to calculate the limits for
multiple organizations. This means moving some of the python logic to
the ORM query, but the results should be exactly the same. In
particular, the selection of price metadata over product metadata is
done with a Coalesce call rather than fetching both and then choosing
which one to use in the python processing code. All unit tests still
passed. Also added a few new ones.

Note: This will affect how we get all usage limits, not just storage
bytes, but again it should be a pure refactor so nothing user-facing
will change. This should make it easier in the future to write the
queries for those approaching their NLP and submission limits.

Similarly, this PR extends the usage calculator query for submission
bytes to get the usage for multiple users at once.

The actual user queries get all user limits, then all user storage, then
compare the two to see who is within the specified range.


### 👀 Preview steps

* Note: after every "purchase," make sure to resync the subscriber

1. Enable stripe on your local setup
2. Have at least 2 organizations/accounts. 
3. Set up org2 with the Professional Plan. Keep org1 on the community
plan.
4. Create a project in org2 with an audio question and add a few
submissions with attachments.
5. In admin, go to Djstripe -> Product -> Up to 5 GB of file storage
6. Edit the product metadata with ` "storage_bytes_limit": "111000"` and
save... (continued)

5995 of 9527 branches covered (62.93%)

52 of 56 new or added lines in 4 files covered. (92.86%)

22872 of 28291 relevant lines covered (80.85%)

0.81 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
4
84.0
-16.0% kobo/apps/mass_emails/user_queries.py
Jobs
ID Job ID Ran Files Coverage
1 13681058140.1 05 Mar 2025 05:25PM UTC 635
80.85
Source Files on build 13681058140
  • Tree
  • List 635
  • Changed 5
  • Source Changed 0
  • Coverage Changed 5
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • 75a47660 on github
  • Prev Build on main (#13675446872)
  • Next Build on release/2.025.10 (#13793511474)
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