Merge remote-tracking branch 'origin/main' into styling

This commit is contained in:
Johannes 2022-09-22 13:15:17 +02:00
commit 961a10915b
13 changed files with 193 additions and 74 deletions

View file

@ -2,6 +2,7 @@ package controllers
import (
"fmt"
"log"
"net/http"
"net/mail"
"officeHours/config"
@ -151,9 +152,16 @@ func (b *BaseHandler) AddOfficeHourHandler(w http.ResponseWriter, req *http.Requ
b.serveTemplate(w, "addFailure", err)
return
}
officeHour, _ = b.officeHourRepo.FindById(id)
b.requestRepo.Add(officeHour, models.RequestActivate)
officeHour, err = b.officeHourRepo.FindById(id)
if err != nil {
log.Printf("Error finding new office hour by id %d: %s", id, err.Error())
}
_, err = b.requestRepo.Add(officeHour, models.RequestActivate)
if err != nil {
log.Printf("Error adding request: %s", err.Error())
}
b.serveTemplate(w, "addSuccess", nil)
}
}