type mux ist jetzt privat

This commit is contained in:
Jason Streifling 2024-01-06 16:16:07 +01:00
parent 920c9b8ef3
commit 66f7179267

View File

@ -20,12 +20,12 @@ import (
"streifling.com/jason/sicherheitsunterweisung/packages/data" "streifling.com/jason/sicherheitsunterweisung/packages/data"
) )
type Mux struct { type mux struct {
*http.ServeMux *http.ServeMux
} }
func NewMux() *Mux { func NewMux() *mux {
return &Mux{ServeMux: http.NewServeMux()} return &mux{ServeMux: http.NewServeMux()}
} }
func getQuestions(db *data.DB, b *briefing) { func getQuestions(db *data.DB, b *briefing) {
@ -53,7 +53,7 @@ func getQuestions(db *data.DB, b *briefing) {
} }
} }
func (mux *Mux) handleParticipants(db *data.DB, cp <-chan *participant, b *briefing) { func (mux *mux) handleParticipants(db *data.DB, cp <-chan *participant, b *briefing) {
for p := range cp { for p := range cp {
p.givenAnswers = make([]int, len(b.questions)) p.givenAnswers = make([]int, len(b.questions))
@ -69,7 +69,7 @@ func (mux *Mux) handleParticipants(db *data.DB, cp <-chan *participant, b *brief
} }
} }
func (mux *Mux) handleBriefings(db *data.DB, cb <-chan *briefing, s *Session) { func (mux *mux) handleBriefings(db *data.DB, cb <-chan *briefing, s *Session) {
participantChan := make(chan *participant) participantChan := make(chan *participant)
for b := range cb { for b := range cb {
getQuestions(db, b) getQuestions(db, b)
@ -81,7 +81,7 @@ func (mux *Mux) handleBriefings(db *data.DB, cb <-chan *briefing, s *Session) {
} }
} }
func (mux *Mux) HandleSessions(db *data.DB, cs <-chan *Session, ss *[]*Session) { func (mux *mux) HandleSessions(db *data.DB, cs <-chan *Session, ss *[]*Session) {
briefingChan := make(chan *briefing) briefingChan := make(chan *briefing)
for s := range cs { for s := range cs {
(*ss) = append((*ss), s) (*ss) = append((*ss), s)