timetracker/games/templates/stats.html

74 lines
3.1 KiB
HTML
Raw Normal View History

2023-11-01 19:18:39 +00:00
{% extends "base.html" %}
{% block title %}{{ title }}{% endblock title %}
{% load static %}
{% block content %}
<div class="dark:text-white max-w-sm sm:max-w-xl lg:max-w-3xl mx-auto">
2023-11-02 08:20:09 +00:00
<div class="flex justify-center items-center">
<form method="get" class="text-center">
<label class="text-5xl text-center inline-block mb-10" for="yearSelect">Stats for:</label>
<select name="year" id="yearSelect" onchange="this.form.submit();" class="mx-2">
2023-11-02 14:27:19 +00:00
{% for year_item in stats_dropdown_year_range %}
<option value="{{ year_item }}" {% if year == year_item %}selected{% endif %}>{{ year_item }}</option>
{% endfor %}
2023-11-02 08:20:09 +00:00
</select>
</form>
</div>
2023-11-01 19:18:39 +00:00
<table class="responsive-table">
<thead>
<tr>
<th class="px-2 sm:px-4 md:px-6 md:py-2">Total hours</th>
<th class="px-2 sm:px-4 md:px-6 md:py-2">Total games</th>
2023-11-02 08:52:59 +00:00
<th class="px-2 sm:px-4 md:px-6 md:py-2">Released that year</th>
2023-11-01 19:18:39 +00:00
</tr>
<tbody>
<tr>
<td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono">{{ total_hours }}</td>
<td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono">{{ total_games }}</td>
<td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono">{{ total_2023_games }}</td>
</tr>
</tbody>
</table>
<h1 class="text-5xl text-center my-6">Top games by playtime</h1>
<table class="responsive-table">
<thead>
<tr>
<th class="px-2 sm:px-4 md:px-6 md:py-2">Name</th>
<th class="px-2 sm:px-4 md:px-6 md:py-2">Playtime (hours)</th>
</tr>
</thead>
<tbody>
2023-11-02 14:08:11 +00:00
{% for game in top_10_games_by_playtime %}
2023-11-01 19:18:39 +00:00
<tr>
<td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono">
2023-11-02 14:08:11 +00:00
<a href="{% url 'view_game' game.id %}">{{ game.name }}
2023-11-01 19:18:39 +00:00
</a>
</td>
2023-11-02 14:08:11 +00:00
<td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono">{{ game.formatted_playtime }}</td>
2023-11-01 19:18:39 +00:00
</tr>
{% endfor %}
</tbody>
</table>
<h1 class="text-5xl text-center my-6">Platforms by playtime</h1>
<table class="responsive-table">
<thead>
<tr>
<th class="px-2 sm:px-4 md:px-6 md:py-2">Platform</th>
<th class="px-2 sm:px-4 md:px-6 md:py-2">Playtime (hours)</th>
</tr>
</thead>
<tbody>
{% for item in total_playtime_per_platform %}
<tr>
<td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono">{{ item.platform_name }} </td>
<td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono">{{ item.formatted_playtime }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock content %}