Inventory: competitor prices, as checked
Each Inventory entry can hold its plans' prices: the plan, the price, what it's per, when it was checked and where. Comparison and alternative pages, and new sections, state a competitor's price only as entered, with the month it was checked; a missing one is left out and listed as a to-do. A price checked more than six months ago is flagged on the entry and adds a to-do to every page that names the competitor. Prices go out and come back with the Inventory's YAML. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"supermarket/internal/inventory"
|
||||
"supermarket/internal/seo"
|
||||
"supermarket/internal/sites"
|
||||
)
|
||||
@@ -64,6 +65,13 @@ func (s *Server) composeSection(ctx context.Context, cur siteRepo, p *sites.Site
|
||||
in.Searches, _ = seo.PageSearches(s.DB, s.scope(st), p.Path, 10)
|
||||
}
|
||||
}
|
||||
if entries, err := inventory.List(s.DB, inventory.Competitor); err == nil {
|
||||
for i := range entries {
|
||||
if len(entries[i].Prices) > 0 {
|
||||
in.Competitors = append(in.Competitors, &entries[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
out, err := (&sites.Composer{AI: client, Profile: prof}).ComposeSection(ctx, in)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user