refactor(collections): rule evaluators take the real row; both 45-field converter twins deleted
checkRulesAgainstBook/evaluateRule and the service's EvaluateRules existed in two parallel universes: one over database.MediaItems (what every query actually returns) and one over ListMediaItemsRow (what two hand-written 45-field mediaItemsToListMediaItemsRow converters produced — verbatim twins in the handler and the dashboard service, with a URL-resolution side effect baked into a "converter"). The rule fields (genre/series/author/language/publisher/copyright_year/tags) all exist on MediaItems, so the evaluators now take the real row and the converters, their three call-site loops, and the dead ApplyAutoAssignRules entry point (zero callers) are gone. The rules surface is wire-covered by the collections rules scenarios; handlers+services suites and the full pin/H1/H3 battery green.
This commit is contained in:
1 parent
b47a2b86a7
commit
18727fef93
7 files changed
+54
-193
No files matched your search
@@ -561,9 +561,9 @@ type UsageItemStats struct {
|
||||
Title string `json:"title"`
|
||||
Author string `json:"author"`
|
||||
CoverImage string `json:"cover_image_path"`
|
||||
Seconds float64 `json:"seconds"` // audio duration (0 unless hours_mode)
|
||||
PageCount int `json:"pages"` // text pages (0 unless !hours_mode)
|
||||
SizeBytes int64 `json:"size"` // always set, both modes
|
||||
Seconds float64 `json:"seconds"` // audio duration (0 unless hours_mode)
|
||||
PageCount int `json:"pages"` // text pages (0 unless !hours_mode)
|
||||
SizeBytes int64 `json:"size"` // always set, both modes
|
||||
}
|
||||
|
||||
// LibraryUsageStats is the whole tab payload for one scope: "" LibraryID
|
||||
@@ -573,18 +573,18 @@ type UsageItemStats struct {
|
||||
// text pages. TotalSeconds/TotalPages both always carry their sums so
|
||||
// the client never has to infer.
|
||||
type LibraryUsageStats struct {
|
||||
LibraryID string `json:"library_id"`
|
||||
Items int `json:"items"`
|
||||
Authors int `json:"authors"`
|
||||
Narrators int `json:"narrators"`
|
||||
TotalSizeBytes int64 `json:"total_size_bytes"`
|
||||
TotalSeconds int64 `json:"total_seconds"`
|
||||
TotalPages int `json:"total_pages"`
|
||||
HoursMode bool `json:"hours_mode"`
|
||||
Genres []NameCountStats `json:"genres"`
|
||||
AuthorsTop []NameCountStats `json:"top_authors"`
|
||||
LongestItems []UsageItemStats `json:"longest_items"`
|
||||
LargestItems []UsageItemStats `json:"largest_items"`
|
||||
LibraryID string `json:"library_id"`
|
||||
Items int `json:"items"`
|
||||
Authors int `json:"authors"`
|
||||
Narrators int `json:"narrators"`
|
||||
TotalSizeBytes int64 `json:"total_size_bytes"`
|
||||
TotalSeconds int64 `json:"total_seconds"`
|
||||
TotalPages int `json:"total_pages"`
|
||||
HoursMode bool `json:"hours_mode"`
|
||||
Genres []NameCountStats `json:"genres"`
|
||||
AuthorsTop []NameCountStats `json:"top_authors"`
|
||||
LongestItems []UsageItemStats `json:"longest_items"`
|
||||
LargestItems []UsageItemStats `json:"largest_items"`
|
||||
}
|
||||
|
||||
// LibraryUsage builds the /stats Library tab payload for one scope.
|
||||
|
||||
Reference in new issue
Block a user