Hi everyone, I’m working on a educational app and wanted to give users the ability to download the material. However, I want to restrict users to only be able to download 10 items a month.

I’m hoping to get some direction here on what the most effective and scalable way to build this function.

So far I’m thinking,

  1. Create a button with a workflow that triggers the download with a rule that they haven’t exceeded 10 this month (each download adds a number in the database user profile)
  2. A workflow that triggers the first every month that resets all users downloads

Would this be the best way to go about this?

Appreciate any advice on this:)

Cheers

That seems like it would work.

If you have lots of infrequent users, it could be wasteful to be resetting all users’ download quota monthly. Consider instead saving user’s last download date. Then, you can enable the download action only when Current User's download_quota < 10 or Current User's last_download < Current Date change date to 1 rounded down to date.

1 Like

Thank you for the tip David! Do you think resetting all users would unnecessary cost a lot of workloads?

Many others in the forum are far more experienced and expert than I and may be able to guide you better. Also, you can estimate yourself based on the workload units per activity type that Bubble publishes.

That said, the way I’d think about it is that there’s negligible incremental workload to edit the additional timestamp field every time you’re editing the tally field anyway and that incremental amount is presumably less than whatever amount of workload would be associated with editing the tally field for every user every month.

Resetting the credits every month would be fine, an alternative is every time they click it have it create a new thing “Used Credit” in the database that has the user and creation date , lucky for you they are already built in fields.

Then when they click have it have the condition:
Search for Used Credits:count < 10 with search constraints
Created by = Current User
Creation Date ≥ Current date/time:rounded down to month
Creation Date < Current date/time:rounded down to month + months 1

So it only works if it finds less than 10 things in the database for the user for that month. The 10 can also be dynamic if each user has different allowed amounts (e.g. Current user’s Max Credits)

This topic was automatically closed after 70 days. New replies are no longer allowed.