I created a voting app, to be counting number of voters, but when 2 users click at the same time, it will count them as 1 instead to count 1 by 1, what can I do
The answer depends on the shared data base.
The general way around the shared update problem is to turn updates into list inserts, like this database structure:
- Supreme Commander votes
- candidates
- ABG
- voters
- ABG (yes, I voted for myself)
- Dckings
- voters
- Dckings
- voters
- Dckings
- voters
- ABG
- candidates
There's no privacy here, and it is up to the app to make sure no one votes for the same office twice.
2 Likes