Skip to content
This repository has been archived by the owner on Jul 24, 2020. It is now read-only.

Commit

Permalink
also check for "Ages 18 and over" string #92
Browse files Browse the repository at this point in the history
  • Loading branch information
dArignac committed Jan 16, 2016
1 parent db57c90 commit 07a4d67
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions price_monitor/product_advertising_api/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,12 +337,13 @@ def get_audience_rating_info(self, product):
:return: an additional mail text or empty string if product and installation do not match prerequisites.
:rtype: str
"""
if app_settings.PRICE_MONITOR_AMAZON_PRODUCT_API_REGION == 'DE' and product.audience_rating == 'Freigegeben ab 18 Jahren':
age_identifiers = ['Freigegeben ab 18 Jahren', 'Ages 18 and over']
if app_settings.PRICE_MONITOR_AMAZON_PRODUCT_API_REGION == 'DE' and product.audience_rating in age_identifiers:
# mail text
mail_text = ''

# fetch all other products with FSK 18
for p in Product.objects.filter(audience_rating='Freigegeben ab 18 Jahren').exclude(pk=product.pk).order_by('current_price'):
for p in Product.objects.filter(audience_rating__in=age_identifiers).exclude(pk=product.pk).order_by('current_price'):
mail_text += '{title:s}\n'.format(title=p.get_title())
mail_text += '{price:0.2f} {currency:s} ({price_date:s})\n'.format(
price=p.current_price.value,
Expand Down

0 comments on commit 07a4d67

Please sign in to comment.