fix: local ticker search for screener (Sectors companies/ 401s on sub)
- q= now searches universe table locally (ticker + company_name LIKE, order by close) instead of calling the Sectors companies/ endpoint, which returns SUBSCRIPTION_DOES_NOT_ALLOW on the current subscription and silently fell back to the full 780-ticker universe - removes the broken name-fill cmd + scheduler/one-shot Screen() name enrichment (wasted credits, empty names) - Screener UI: search card says 'kode saham', results still show company name when present
This commit is contained in:
@@ -46,7 +46,19 @@ func (s *Server) Screen(w http.ResponseWriter, r *http.Request) {
|
||||
// Base universe: live screener when keyed, else stored watchlist.
|
||||
var universe []string
|
||||
names := map[string]string{}
|
||||
if s.Cfg.HasSectorsKey() && (req.Where != "" || req.Q != "") {
|
||||
// Free-text q → local universe search (ticker + company_name, offline).
|
||||
// The Sectors companies/ endpoint is not on this subscription, so remote
|
||||
// screening is skipped entirely to avoid a silent full-universe fallback.
|
||||
if req.Q != "" {
|
||||
if hits, err := s.DB.SearchTickers(req.Q, limit*2); err == nil {
|
||||
for _, h := range hits {
|
||||
universe = append(universe, h.Symbol)
|
||||
if h.CompanyName != "" {
|
||||
names[h.Symbol] = h.CompanyName
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if s.Cfg.HasSectorsKey() && req.Where != "" {
|
||||
if rows, err := s.Sectors.Screen(r.Context(), req.Where, req.Q, limit*2, 0); err == nil {
|
||||
for _, row := range rows {
|
||||
tk := strings.ToUpper(strings.TrimSuffix(row.Symbol, ".JK"))
|
||||
|
||||
Reference in New Issue
Block a user