Skip to content
This repository has been archived by the owner on Jul 11, 2019. It is now read-only.

It is possible to create user badge assignments multiple times #921

Open
nidico opened this issue Jun 22, 2014 · 1 comment
Open

It is possible to create user badge assignments multiple times #921

nidico opened this issue Jun 22, 2014 · 1 comment
Labels

Comments

@nidico
Copy link
Collaborator

nidico commented Jun 22, 2014

If users double-click on submit in the user badge form, they may create user (and probably others too) badge assignments multiple times. Afterwards this badge can't be deleted anymore, as SQLAlchemy will then complain:

WebApp Error: <class 'sqlalchemy.orm.exc.StaleDataError'>: DELETE statement on table 'user_badges' expected to delete 1 row(s); Only 3 were matched.

How to fix? Possibilities:

  1. Not allow double clicks through Javascript. This is useful in other submits as well (comments etc.). It doesn't prevent that issue from happening if users want to force it.
  2. Add UNIQUE constraints to the xx_badges tables. This avoids that multiple processes add badges concurrently.
  3. Deal with it, i.e. accept that badges exist multiple times. Make sure all of them are deleted when they're supposed to. This might not be easily possible without changing the ORM configuration.

If (3) isn't realized, the existing problems need to be fixed on database level manually.

@nidico nidico added the bug label Jun 22, 2014
@xi
Copy link
Collaborator

xi commented Jun 23, 2014

Option (1) has been implemented in #925. I would like (3) to be implemented so I will leave this open.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants