Help with List & Searches

I have a puzzle app. I have thousands of puzzles and it is going to keep growing. I also have users who are solving puzzles. Finally I have categories that the puzzles are in.

I currently have users keep a number for how many problems they have done.

For puzzles, I have the category they are in.

For category I have a number for how many puzzles are in that category.

Then I have another data type called solved puzzle. This is a card that has a user and a puzzle. When a user solves a puzzle for the first time, one is created.

For my searches, I am running into issues. Users want to know what percentage of a category they have done.

Also, I want a list of puzzles on the page so the next problem is loaded instantly. Users usually click a category and I don’t know how I should manage the search and puzzle list that is needed.

Users can also generate a random list. I can use a search for puzzle where category = category, sort random. But then it is not useable again until the user refreshes due to how bubble handles random. I could have a call to get the count, then generate a list of numbers on javascript and randomize them. But then I will be making a call for every problem the user does and that is a lot of calls to the database which, if I understand correctly, charges me money.

Finally, users may also want to get a list of puzzles that they have not solved within a category.

Ideas and advice are appreciated.