mirror of
https://github.com/Theodor-Springmann-Stiftung/kgpz_web.git
synced 2025-12-15 11:35:30 +00:00
BUGFIX: no more empty array elements
This commit is contained in:
@@ -72,7 +72,7 @@ func NewXMLProvider[T XMLItem]() *XMLProvider[T] {
|
|||||||
func (p *XMLProvider[T]) Prepare() {
|
func (p *XMLProvider[T]) Prepare() {
|
||||||
p.mu.Lock()
|
p.mu.Lock()
|
||||||
defer p.mu.Unlock()
|
defer p.mu.Unlock()
|
||||||
p.Array = make([]T, 1000)
|
p.Array = make([]T, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *XMLProvider[T]) Serialize(dataholder XMLRootElement[T], path string, latest ParseMeta) error {
|
func (p *XMLProvider[T]) Serialize(dataholder XMLRootElement[T], path string, latest ParseMeta) error {
|
||||||
@@ -94,13 +94,13 @@ func (p *XMLProvider[T]) Serialize(dataholder XMLRootElement[T], path string, la
|
|||||||
}
|
}
|
||||||
|
|
||||||
// INFO: If the item has a GetReferences method, we add the references to the resolver.
|
// INFO: If the item has a GetReferences method, we add the references to the resolver.
|
||||||
if refResolver, ok := any(item).(ReferenceResolver); ok {
|
// if refResolver, ok := any(item).(ReferenceResolver); ok {
|
||||||
for name, ids := range refResolver.GetReferences() {
|
// for name, ids := range refResolver.GetReferences() {
|
||||||
for _, id := range ids {
|
// for _, id := range ids {
|
||||||
p.Resolver.Add(name, id, &item)
|
// p.Resolver.Add(name, id, &item)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
p.Array = append(p.Array, newItems...)
|
p.Array = append(p.Array, newItems...)
|
||||||
@@ -168,6 +168,9 @@ func (a *XMLProvider[T]) String() string {
|
|||||||
s += v.String()
|
s += v.String()
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
|
for _, item := range a.Array {
|
||||||
|
s += item.String()
|
||||||
|
}
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,10 +33,8 @@ func YearView(year int, lib *xmlmodels.Library) (*YearVM, error) {
|
|||||||
|
|
||||||
lib.Issues.Lock()
|
lib.Issues.Lock()
|
||||||
for _, issue := range lib.Issues.Array {
|
for _, issue := range lib.Issues.Array {
|
||||||
|
log.Printf("Issue: %v", issue)
|
||||||
y := issue.Datum.When.Year
|
y := issue.Datum.When.Year
|
||||||
if y == 0 {
|
|
||||||
log.Println("Issue has no year: ", issue.String())
|
|
||||||
}
|
|
||||||
years[y] = true
|
years[y] = true
|
||||||
if y == year {
|
if y == year {
|
||||||
functions.MapArrayInsert(issues, issue.Datum.When.Month, issue)
|
functions.MapArrayInsert(issues, issue.Datum.When.Month, issue)
|
||||||
|
|||||||
Reference in New Issue
Block a user