Checking history save in diff calc

This commit is contained in:
Felipe Martín 2015-08-29 20:14:43 +02:00
parent 17ae987e62
commit 20f7937e54
2 changed files with 8 additions and 8 deletions

View File

@ -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):

View File

@ -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()