Closed GaryA closed 8 years ago
Add a lock to the online database: Set when a user downloads a copy of the database and sets an event into the "Closed" state. Clear by the mysql upload that adds the event results to the online database.
If the database is locked, prevent new users or new robots from being created. The offline database is never locked, but it needs the lock table and record (unlocked) as part of the download.
The local database may have users and robots added to it, as well as entrants signed up to an event and fight results added. At the same time users and robots may be created online, potentially taking the same IDs as the ones added locally. When the event results are uploaded there is a clash of IDs and the records added online are modified by the data added locally. There is no automatic backup of the database before applying the updates!
At the very least the database/tables need to be backed up before the changes are applied.
Ideally there would be some mechanism for detecting clashes and handling them intelligently.
Preventing users from changing usernames locally would allow team names to change but also allow duplicate IDs to be checked for duplicate usernames. A similar restriction on robot changes might work too.