jackpine / biketag-ios

http://biketag.jackpine.me
1 stars 1 forks source link

Authorize new spot creation #25

Open michaelkirk opened 9 years ago

michaelkirk commented 9 years ago

This only applies to adding the next spot to an existing game.

Spot creation needs to be authorized, such that only users who have successfully guessed the spot, within the time frame can create a new spot.

I am authorized to create a new spot if:

  1. I successfully guessed the current spot
  2. and am within my timeframe
  3. and in the meanwhile no one else has created a new spot for my game

So I get denied if I attempt to create a new spot for a game that I...

  1. ...didn't successfully guess the current spot,
  2. ...successfully guessed the current spot, but I run out of time
  3. ...successfully guessed the current spot, but in the meanwhile, someone else guessed the current spot and posted a new one.

This gets a little bit tricky, because there are potentially multiple people authorized to create a new spot at any given point.

Consider the case... player 1 owns the current spot... player 2 and player 3 capture that spot roughly at the same time. At this point, both player 2 and player 3 are authorized to create a new spot, but once either one of them has created the new spot, the other is no longer authorized.

We need to display coherent error messages to the iOS user in each of these cases.