From a3a7c43bc619882d9556e97aa7136277d86cbf3b Mon Sep 17 00:00:00 2001 From: Andrea Fazzi Date: Tue, 29 Dec 2020 18:53:13 +0100 Subject: [PATCH] Add some log messaging for participant creation process --- orm/participant.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/orm/participant.go b/orm/participant.go index 5fd58a6c..24aa8b75 100644 --- a/orm/participant.go +++ b/orm/participant.go @@ -2,6 +2,7 @@ package orm import ( "fmt" + "log" "net/http" "strconv" @@ -186,6 +187,7 @@ func (model *Participant) Create(db *Database, args map[string]string, w http.Re } // Check if participant exists + log.Printf("Check if participant %s already exists", participant) if user, err := participant.exists(db); err == nil && user != nil { if err := db._db.Where("user_id = ?", user.ID).Find(&participant).Error; err != nil { return nil, err @@ -210,6 +212,7 @@ func (model *Participant) Create(db *Database, args map[string]string, w http.Re if err := db._db.First(&school, participant.SchoolID).Error; err != nil { return nil, err } + log.Printf("Check if a participant of the same category exists for school %s", school) hasCategory, err := school.HasCategory(db, participant) if err != nil { return nil, err @@ -221,6 +224,8 @@ func (model *Participant) Create(db *Database, args map[string]string, w http.Re WriteCreator(r, participant) + log.Printf("Create participant %s", participant) + participant, err = CreateParticipant(db, participant) if err != nil { return nil, err