Drop ended zenmarket auctions with unparsed end times

ExcludeEnded kept NULL ends_at rows on the fixed-price assumption, but
yahoo-auctions-jp is auction-only — a NULL there just means the actor's
ending_date didn't parse. Treat those as ended.
This commit is contained in:
prosolis
2026-05-18 22:38:31 -07:00
parent cf438f1a2d
commit c173543aa3

View File

@@ -650,6 +650,8 @@ type ResultsQuery struct {
Order string // "price_asc", "price_desc", "found_desc" (default), "found_asc"
// ExcludeEnded drops rows whose ends_at is in the past. Fixed-price
// listings (ends_at IS NULL) are kept regardless: they don't expire.
// Exception: yahoo-auctions-jp is auction-only — NULL ends_at there means
// the actor's ending_date didn't parse, and those rows are also dropped.
ExcludeEnded bool
}
@@ -674,7 +676,7 @@ func (s *Store) ListResults(ctx context.Context, q ResultsQuery) ([]models.Resul
args = append(args, q.ItemID)
}
if q.ExcludeEnded {
conds = append(conds, `(ends_at IS NULL OR ends_at > ?)`)
conds = append(conds, `((ends_at IS NULL AND source != 'yahoo-auctions-jp') OR ends_at > ?)`)
args = append(args, time.Now().UTC())
}
where := ""
@@ -773,7 +775,7 @@ func (s *Store) CountResults(ctx context.Context, itemID int64, excludeEnded boo
args = append(args, itemID)
}
if excludeEnded {
conds = append(conds, `(ends_at IS NULL OR ends_at > ?)`)
conds = append(conds, `((ends_at IS NULL AND source != 'yahoo-auctions-jp') OR ends_at > ?)`)
args = append(args, time.Now().UTC())
}
if len(conds) > 0 {