Compare commits

...

2 Commits

5 changed files with 19 additions and 19 deletions

View File

@ -18,38 +18,38 @@ type DB struct {
}
type Person struct {
ID int64
FirstName string
LastName string
ID int64
}
type Instructor Person
type Participant struct {
Person
Company string
Person
}
type Briefing struct {
ID int64
DateTime string
Location string
Document string
AsOf string
InstructorID int64
ID int64
}
type Answer struct {
ID int64
Text string
IsImage bool // TODO: relocate to sessionStructs if possible
ID int64
}
type Question struct {
ID int64
Text string
Answers []Answer
Correct int
ID int64
}
type GivenAnswer struct {

View File

@ -26,9 +26,9 @@ import (
type briefing struct {
*data.Briefing
uuid uuid.UUID
participants []*participant
questions []data.Question
uuid uuid.UUID
}
func generateLogin() (string, error) {

View File

@ -17,27 +17,27 @@ import (
)
type tableHTMLData struct {
sessionID uuid.UUID
otd []data.OverviewTableData
sessionID uuid.UUID
}
type participantHTMLData struct {
briefingID uuid.UUID
participant
briefingID uuid.UUID
}
type questionHTMLData struct {
question data.Question
participantHTMLData
questionID int64
question data.Question
}
type resultAnswer struct {
id int64
text string
correct bool
chosen bool
isImage bool // TODO: relocate to sessionStructs if possible
id int64
}
type resultQuestion struct {
@ -46,12 +46,12 @@ type resultQuestion struct {
}
type resultHTMLData struct {
participantHTMLData
questions []resultQuestion
participantHTMLData
}
type summaryHTMLData struct {
participantsData []participantHTMLData
sessionID uuid.UUID
briefingID uuid.UUID
participantsData []participantHTMLData
}

View File

@ -20,12 +20,12 @@ import (
"streifling.com/jason/sicherheitsunterweisung/packages/data"
)
type Mux struct {
type mux struct {
*http.ServeMux
}
func NewMux() *Mux {
return &Mux{ServeMux: http.NewServeMux()}
func NewMux() *mux {
return &mux{ServeMux: http.NewServeMux()}
}
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 {
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)
for b := range cb {
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)
for s := range cs {
(*ss) = append((*ss), s)

View File

@ -21,9 +21,9 @@ import (
)
type Session struct {
uuid uuid.UUID
instructor data.Instructor
briefings []*briefing
uuid uuid.UUID
}
func (s *Session) handleSearch(db *data.DB) http.HandlerFunc {