mirror of
https://github.com/Theodor-Springmann-Stiftung/musenalm.git
synced 2026-02-04 10:35:30 +00:00
BUGFIX: annoyances when editing a almanach
This commit is contained in:
@@ -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)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user