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:
@@ -650,6 +650,8 @@ type ResultsQuery struct {
|
|||||||
Order string // "price_asc", "price_desc", "found_desc" (default), "found_asc"
|
Order string // "price_asc", "price_desc", "found_desc" (default), "found_asc"
|
||||||
// ExcludeEnded drops rows whose ends_at is in the past. Fixed-price
|
// ExcludeEnded drops rows whose ends_at is in the past. Fixed-price
|
||||||
// listings (ends_at IS NULL) are kept regardless: they don't expire.
|
// 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
|
ExcludeEnded bool
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -674,7 +676,7 @@ func (s *Store) ListResults(ctx context.Context, q ResultsQuery) ([]models.Resul
|
|||||||
args = append(args, q.ItemID)
|
args = append(args, q.ItemID)
|
||||||
}
|
}
|
||||||
if q.ExcludeEnded {
|
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())
|
args = append(args, time.Now().UTC())
|
||||||
}
|
}
|
||||||
where := ""
|
where := ""
|
||||||
@@ -773,7 +775,7 @@ func (s *Store) CountResults(ctx context.Context, itemID int64, excludeEnded boo
|
|||||||
args = append(args, itemID)
|
args = append(args, itemID)
|
||||||
}
|
}
|
||||||
if excludeEnded {
|
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())
|
args = append(args, time.Now().UTC())
|
||||||
}
|
}
|
||||||
if len(conds) > 0 {
|
if len(conds) > 0 {
|
||||||
|
|||||||
Reference in New Issue
Block a user