latest changes
This commit is contained in:
@@ -147,6 +147,7 @@ def cached_product(user, barcode, *, refresh=False):
|
||||
raise ValueError('Enter a numeric barcode.')
|
||||
product = FoodProduct.objects.filter(owner=user, barcode=barcode).first()
|
||||
if product and (product.source == FoodProduct.Source.MANUAL or
|
||||
(isinstance(product.raw_data, dict) and product.raw_data.get('manual_nutrition_override')) or
|
||||
(not refresh and product.fetched_at and product.fetched_at >= timezone.now() - timedelta(days=7))):
|
||||
return product
|
||||
if not settings.OPENFOODFACTS_ENABLED:
|
||||
|
||||
Reference in New Issue
Block a user