diff --git a/internal/db/queries.go b/internal/db/queries.go index fc4949f..dd60229 100644 --- a/internal/db/queries.go +++ b/internal/db/queries.go @@ -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 {