workaround for no previous price present

piwheels-rpi-crypto
dgtlmoon 7 months ago
parent afc88d654b
commit 6824fa22c5

@ -179,7 +179,8 @@ class perform_site_check(difference_detection_processor):
if watch.get('follow_price_changes') and watch.get('restock') and update_obj.get('restock') and update_obj['restock'].get('price'): if watch.get('follow_price_changes') and watch.get('restock') and update_obj.get('restock') and update_obj['restock'].get('price'):
price = float(update_obj['restock'].get('price')) price = float(update_obj['restock'].get('price'))
previous_price = float(watch['restock'].get('price')) # Default to current price if no previous price found
previous_price = float(watch['restock'].get('price', price))
# It was different, but negate it further down # It was different, but negate it further down
if price != previous_price: if price != previous_price:

@ -186,6 +186,7 @@ def test_itemprop_price_minmax_limit(client, live_server):
res = client.get(url_for("index")) res = client.get(url_for("index"))
assert b'1890.45' in res.data assert b'1890.45' in res.data
assert b'unviewed' in res.data assert b'unviewed' in res.data
res = client.get(url_for("form_delete", uuid="all"), follow_redirects=True) res = client.get(url_for("form_delete", uuid="all"), follow_redirects=True)
assert b'Deleted' in res.data assert b'Deleted' in res.data

Loading…
Cancel
Save