Checking history save in diff calc
This commit is contained in:
parent
17ae987e62
commit
20f7937e54
|
@ -19,8 +19,7 @@ def save_historical_price(sender, instance, **kwargs):
|
||||||
if new_price:
|
if new_price:
|
||||||
new_price = Decimal(new_price)
|
new_price = Decimal(new_price)
|
||||||
|
|
||||||
if old_price != new_price:
|
instance.save_history(old_price, new_price)
|
||||||
instance.save_history(old_price, new_price)
|
|
||||||
|
|
||||||
|
|
||||||
def post_check_price_change(sender, instance, created, **kwargs):
|
def post_check_price_change(sender, instance, created, **kwargs):
|
||||||
|
|
|
@ -228,12 +228,13 @@ class AmiiboPrice(models.Model):
|
||||||
else:
|
else:
|
||||||
diff = new_price-old_price
|
diff = new_price-old_price
|
||||||
|
|
||||||
history = AmiiboPriceHistory(
|
if diff > 0:
|
||||||
amiibo_shop_id=self.amiibo_shop_id,
|
history = AmiiboPriceHistory(
|
||||||
price=self.price,
|
amiibo_shop_id=self.amiibo_shop_id,
|
||||||
currency=self.currency,
|
price=self.price,
|
||||||
diff=diff
|
currency=self.currency,
|
||||||
)
|
diff=diff
|
||||||
|
)
|
||||||
return history.save()
|
return history.save()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue