mirror of
https://github.com/Theodor-Springmann-Stiftung/kgpz_web.git
synced 2025-10-29 17:15:31 +00:00
Fonts + Only Pointers in sync.Maps
This commit is contained in:
@@ -8,6 +8,8 @@ import (
|
||||
|
||||
type AgentView struct {
|
||||
Agents []xmlprovider.Agent
|
||||
Works map[string][]xmlprovider.Work
|
||||
Pieces map[string][]xmlprovider.Piece
|
||||
}
|
||||
|
||||
func AgentsView(letterorid string, lib *xmlprovider.Library) *AgentView {
|
||||
@@ -21,5 +23,36 @@ func AgentsView(letterorid string, lib *xmlprovider.Library) *AgentView {
|
||||
return true
|
||||
})
|
||||
|
||||
res.Works = make(map[string][]xmlprovider.Work)
|
||||
res.Pieces = make(map[string][]xmlprovider.Piece)
|
||||
|
||||
lib.Works.Items.Range(func(key, value interface{}) bool {
|
||||
w := value.(xmlprovider.Work)
|
||||
for _, a := range res.Agents {
|
||||
if strings.HasPrefix(a.ID, letterorid) {
|
||||
_, ok := res.Works[a.ID]
|
||||
if !ok {
|
||||
res.Works[a.ID] = []xmlprovider.Work{}
|
||||
}
|
||||
res.Works[a.ID] = append(res.Works[a.ID], w)
|
||||
}
|
||||
}
|
||||
return true
|
||||
})
|
||||
|
||||
lib.Pieces.Items.Range(func(key, value interface{}) bool {
|
||||
p := value.(xmlprovider.Piece)
|
||||
for _, a := range res.Agents {
|
||||
if strings.HasPrefix(a.ID, letterorid) {
|
||||
_, ok := res.Pieces[a.ID]
|
||||
if !ok {
|
||||
res.Pieces[a.ID] = []xmlprovider.Piece{}
|
||||
}
|
||||
res.Pieces[a.ID] = append(res.Pieces[a.ID], p)
|
||||
}
|
||||
}
|
||||
return true
|
||||
})
|
||||
|
||||
return &res
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user