participant.go aufgeräumt
This commit is contained in:
parent
ea62e1dac1
commit
c1fa004384
@ -29,27 +29,6 @@ type Participant struct {
|
|||||||
AllowRetry bool
|
AllowRetry bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Participant) HandleParticipant(db *data.DB, b *Briefing) http.HandlerFunc {
|
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
|
||||||
p.FirstName = r.PostFormValue("first-" + fmt.Sprint(p.Login))
|
|
||||||
p.LastName = r.PostFormValue("last-" + fmt.Sprint(p.Login))
|
|
||||||
p.Company = r.PostFormValue("company-" + fmt.Sprint(p.Login))
|
|
||||||
|
|
||||||
err := db.WriteParticipant(p.Participant)
|
|
||||||
if err != nil {
|
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
log.Panicln(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
data := participantHTMLData{
|
|
||||||
BriefingID: b.UUID,
|
|
||||||
Participant: *p,
|
|
||||||
}
|
|
||||||
|
|
||||||
template.Must(template.ParseFiles("templates/video.html")).ExecuteTemplate(w, "content", data)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func handleGivenAnswer(p *Participant, i int64, r *http.Request) error {
|
func handleGivenAnswer(p *Participant, i int64, r *http.Request) error {
|
||||||
answer, err := strconv.Atoi(r.PostFormValue("answer"))
|
answer, err := strconv.Atoi(r.PostFormValue("answer"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -88,6 +67,27 @@ func makeResultQuestions(sq []data.Question, givenAnswers []int) []resultQuestio
|
|||||||
return questions
|
return questions
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *Participant) HandleParticipant(db *data.DB, b *Briefing) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
p.FirstName = r.PostFormValue("first-" + fmt.Sprint(p.Login))
|
||||||
|
p.LastName = r.PostFormValue("last-" + fmt.Sprint(p.Login))
|
||||||
|
p.Company = r.PostFormValue("company-" + fmt.Sprint(p.Login))
|
||||||
|
|
||||||
|
err := db.WriteParticipant(p.Participant)
|
||||||
|
if err != nil {
|
||||||
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
log.Panicln(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
data := participantHTMLData{
|
||||||
|
BriefingID: b.UUID,
|
||||||
|
Participant: *p,
|
||||||
|
}
|
||||||
|
|
||||||
|
template.Must(template.ParseFiles("templates/video.html")).ExecuteTemplate(w, "content", data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (p *Participant) HandleAnswer(db *data.DB, b *Briefing, i int64) http.HandlerFunc {
|
func (p *Participant) HandleAnswer(db *data.DB, b *Briefing, i int64) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
if i < int64(len(b.Questions)) {
|
if i < int64(len(b.Questions)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user