diff --git a/orm/participant.go b/orm/participant.go index 3f4d45ba..ee5503bc 100644 --- a/orm/participant.go +++ b/orm/participant.go @@ -111,11 +111,11 @@ func (model *Participant) exists(db *Database) (*User, error) { if err := db._db.First(&user, &User{Username: model.username()}).Error; err != nil && err != gorm.ErrRecordNotFound { return nil, err } else if err == gorm.ErrRecordNotFound { - log.Printf("User %s doesn't exist", user) + log.Printf("User %s doesn't exist", user.Username) return nil, nil } - log.Printf("User %s exists", user) + log.Printf("User %s exists", user.Username) return &user, nil } @@ -219,7 +219,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) + log.Printf("Check if a participant of the same category exists for school %s", school.Name) hasCategory, err := school.HasCategory(db, participant) if err != nil { return nil, err @@ -321,6 +321,7 @@ func (model *Participant) ReadAll(db *Database, args map[string]string, w http.R } if err := db._db. Preload("Category"). + Preload("School.Region"). Preload("School"). Preload("Contests"). Order("lastname"). diff --git a/orm/school.go b/orm/school.go index 8a01c730..be54419a 100644 --- a/orm/school.go +++ b/orm/school.go @@ -69,8 +69,8 @@ type School struct { SelectedRegion map[uint]string `gorm:"-"` AllRegions []*Region `gorm:"-"` - CaptchaID string `gorm:"-",schema:"-"` - CaptchaSolution string `gorm:"-",schema:"-"` + CaptchaID string `gorm:"-" schema:"-"` + CaptchaSolution string `gorm:"-" schema:"-"` mailSender *mail.MailSender } diff --git a/scripts/export_participants/.gitignore b/scripts/export_participants/.gitignore index 3ebacd69..0d7693a7 100644 --- a/scripts/export_participants/.gitignore +++ b/scripts/export_participants/.gitignore @@ -1,2 +1,4 @@ *.csv -*.xlsx \ No newline at end of file +*.xlsx +export_participants +