Finalized resolver

This commit is contained in:
Simon Martens
2025-01-03 18:57:22 +01:00
parent e6a77ab557
commit 9ca2ebb75f
10 changed files with 225 additions and 64 deletions

View File

@@ -64,14 +64,17 @@ func AgentsView(letterorid string, lib *xmlmodels.Library) *AgentsListView {
// TODO: We won't need to lock the library if we take down the server during parsing
lib.Works.Lock()
for _, w := range lib.Works.Array {
if ref, ok := w.ReferencesAgent(letterorid); ok {
if entry, ok := res.Agents[ref.Ref]; ok {
entry.Works = append(entry.Works, WorkByAgent{Work: w, Reference: *ref})
res.Agents[ref.Ref] = entry
}
}
}
// for _, a := range res.Agents {
//
// }
// for _, w := range lib.Works.Array {
// if ref, ok := w.ReferencesAgent(letterorid); ok {
// if entry, ok := res.Agents[ref.Ref]; ok {
// entry.Works = append(entry.Works, WorkByAgent{Work: w, Reference: *ref})
// res.Agents[ref.Ref] = entry
// }
// }
// }
lib.Works.Unlock()
lib.Pieces.Lock()

View File

@@ -2,7 +2,6 @@ package viewmodels
import (
"fmt"
"log"
"maps"
"slices"
"sort"
@@ -33,7 +32,6 @@ func YearView(year int, lib *xmlmodels.Library) (*YearVM, error) {
lib.Issues.Lock()
for _, issue := range lib.Issues.Array {
log.Printf("Issue: %v", issue)
y := issue.Datum.When.Year
years[y] = true
if y == year {