#11 add country total coin value
This commit is contained in:
parent
5c53c188a9
commit
077627dde2
@ -190,6 +190,10 @@ thead > tr:first-child > th {
|
||||
cursor: w-resize;
|
||||
}
|
||||
|
||||
thead div.total_coins {
|
||||
float:right;
|
||||
}
|
||||
|
||||
thead > tr:nth-child(2) > th {
|
||||
background-color: white;
|
||||
top: 40px;
|
||||
|
@ -10,6 +10,7 @@
|
||||
<img src="/static/coinc/images/{{ country.name_iso }}.png" />
|
||||
{{ country.name }}{% if country.comment %}
|
||||
<small> - {{ country.comment }}</small>{% endif %}
|
||||
<div class="total_coins">{{ total_coins }}</div>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -108,10 +108,26 @@ def show_country(country, single_country=False):
|
||||
|
||||
stamps_per_year = {}
|
||||
|
||||
|
||||
coin_count = {'total': 0}
|
||||
for value in [1, 2, 5, 10, 20, 50, 100, 200, 201, 202, 203]:
|
||||
coin_count[value] = Coin.objects.filter(
|
||||
country=country,
|
||||
value=value
|
||||
).exclude(found_by__isnull=True).count()
|
||||
if value > 200:
|
||||
coin_count['total'] += 200 * coin_count[value]
|
||||
else:
|
||||
coin_count['total'] += value * coin_count[value]
|
||||
coin_count['total'] /= 100
|
||||
import json
|
||||
print(json.dumps(coin_count, indent=4))
|
||||
|
||||
return {
|
||||
'country': c,
|
||||
'single_country': single_country,
|
||||
'users': User.objects.order_by('id').values('name','color')
|
||||
'users': User.objects.order_by('id').values('name','color'),
|
||||
'total_coins': f"{coin_count['total']:.2f} €"
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user