diff --git a/vrobbler/apps/charts/models.py b/vrobbler/apps/charts/models.py index acbdaaa..6f673af 100644 --- a/vrobbler/apps/charts/models.py +++ b/vrobbler/apps/charts/models.py @@ -146,3 +146,8 @@ class ChartRecord(TimeStampedModel): elif self.month: date_str = f"{self.year}-{self.month:02d}" return f"{url}?date={date_str}" + + @property + def rank_emoji(self) -> str: + emojis = {1: "🥇", 2: "🥈", 3: "🥉"} + return emojis.get(self.rank, f"#{self.rank}") diff --git a/vrobbler/apps/scrobbles/views.py b/vrobbler/apps/scrobbles/views.py index 545cd42..b26551a 100644 --- a/vrobbler/apps/scrobbles/views.py +++ b/vrobbler/apps/scrobbles/views.py @@ -153,7 +153,7 @@ class ChartContextMixin: if media_type: context["charts"] = ChartRecord.objects.filter( **{media_type: obj}, rank__in=[1, 2, 3] - ) + ).exclude(day__isnull=False) return context diff --git a/vrobbler/templates/boardgames/boardgame_detail.html b/vrobbler/templates/boardgames/boardgame_detail.html index f7456a5..e86a89e 100644 --- a/vrobbler/templates/boardgames/boardgame_detail.html +++ b/vrobbler/templates/boardgames/boardgame_detail.html @@ -50,7 +50,7 @@ {% if charts %}
{% for chart in charts %}{{chart}}{% if forloop.last %}{% else %} | {% endif %}{% endfor %}
+ {% include "scrobbles/_chart_links.html" %}{% for chart in charts %}{{chart}}{% if forloop.last %}{% else %} | {% endif %}{% endfor %}
+ {% include "scrobbles/_chart_links.html" %}{% for chart in charts %}{{chart}}{% if forloop.last %}{% else %} | {% endif %}{% endfor %}
+ {% include "scrobbles/_chart_links.html" %}{{object.scrobbles.count}} scrobbles
{% if charts %} -{% for chart in charts %}{{chart}}{% if forloop.last %}{% else %} | {% endif %}{% endfor %}
+ {% include "scrobbles/_chart_links.html" %} {% endif %}{{artist.scrobbles.count}} scrobbles
{% if charts %} -{% for chart in charts %}{{chart}}{% if forloop.last %}{% else %} | {% endif %}{% endfor %}
+ {% include "scrobbles/_chart_links.html" %} {% endif %}{{scrobbles.count}} scrobbles
{% if charts %} -{% for chart in charts %}{{chart}}{% if forloop.last %}{% else %} | {% endif %}{% endfor %}
+ {% include "scrobbles/_chart_links.html" %} {% endif %}{% for chart in charts %}{{chart}}{% if forloop.last %}{% else %} | {% endif %}{% endfor %}
+ {% include "scrobbles/_chart_links.html" %}{% for chart in charts %}{{chart.rank_emoji}} {{chart.period_str}}{% if forloop.last %}{% else %} | {% endif %}{% endfor %}
+{% for chart in charts %}{{chart}}{% if forloop.last %}{% else %} | {% endif %}{% endfor %}
+ {% include "scrobbles/_chart_links.html" %}{% for chart in charts %}{{chart}}{% if forloop.last %}{% else %} | {% endif %}{% endfor %}
+ {% include "scrobbles/_chart_links.html" %}{% for chart in charts %}{{chart}}{% if forloop.last %}{% else %} | {% endif %}{% endfor %}
- {% endif %} + {% include "scrobbles/_chart_links.html" %}