Add unending category for session-based games
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

For games like Dota 2 that have no completion state — shows hours
played on the card, reuses the games fields in the form (hours played
/ total hours), and gets its own cyan badge. No DB column change,
only choices metadata update.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-01 23:25:41 +03:00
parent da11a056ed
commit b765067c5b
4 changed files with 35 additions and 1 deletions

View File

@@ -0,0 +1,25 @@
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('backlogger', '0005_item_status'),
]
operations = [
migrations.AlterField(
model_name='item',
name='category',
field=models.CharField(
choices=[
('games', 'Games'),
('books', 'Books'),
('films', 'Films'),
('unending', 'Unending'),
('other', 'Other'),
],
max_length=10,
),
),
]

View File

@@ -6,11 +6,13 @@ class Item(models.Model):
GAMES = 'games'
BOOKS = 'books'
FILMS = 'films'
UNENDING = 'unending'
OTHER = 'other'
CATEGORY_CHOICES = [
(GAMES, 'Games'),
(BOOKS, 'Books'),
(FILMS, 'Films'),
(UNENDING, 'Unending'),
(OTHER, 'Other'),
]

View File

@@ -252,7 +252,9 @@
function updateSections() {
document.querySelectorAll('.cat-section').forEach(el => el.style.display = 'none');
const sec = document.getElementById('section-' + catSelect.value);
const cat = catSelect.value;
const secId = cat === 'unending' ? 'section-games' : 'section-' + cat;
const sec = document.getElementById(secId);
if (sec) sec.style.display = 'block';
}

View File

@@ -120,6 +120,7 @@
.badge-games { background: #3b2f6a; color: #a78bfa; }
.badge-books { background: #064e3b; color: #34d399; }
.badge-films { background: #431407; color: #fb923c; }
.badge-unending { background: #0c3a52; color: #38bdf8; }
.badge-other { background: #1e293b; color: #94a3b8; }
.star { color: #fbbf24; font-size: 0.9rem; margin-left: auto; }
@@ -233,6 +234,10 @@
{% if item.pages_read is not None %}
{{ item.pages_read }} pages{% if item.total_pages %} / {{ item.total_pages }} total{% endif %}
{% endif %}
{% elif item.category == 'unending' %}
{% if item.hours_played is not None %}
{{ item.hours_played|floatformat:1 }}h played
{% endif %}
{% elif item.category == 'films' %}
{% if item.watched %}&#10003; Watched{% else %}&#9675; Not watched{% endif %}{% if item.duration_minutes %} &middot; {{ item.duration_minutes }} min{% endif %}
{% endif %}