Here’s a clearer version of your message:


Hello Bubble Team,

I’m scratching my head trying to figure this out, it’s probably a simple solution I haven’t learned yet.

I have a data field called “Puzzle” with over 20 puzzles (and I plan to add around 200). I want to ensure that all puzzles are locked unless the user has completed the previous one. How should I approach this?

Is there a way to use :first item for this?

I store the completed puzzles for each user in a list Completed Puzzle to track progress. I also plan to create a separate list of puzzles the user got wrong so they can see what they need to practice in the future, that part seems pretty straightforward.

My question: How can I lock all puzzles except the first one or the next one in sequence after the puzzles the user has in their Completed Puzzle list?

Thankful for any help :pray:

Hello,

You can add an index for all the puzzles. When I finish a puzzle, you save it to the database, and that way you know which puzzles I’ve solved and can identify the highest index among them.

Assume that you have a “SOLVE” button for every puzzle. If current cell puzzle’s index < Current User’s puzzles max index then the title is “LOCKED” and the button should be not clickable.

Please let me know if you need more help.

Hi, thanks for your input, when you say index what do you mean? Like a data filed in the Puzzle called “number” and each puzzle is assigned a number or?

Also how would that work because we need the first one to be unlocked

Yes, a number field for each puzzle. You can simply add a rule if the current cell puzzle's index > 1 and this puzzle is not in the solved puzzles list make this button non clickable and label is locked

1 Like

Ahh okey nice! And if i would like to move it up or down in the list i just add a button and current cells position + 1 ?

One question i have about this is, i have “Active = Yes/No” in case i need to deactivate a puzzle. How does that work? I guess it will be plain or a road block if that one is the next one for the user?

If I understand this correctly, your “user” datatype has a field called “completed puzzles” yes? I would imagine that each puzzle has a sequence number like 1, 2, 3…n to denote the order in which they should be completed right?

Assuming:
Sequence number = field in puzzle datatype (number)

If this is the case, then a simple conditional like the one below should account for ensuring that the first puzzle is always available:

When current user's completed puzzles count is 0 and current puzzle sequence number is 1, this puzzle is clickable

For other puzzles, I would use a condition like:

When current user's completed puzzles sort by sequence number: last item is greater than or equal to current cell's puzzle's sequence number or current user's completed puzzles sort by sequence number:last item's sequence number+1 is current cell's puzzle's sequence number - this element is clickable

So as an example, if the last completed number is 6 i.e Puzzle number 6. Then the first part of the expression ensures that puzzles 1 - 6 are clickable. While the second part of the expression ensures that puzzle 7 is clickable.

On a second thought, you can merge it to be:

When current user's completed puzzles sort by sequence number: last item's sequence number+1 is less than or equal to current cell's puzzle's sequence number - this element is clickable

Hope this helps.

1 Like

Hey, thanks for a very nice and detailed explanation
:pray:

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