feat: initial commit

This commit is contained in:
2025-06-16 00:07:03 +02:00
parent d93ed20869
commit a6d5cb50f2
26 changed files with 10870 additions and 156 deletions

View File

@ -14,6 +14,7 @@ type Handler struct {
playInterval time.Duration
playPeriod timex.PeriodType
playDelay time.Duration
offDays []time.Weekday
}
// ServeHTTP implements http.Handler.
@ -21,13 +22,14 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
h.mux.ServeHTTP(w, r)
}
func NewHandler(store *store.Store, playInterval time.Duration, playPeriod timex.PeriodType, playDelay time.Duration) *Handler {
func NewHandler(store *store.Store, playInterval time.Duration, playPeriod timex.PeriodType, playDelay time.Duration, offDays []time.Weekday) *Handler {
h := &Handler{
mux: http.NewServeMux(),
store: store,
playInterval: playInterval,
playPeriod: playPeriod,
playDelay: playDelay,
offDays: offDays,
}
h.mux.HandleFunc("GET /", h.getQuizPage)
@ -35,6 +37,7 @@ func NewHandler(store *store.Store, playInterval time.Duration, playPeriod timex
h.mux.HandleFunc("POST /select", h.handleSelectEntryForm)
h.mux.HandleFunc("POST /answer", h.handleAnswerForm)
h.mux.HandleFunc("GET /result", h.getResultPage)
h.mux.HandleFunc("GET /history", h.getHistoryPage)
return h
}