29 lines
491 B
Go
29 lines
491 B
Go
package web
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"pool-stats/database"
|
|
"pool-stats/models"
|
|
)
|
|
|
|
type IndexPageData struct {
|
|
PageDataBase
|
|
|
|
Stats []models.TimeWindowHighShare
|
|
}
|
|
|
|
func (ws *WebServer) IndexHandler(w http.ResponseWriter, r *http.Request) {
|
|
tws := database.GetTimeWindowHighShares(ws.db)
|
|
if tws == nil {
|
|
http.Error(w, "Failed to load time window high shares", 500)
|
|
return
|
|
}
|
|
|
|
indexData := IndexPageData{
|
|
Stats: tws,
|
|
}
|
|
|
|
ws.renderTemplate(w, r, "templates/index.html", &indexData)
|
|
}
|