diff --git a/.gitignore b/.gitignore index 9d6f7ce..c464b21 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ tmp test.sql static/test.jpg +static/test.mp4 diff --git a/packages/session/handlerFuncs.go b/packages/session/handlerFuncs.go index 2b003a7..02169c2 100644 --- a/packages/session/handlerFuncs.go +++ b/packages/session/handlerFuncs.go @@ -155,16 +155,12 @@ func (s *Session) HandleParticipant(db *data.DB, p *BriefingParticipant) http.Ha log.Panicln(err) } - data := questionHTMLData{ - participantHTMLData: participantHTMLData{ - SessionID: s.ID, - BriefingParticipant: BriefingParticipant{Login: p.Login}, - }, - QuestionID: 1, - Question: s.Questions[0], + data := participantHTMLData{ + SessionID: s.ID, + BriefingParticipant: *p, } - template.Must(template.ParseFiles("templates/question.html")).ExecuteTemplate(w, "content", data) + template.Must(template.ParseFiles("templates/video.html")).ExecuteTemplate(w, "content", data) } } @@ -272,3 +268,18 @@ func (s *Session) HandleBriefingDone() http.HandlerFunc { template.Must(template.ParseFiles("templates/login.html")).ExecuteTemplate(w, "content", nil) } } + +func (s *Session) HandleEndOfVideo(p *BriefingParticipant) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + data := questionHTMLData{ + participantHTMLData: participantHTMLData{ + SessionID: s.ID, + BriefingParticipant: BriefingParticipant{Login: p.Login}, + }, + QuestionID: 1, + Question: s.Questions[0], + } + + template.Must(template.ParseFiles("templates/question.html")).ExecuteTemplate(w, "content", data) + } +} diff --git a/packages/session/helperFuncs.go b/packages/session/helperFuncs.go index efa6e2d..29841e4 100644 --- a/packages/session/helperFuncs.go +++ b/packages/session/helperFuncs.go @@ -66,7 +66,7 @@ func handleGivenAnswer(p *BriefingParticipant, i int64, r *http.Request) error { return nil } -func makeHTMLQuestions(sq []data.Question, givenAnswers []int) []resultQuestion { +func makeResultQuestions(sq []data.Question, givenAnswers []int) []resultQuestion { questions := make([]resultQuestion, len(sq)) for i, q := range sq { questions[i].Text = q.Text diff --git a/packages/session/muxFuncs.go b/packages/session/muxFuncs.go index 86ed91a..ff27418 100644 --- a/packages/session/muxFuncs.go +++ b/packages/session/muxFuncs.go @@ -23,6 +23,7 @@ func (mux *Mux) handleParticipants(db *data.DB, cp <-chan *BriefingParticipant, p.GivenAnswers = make([]int, len(s.Questions)) mux.HandleFunc("/submit-participant/"+fmt.Sprint(s.ID)+"/"+fmt.Sprint(p.Login)+"/", s.HandleParticipant(db, p)) + mux.HandleFunc("/end-video/"+fmt.Sprint(s.ID)+"/"+fmt.Sprint(p.Login)+"/", s.HandleEndOfVideo(p)) var i int for i = range s.Questions { mux.HandleFunc("/submit-answer/"+fmt.Sprint(s.ID)+"/"+fmt.Sprint(p.Login)+"/"+fmt.Sprint(i+1)+"/", s.HandleAnswer(db, p, int64(i+1))) diff --git a/templates/video.html b/templates/video.html new file mode 100644 index 0000000..f81c2c9 --- /dev/null +++ b/templates/video.html @@ -0,0 +1,6 @@ +{{define "content"}} + + +{{end}}