doesExist method in the GuestRegistrySource class and the FirstFormFragment in the GuestDatabaseRegistration directory contains a logic error
License and Copyright Notice
By submitting this issue or commenting on this issue, or contributing any content to this issue, you certify under the Developer Certificate of Origin that the content you post may be licensed under GPLv3 (for code) or CC-BY-SA 4.0 International (for non-code content).
Summary
If an already existing user attempts to register again, the Guest Registration first form should prevent the user from continuing onto the following form and highlight the phone number and NCC ID input fields in red. It is not doing that since the doesExist method is returning false back to the FirstFormFragment. I believe this is happening because the doesExist is an asynchronous task and the main thread does not wait for the asynchronous task to finish to retrieve the values therefore, the default value of the boolean is being returned which in this case is false.
Steps to reproduce
- Go through the Guest Registration form and in the phone number and NCC ID input fields, put easy-to-remember values.
- Once successfully registered, attempt to register again with the same phone number and NCC ID.
- If the newly registered user was successfully added to the remote database when you input the same phone number and NCC ID, the app should give an error and say that the user is already registered.
- In the case of this bug, the form continues on as if the user was never registered.
What is the current bug behavior?
The registration form will continue without warning and will allow you to keep registering.
What is the expected correct behavior?
When entering an already existing user, the app should prevent you from going to the next registration form
Relevant logs and/or screenshots
(Paste any relevant logs - please use code blocks (```) to format console output, logs, and code, as it's very hard to read otherwise.)
Possible fixes
- Create an asynchronous task inside the FirstFormFragment that does the user checking and the rerouting.
- Let the doesExist method handle the rerouting once it obtains its response back from the remote database.
- Make the phone number and NCC ID unique in the remote database to prevent users to be registered twice.
Labels
(We have not finalized our list of labels, for now, include the labels you would like to include as a comment.