michaelhball/discogs_alert

Include shipping price in `price_threshold` filter?

Closed this issue · 2 comments

Hi, I was wondering if it was possible to include shipping prices in the filtering? It would really help for the releases that often have to be imported.

Yep, that's a good idea actually! I think the original motivation was that shipping prices aren't able to be parsed relatively often, so we'd have to have a suitable fallback in those cases (i.e. filtering against the listing price only). I'll work on this as soon as I can :)

In the meantime, I added a new functionality recently where you can set up a seller country whitelist (only consider listings from these countries) or blacklist (exclude listings from these countries). This could help to avoid you seeing really expensive listings by filtering out countries where you know it's expensive every time. You can use this if you upgrade to the latest version.

Hey @SpiffyJUNIOR, I'm not sure I didn't notice this before, but this is actually the current behaviour :) If it's possible to parse the shipping price from a given listing then that will be included in the calculation of whether that listing falls under your threshold.

You can see that here

def price_is_above_threshold(self, price_threshold: Optional[float] = None) -> bool:
return price_threshold is not None and self.total_price > price_threshold

where self.total_price is defined as
@property
def total_price(self) -> float:
return self.price.value if self.price.shipping is None else self.price.value + self.price.shipping.value