Need Help with a logic

Hello guys, I’m having a hard time with a logic. What I want to archive is very easy (I thought at first) but I don’t know why I’m so dumb not to finger this out.

Firstly, this is how my firebase DATABASE structure looks like:
image

Now what I want to archive is, when a button clicked, I get all the tags from the bucket “TEST” and sort it and get the value of the first test which is A, and then delete the tag.

It works fine if there is a single person getting the tags and deleting the first tag.
But if two or more people clicks that button tat the same time then they both get the tag A instead of one should get tag A and other one should get tag B.

Please help me with this! I spent many days for this but failed!

Would you like a busy tag not to be analyzed? It is?

1 Like

Yes, something like that, I just want if more then users presses the button then they all get a different tag not the same one.

Do you want each user to receive only one tag to analyze?

1 Like

Yes, one and the first tag, for example, A is the first tag and after A, B is the first tag.

The logic should be when screen initialize get all tags from from project bucket Test… When got all tags store them in a list… Then recheck whether the tag has been deleted or not using another tag list block if has not deleted then delete the 1st item of your list and firebase

Annotation 2020-07-09 110139
First of all, add one more tag to the TEST bucket, here it is ‘Clicked’. Now whenever someone delete the tag, the tag will be saved in the clicked tag. See the blocks below.

P.S.: You may use ‘Contains’ block instead of ‘is in list?thing’ block.
Hope it helps. :slight_smile:

1 Like

Wow, thank you so much, I really appreciate that, it will definitely help me. :star_struck:

1 Like

Glad it helped you. :slight_smile:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.