diff --git a/coinmanager/coinc/static/coinc/styles.css b/coinmanager/coinc/static/coinc/styles.css index 6a4b557..2429d8a 100644 --- a/coinmanager/coinc/static/coinc/styles.css +++ b/coinmanager/coinc/static/coinc/styles.css @@ -83,23 +83,31 @@ td > * { } table > tbody > tr > td { - background-color: lightgray; + background-color: #b7b7b7; +} + +table > tbody > tr > td > div.coin { + position: relative; + height: 30px; + width: 30px; + text-align: inherit; + line-height: 30px; } td.noexist { - background-color: gray; + background-color: #434343; } td.brass { - background-color: yellow; + background-color: #ffff99; } td.rare { - background-color: brown; + background-color: #e69138; } -td.kms { - background-color: red; +td.buy_only { + background-color: #dd7e6b; } td.year { @@ -107,7 +115,7 @@ td.year { } td.year-complete { - background-color: green; + background-color: #00ff00; } td.spacer { @@ -115,20 +123,24 @@ td.spacer { background-color: white; } -div.ec { - color: red; +td.in_collector { + color: #ff0000; + font-weight: bold; } -div.check { - color: green; +td.checked { + color: #00ff00; + font-weight: bold; } div.found { + position: absolute; + top: 0; height:30px; width:30px; clip-path: polygon(100% 70%, 100% 100%, 70% 100%); } -div.moritz { +div.Moritz { background-color: red; } diff --git a/coinmanager/coinc/templates/coinc/coin.html b/coinmanager/coinc/templates/coinc/coin.html index 25c6b16..3827853 100644 --- a/coinmanager/coinc/templates/coinc/coin.html +++ b/coinmanager/coinc/templates/coinc/coin.html @@ -1 +1 @@ -
{% if coin.found_by %}x{% endif %}
+
{{ marker }}
diff --git a/coinmanager/coinc/templates/coinc/year.html b/coinmanager/coinc/templates/coinc/year.html index 68b16cf..6261782 100644 --- a/coinmanager/coinc/templates/coinc/year.html +++ b/coinmanager/coinc/templates/coinc/year.html @@ -1,6 +1,6 @@ {% for stamp in year %} -
{{ stamp }}{{ year_int }}
-{% for value in values %}{% show_coin country year_int stamp value %}{% endfor %} {% endfor %}{% ifnotequal year|length 1 %} +
{{ stamp }}{{ year_short }}
+{% for value in values %}{% show_coin country year_short stamp value %}{% endfor %} {% endfor %}{% ifnotequal year|length 1 %} {% endifnotequal %} diff --git a/coinmanager/coinc/views.py b/coinmanager/coinc/views.py index f914b17..fb01047 100644 --- a/coinmanager/coinc/views.py +++ b/coinmanager/coinc/views.py @@ -86,17 +86,21 @@ def show_country(country): year_now = datetime.now().year for year in [str(i) for i in range(country.euro_member_since, year_now + 1)]: stamps_per_year = stamps + if irregular_stamps and year in irregular_stamps: for irregular_stamp, value in irregular_stamps[year].items(): stamps_per_year[irregular_stamp] = {} + # TODO this is not really a fix... elif country.name_iso == 'gr': stamps_per_year = {'': {}} - y = year[2:4] - c['years'][y] = {} + year_short = year[2:4] + c['years'][year_short] = {} + for stamp in stamps_per_year: - c['years'][y][stamp] = {'name': stamp} + c['years'][year_short][stamp] = {'name': stamp} + stamps_per_year = {} return {'country': c} @@ -107,7 +111,7 @@ def show_country(country): def show_year(country, year): return { 'year': country['years'][year], - 'year_int': year, + 'year_short': year, 'values': [1, 2, 5, 10, 20, 50, 100, 200, 201, 202, 203], 'country': country['name_iso'] } @@ -121,15 +125,44 @@ def show_coin(country, year, stamp, value): @param stamp: stamp_id @param value: int e [1,2,5,10,20,50,100,200,201,202,203] ''' - coin = Coin.objects.filter(country=country, year=year, stamp=stamp, value=value).values( - 'value', 'year', 'stamp', 'name', 'found_by', - 'found_on', 'buy_only', 'circulation', 'comment', - 'in_collector', 'checked', 'exists') + # TODO: fix this before the end of 2098 + year = int(year) + if year == 99: + year += 1900 + else: + year += 2000 - if coin: - print(coin) + if stamp == "": + stamp = None - return { 'coin': coin } + try: + coin = Coin.objects.get(country=country, year=year, stamp=stamp, value=value) + except Coin.DoesNotExist: + return {} + + if coin.buy_only: + td_class = 'buy_only' + elif coin.circulation and coin.circulation < 1500000: + td_class = 'rare' + elif coin.noexist: + td_class = 'noexist' + elif coin.value in [10, 20, 50]: + td_class = 'brass' + + if coin.in_collector: + td_class += ' in_collector' + elif coin.checked: + td_class += ' coin_checked' + + if coin.found_by: + div_class = f"found {coin.found_by}" + marker = 'x' + + return { + 'marker': marker, + 'td_class': td_class, + 'div_class': div_class, + }