Minor updates and comments

This commit is contained in:
SowinskiBraeden committed 2021-10-13 09:20:19 -07:00
1 parent ff65d9eadc
commit 0a95f847d4
5 files changed
+14 -3

No files matched your search

+1
View File
@@ -170,6 +170,7 @@ func RegisterTeacher(c *fiber.Ctx) error {
// Send teacher personal email temp password
var tid string
// For the unlikely event that an ID is already in use this will simply try again till it gets a id not in use
for {
tid = GenerateID()
isValid := ValidateID(tid)
+1 -1
View File
@@ -22,7 +22,7 @@ func ValidateID(id string) bool { // true: valid id, false: id already in use
var foundID models.Id
err := idCollection.FindOne(ctx, bson.M{"cid": id}).Decode(&foundID)
cancel()
if err != nil {
if err != nil { // If there is no id found create new ID object to be stored and return true (unless insert error then try again)
var newID models.Id
newID.CID = id
newID.ID = primitive.NewObjectID()