Compare commits
2 Commits
920c9b8ef3
...
b4d453b108
Author | SHA1 | Date | |
---|---|---|---|
b4d453b108 | |||
66f7179267 |
@ -18,38 +18,38 @@ type DB struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Person struct {
|
type Person struct {
|
||||||
ID int64
|
|
||||||
FirstName string
|
FirstName string
|
||||||
LastName string
|
LastName string
|
||||||
|
ID int64
|
||||||
}
|
}
|
||||||
|
|
||||||
type Instructor Person
|
type Instructor Person
|
||||||
|
|
||||||
type Participant struct {
|
type Participant struct {
|
||||||
Person
|
|
||||||
Company string
|
Company string
|
||||||
|
Person
|
||||||
}
|
}
|
||||||
|
|
||||||
type Briefing struct {
|
type Briefing struct {
|
||||||
ID int64
|
|
||||||
DateTime string
|
DateTime string
|
||||||
Location string
|
Location string
|
||||||
Document string
|
Document string
|
||||||
AsOf string
|
AsOf string
|
||||||
InstructorID int64
|
InstructorID int64
|
||||||
|
ID int64
|
||||||
}
|
}
|
||||||
|
|
||||||
type Answer struct {
|
type Answer struct {
|
||||||
ID int64
|
|
||||||
Text string
|
Text string
|
||||||
IsImage bool // TODO: relocate to sessionStructs if possible
|
IsImage bool // TODO: relocate to sessionStructs if possible
|
||||||
|
ID int64
|
||||||
}
|
}
|
||||||
|
|
||||||
type Question struct {
|
type Question struct {
|
||||||
ID int64
|
|
||||||
Text string
|
Text string
|
||||||
Answers []Answer
|
Answers []Answer
|
||||||
Correct int
|
Correct int
|
||||||
|
ID int64
|
||||||
}
|
}
|
||||||
|
|
||||||
type GivenAnswer struct {
|
type GivenAnswer struct {
|
||||||
|
@ -26,9 +26,9 @@ import (
|
|||||||
|
|
||||||
type briefing struct {
|
type briefing struct {
|
||||||
*data.Briefing
|
*data.Briefing
|
||||||
uuid uuid.UUID
|
|
||||||
participants []*participant
|
participants []*participant
|
||||||
questions []data.Question
|
questions []data.Question
|
||||||
|
uuid uuid.UUID
|
||||||
}
|
}
|
||||||
|
|
||||||
func generateLogin() (string, error) {
|
func generateLogin() (string, error) {
|
||||||
|
@ -17,27 +17,27 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type tableHTMLData struct {
|
type tableHTMLData struct {
|
||||||
sessionID uuid.UUID
|
|
||||||
otd []data.OverviewTableData
|
otd []data.OverviewTableData
|
||||||
|
sessionID uuid.UUID
|
||||||
}
|
}
|
||||||
|
|
||||||
type participantHTMLData struct {
|
type participantHTMLData struct {
|
||||||
briefingID uuid.UUID
|
|
||||||
participant
|
participant
|
||||||
|
briefingID uuid.UUID
|
||||||
}
|
}
|
||||||
|
|
||||||
type questionHTMLData struct {
|
type questionHTMLData struct {
|
||||||
|
question data.Question
|
||||||
participantHTMLData
|
participantHTMLData
|
||||||
questionID int64
|
questionID int64
|
||||||
question data.Question
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type resultAnswer struct {
|
type resultAnswer struct {
|
||||||
id int64
|
|
||||||
text string
|
text string
|
||||||
correct bool
|
correct bool
|
||||||
chosen bool
|
chosen bool
|
||||||
isImage bool // TODO: relocate to sessionStructs if possible
|
isImage bool // TODO: relocate to sessionStructs if possible
|
||||||
|
id int64
|
||||||
}
|
}
|
||||||
|
|
||||||
type resultQuestion struct {
|
type resultQuestion struct {
|
||||||
@ -46,12 +46,12 @@ type resultQuestion struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type resultHTMLData struct {
|
type resultHTMLData struct {
|
||||||
participantHTMLData
|
|
||||||
questions []resultQuestion
|
questions []resultQuestion
|
||||||
|
participantHTMLData
|
||||||
}
|
}
|
||||||
|
|
||||||
type summaryHTMLData struct {
|
type summaryHTMLData struct {
|
||||||
|
participantsData []participantHTMLData
|
||||||
sessionID uuid.UUID
|
sessionID uuid.UUID
|
||||||
briefingID uuid.UUID
|
briefingID uuid.UUID
|
||||||
participantsData []participantHTMLData
|
|
||||||
}
|
}
|
||||||
|
@ -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)
|
||||||
|
@ -21,9 +21,9 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Session struct {
|
type Session struct {
|
||||||
uuid uuid.UUID
|
|
||||||
instructor data.Instructor
|
instructor data.Instructor
|
||||||
briefings []*briefing
|
briefings []*briefing
|
||||||
|
uuid uuid.UUID
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Session) handleSearch(db *data.DB) http.HandlerFunc {
|
func (s *Session) handleSearch(db *data.DB) http.HandlerFunc {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user