|
|
|
|
@ -98,7 +98,7 @@ func Heats(groups []models.Group, selectedGroupID int64, db *db.DB) templ.Compon
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
if selectedGroupID > 0 {
|
|
|
|
|
templ_7745c5c3_Err = HeatsContent([]models.Heat{}, []models.Racer{}).Render(ctx, templ_7745c5c3_Buffer)
|
|
|
|
|
templ_7745c5c3_Err = HeatsContent([]models.Heat{}, []models.Racer{}, selectedGroupID).Render(ctx, templ_7745c5c3_Buffer)
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
@ -117,7 +117,7 @@ func Heats(groups []models.Group, selectedGroupID int64, db *db.DB) templ.Compon
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func HeatsContent(heats []models.Heat, racers []models.Racer) templ.Component {
|
|
|
|
|
func HeatsContent(heats []models.Heat, racers []models.Racer, groupID int64) templ.Component {
|
|
|
|
|
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
|
|
|
|
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
|
|
|
|
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
|
|
|
|
@ -167,9 +167,9 @@ func HeatsContent(heats []models.Heat, racers []models.Racer) templ.Component {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
var templ_7745c5c3_Var7 string
|
|
|
|
|
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(getRacerName(racers, *heat.Lane1ID))
|
|
|
|
|
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(getRacerName(racers, heat.Lane1ID))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `web/templates/heats.templ`, Line: 72, Col: 48}
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `web/templates/heats.templ`, Line: 72, Col: 47}
|
|
|
|
|
}
|
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
@ -180,9 +180,9 @@ func HeatsContent(heats []models.Heat, racers []models.Racer) templ.Component {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
var templ_7745c5c3_Var8 string
|
|
|
|
|
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(getRacerName(racers, *heat.Lane2ID))
|
|
|
|
|
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(getRacerName(racers, heat.Lane2ID))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `web/templates/heats.templ`, Line: 73, Col: 48}
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `web/templates/heats.templ`, Line: 73, Col: 47}
|
|
|
|
|
}
|
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
@ -193,9 +193,9 @@ func HeatsContent(heats []models.Heat, racers []models.Racer) templ.Component {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
var templ_7745c5c3_Var9 string
|
|
|
|
|
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(getRacerName(racers, *heat.Lane3ID))
|
|
|
|
|
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(getRacerName(racers, heat.Lane3ID))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `web/templates/heats.templ`, Line: 74, Col: 48}
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `web/templates/heats.templ`, Line: 74, Col: 47}
|
|
|
|
|
}
|
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
@ -206,9 +206,9 @@ func HeatsContent(heats []models.Heat, racers []models.Racer) templ.Component {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
var templ_7745c5c3_Var10 string
|
|
|
|
|
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(getRacerName(racers, *heat.Lane4ID))
|
|
|
|
|
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(getRacerName(racers, heat.Lane4ID))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `web/templates/heats.templ`, Line: 75, Col: 48}
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `web/templates/heats.templ`, Line: 75, Col: 47}
|
|
|
|
|
}
|
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
@ -232,20 +232,7 @@ func HeatsContent(heats []models.Heat, racers []models.Racer) templ.Component {
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "\" hx-target=\"#heats-list\" hx-swap=\"innerHTML\">Regenerate Heats</button> <button class=\"btn btn-success\" hx-post=\"")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
var templ_7745c5c3_Var12 string
|
|
|
|
|
templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs("/api/heats/save?group_id=" + strconv.FormatInt(groupID, 10))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `web/templates/heats.templ`, Line: 92, Col: 90}
|
|
|
|
|
}
|
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "\" hx-target=\"#save-status\">Save Heats</button></div></div>")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "\" hx-target=\"#heats-list\" hx-swap=\"innerHTML\">Regenerate Heats</button></div></div>")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
@ -254,9 +241,9 @@ func HeatsContent(heats []models.Heat, racers []models.Racer) templ.Component {
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func getRacerName(racers []models.Racer, id int64) string {
|
|
|
|
|
func getRacerName(racers []models.Racer, id *int64) string {
|
|
|
|
|
for _, r := range racers {
|
|
|
|
|
if r.ID == id {
|
|
|
|
|
if id != nil && r.ID == *id {
|
|
|
|
|
return r.FirstName + " " + r.LastName
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|