Open garyhtou opened 3 years ago
With the current way the chapter join code generation and saving works, I think there is a potential for a chapter to "go missing".
If two users were to create a chapter at the same time, this could happen:
codeList
codeList = ["12345", "67890", "13579"];
randomCode = "16323";
codeList_in_firestore = ["12345", "67890", "13579", "16323];
randomCode = "15926";
codeList_in_firestore = ["12345", "67890", "13579", "15926];
User 2 pushing their codeList to firestore will override any codes generated by other users between the time User 2 gets the list and sets the list.
Although it is unlikely that it would happen, it is possible.
https://github.com/garytou2/FBLA-App/blob/2d55882f8ac601c112d064364d843f0b766b199e/screens/CreateChapScreen.js#L85-L126
With the current way the chapter join code generation and saving works, I think there is a potential for a chapter to "go missing".
If two users were to create a chapter at the same time, this could happen:
codeList
from firestorecodeList = ["12345", "67890", "13579"];
codeList
from firestorecodeList = ["12345", "67890", "13579"];
codeList
to firestorerandomCode = "16323";
codeList_in_firestore = ["12345", "67890", "13579", "16323];
codeList
to firestorerandomCode = "15926";
codeList_in_firestore = ["12345", "67890", "13579", "15926];
User 2 pushing their
codeList
to firestore will override any codes generated by other users between the time User 2 gets the list and sets the list.Although it is unlikely that it would happen, it is possible.