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:
|
||||
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):
|
||||
|
|
|
@ -228,12 +228,13 @@ class AmiiboPrice(models.Model):
|
|||
else:
|
||||
diff = new_price-old_price
|
||||
|
||||
history = AmiiboPriceHistory(
|
||||
amiibo_shop_id=self.amiibo_shop_id,
|
||||
price=self.price,
|
||||
currency=self.currency,
|
||||
diff=diff
|
||||
)
|
||||
if diff > 0:
|
||||
history = AmiiboPriceHistory(
|
||||
amiibo_shop_id=self.amiibo_shop_id,
|
||||
price=self.price,
|
||||
currency=self.currency,
|
||||
diff=diff
|
||||
)
|
||||
return history.save()
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue