BUGFIX: annoyances when editing a almanach

This commit is contained in:
Simon Martens
2026-01-09 22:04:00 +01:00
parent 65f83aa6a6
commit 22b303dc72
13 changed files with 657 additions and 403 deletions

View File

@@ -43,8 +43,28 @@ func (p *OrtePage) Setup(router *router.Router[*core.RequestEvent], app core.App
if len(places) > 0 {
dbmodels.Sort_Places_Name(places)
}
// Get place IDs for counting
ids := []any{}
for _, p := range places {
ids = append(ids, p.Id)
}
// Count linked Bände for each place
bcount := map[string]int{}
if len(ids) > 0 {
count, err := dbmodels.CountPlacesBaende(app, ids)
if err != nil {
app.Logger().Error("Error counting places", "error", err)
} else {
bcount = count
app.Logger().Info("Place counts", "bcount", bcount, "total_places", len(ids))
}
}
data := map[string]any{
"result": &OrteResult{Places: places},
"bcount": bcount,
}
return engine.Response200(e, p.Template, data, p.Layout)
})