Em-Ant / fcc-options-app

Options Inc. web app development
Other
12 stars 7 forks source link

Adding identical consumer to 2 vehicles doesn't give an error #23

Closed andrealonzo closed 8 years ago

andrealonzo commented 8 years ago

I see that if you open 2 browsers and try to add the same consumer to 2 different vehicles, the consumer is added to the last vehicle, and removed from the 1st vehicle.

If the consumer is already on a vehicle, I think there should be an error when trying to add the consumer to another vehicle. What do you think @Em-Ant?

Em-Ant commented 8 years ago

true. Now the server handler removes the user inserted from all other vehicles. How do we know if the consumer is on a vehicle, on server ?

andrealonzo commented 8 years ago

Right now the server is removing the consumer from all vehicles before assigning. I think this query can be changed to check if the consumer is on any vehicle. If so, then return an error, otherwise continue with the update.

Em-Ant commented 8 years ago

Fixed with b7b3acc