Add HowLongToBeat estimates to game cards
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

- Fetch HLTB main/extra/completionist hours when a game item is saved
- Re-fetch only when name or category changes on edit
- Steam imports also fetch HLTB for each selected game
- Cards show compact HLTB row: "HLTB: 40h · +extra 60h · 100% 100h"
- Edit form shows HLTB breakdown as a hint next to Total hours field

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-31 23:04:36 +03:00
parent a4c31bf40b
commit ffcd8c40b4
7 changed files with 100 additions and 2 deletions

View File

@@ -188,6 +188,14 @@
<label>Total hours <span class="optional">optional</span></label>
{{ form.total_hours }}
{{ form.total_hours.errors }}
{% if item.hltb_main or item.hltb_extra or item.hltb_complete %}
<div style="margin-top:0.4rem;font-size:0.72rem;color:#475569;line-height:1.6">
HowLongToBeat:
{% if item.hltb_main %}<span style="color:#64748b">Main {{ item.hltb_main|floatformat:0 }}h</span>{% endif %}
{% if item.hltb_extra %}<span style="color:#64748b"> · +Extra {{ item.hltb_extra|floatformat:0 }}h</span>{% endif %}
{% if item.hltb_complete %}<span style="color:#64748b"> · 100% {{ item.hltb_complete|floatformat:0 }}h</span>{% endif %}
</div>
{% endif %}
</div>
</div>
</div>

View File

@@ -213,6 +213,11 @@
{% if item.hours_played is not None %}
{{ item.hours_played|floatformat:1 }}h played{% if item.total_hours %} / {{ item.total_hours|floatformat:0 }}h total{% endif %}
{% endif %}
{% if item.hltb_main or item.hltb_extra or item.hltb_complete %}
<div style="margin-top:0.3rem;font-size:0.72rem;color:#475569">
HLTB:{% if item.hltb_main %} {{ item.hltb_main|floatformat:0 }}h{% endif %}{% if item.hltb_extra %} · +extra {{ item.hltb_extra|floatformat:0 }}h{% endif %}{% if item.hltb_complete %} · 100% {{ item.hltb_complete|floatformat:0 }}h{% endif %}
</div>
{% endif %}
{% elif item.category == 'books' %}
{% if item.pages_read is not None %}
{{ item.pages_read }} pages{% if item.total_pages %} / {{ item.total_pages }} total{% endif %}