Ranking with database change

Hi, I’m not able to insert order numbers into the database to rank users. It is an auction system where whoever gives the highest value receives number 1, that is, first position, whoever gives the second highest value receives number 2, that is, second position. In the logic I set up, the value is always being entered the same, that is, number 1 for all users, as shown in the image. Exhausted my attempts, someone help me please. Thank you very much.

Not abusing, then, the system needs to identify who has undergone a ranking change to a lower position and send an email to that user.



3

Why not simply rank them by the value they are offering? I assume that is a number value right?

Regarding the email to users who’s ranks dropped, I would put that in a DB Trigger event on backend workflows with a conditional saying if user before change's rank > user now's rank -> send an email. This would be independent of your ranking logic.

Coming to the ranking logic itself, it looks like your rank = search for categorias:count + 1 statement assigns the same value to all the Categorias that you’re changing on a list. In the rank = search for categorias:count + 1 statement, you can modify the details of the search for categorias constraint to something like Valor_atual > this Categoria's valor_atual - I think this statement should probably reference the Categoria being iterated on, otherwise you’ll be putting a static value on all your Categorias’ rank fields.


Cheers,
Ranjit from Atomic Fusion

Explore and reuse the community’s Bubble assets & Accelerate your Bubble development with Atomic Fusion

2 Likes

You are amazing. It worked. Thank you very very much.

But another problem arose, but I’m trying to solve it, if I can’t, I’ll come back here.

1 Like

Amazing :slight_smile:

All the best!

1 Like

I really can’t solve this problem. The ranking takes place for those who bid and have current value > 0. For those who did not bid, current value =0, the system is changing to the same ranking number, making them equal.
1
2

Hi @contato23 ,

Are you trying to create proxy bidding (automatic bidding) system?

Why do you need to record their rank in the database? Technically, if you have the bid amount value recorded, then you can always sort it by the highest value to lowest (decrement) when you need to use it - say when you are showing the bids or selecting the winner.

1 Like

Greetings friend. So, the only need to register the rank in the database is because in the back-end workflow the system needs to identify who changes rank (to a lower number) and sends an automatic email to that person.