Hey,
I want to achieve a lottery game where each user can take X ticket (= chances to win)
So I would like at the end of the lottery to pick a random user, how would you do that?
The only idea I have in mind is to add X time the ID of the user in the lottery database were X is the number of tickets but how can I schedule an API workflow on a list with the same element * X ?
Also, it will be performance consuming…
Instead of letting users ‘take a ticket’, you create an entry to represent each user’s ticket in the system.
So you can create a data type called Entry, with a User data type, a ‘lottery draw’ type to identify which lottery it is. Each time a user ‘buys a ticket’, you create a new Entry.
Then you can schedule an API workflow that does a search of the Entries with the specific draw type, and use random item function to choose the winner.