Merge branch 'devel' of github.com:fmartingr/amiibofindr into devel

This commit is contained in:
Felipe Martín 2015-06-25 17:25:14 +02:00
commit 1614b1ecea
3 changed files with 17 additions and 8 deletions

View File

@ -32,10 +32,19 @@ class AmazonBaseCrawler(object):
products = self.amazon.lookup(ItemId=','.join(chunk_product_ids))
for product in products:
price_and_currency = product.price_and_currency
price = price_and_currency[0]
currency = price_and_currency[1]
if currency == 'JPY':
price = float(price)*100
print(self.region, product.asin, price, currency)
result.append({
'shop_product_id': product.asin,
'price': price_and_currency[0],
'currency': price_and_currency[1],
'price': price,
'currency': currency,
})
sleep(1)
@ -46,7 +55,7 @@ class AmazonBaseCrawler(object):
price_and_currency = product.price_and_currency
amiibo_price = {
'shop_product_id': product_id,
'price': price_and_currency[0],
'price': price_and_currency[0].replace(',', ''),
'currency': price_and_currency[1],
}

View File

@ -29,7 +29,7 @@
</div>
<div class="ui breadcrumb">
{% block breadcrumb %}
<a class="section">Home</a>
<a class="section" href="{% url 'amiibo:collection' 'all' %}">Home</a>
{% endblock %}
</div>
</div>

View File

@ -56,12 +56,12 @@
<tbody>
{% for relation in amiibo.shops_set.all %}
<tr>
{% with price=relation.last_price.price %}
{% with price=relation.last_price.price stock=relation.last_price.stock %}
<td><a href="{{ relation.get_url }}">{{ relation.shop.name }}</a> <i class="info icon" title="{{ relation.last_price.date }}"></i></td>
<td class="center aligned">{% if relation.shop.flag_code %}<i class="{% if relation.shop.flag_code == 'uk' %}gb{% else %}{{ relation.shop.flag_code }}{% endif %} flag"></i>{% endif %}</td>
<td class="center aligned {{ price|yesno:'positive,negative' }}">
<i class="icon {{ price|yesno:'checkmark,close' }}"></i>
{{ price|yesno|capfirst }}
<td class="center aligned {{ stock|yesno:'positive,negative' }}">
<i class="icon {{ stock|yesno:'checkmark,close' }}"></i>
{{ stock|yesno|capfirst }}
</td>
<td class="center aligned">
{% if price %}