Add unending category for session-based games
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
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:
25
backlogger/migrations/0006_item_category_unending.py
Normal file
25
backlogger/migrations/0006_item_category_unending.py
Normal 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,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -6,11 +6,13 @@ class Item(models.Model):
|
|||||||
GAMES = 'games'
|
GAMES = 'games'
|
||||||
BOOKS = 'books'
|
BOOKS = 'books'
|
||||||
FILMS = 'films'
|
FILMS = 'films'
|
||||||
|
UNENDING = 'unending'
|
||||||
OTHER = 'other'
|
OTHER = 'other'
|
||||||
CATEGORY_CHOICES = [
|
CATEGORY_CHOICES = [
|
||||||
(GAMES, 'Games'),
|
(GAMES, 'Games'),
|
||||||
(BOOKS, 'Books'),
|
(BOOKS, 'Books'),
|
||||||
(FILMS, 'Films'),
|
(FILMS, 'Films'),
|
||||||
|
(UNENDING, 'Unending'),
|
||||||
(OTHER, 'Other'),
|
(OTHER, 'Other'),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -252,7 +252,9 @@
|
|||||||
|
|
||||||
function updateSections() {
|
function updateSections() {
|
||||||
document.querySelectorAll('.cat-section').forEach(el => el.style.display = 'none');
|
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';
|
if (sec) sec.style.display = 'block';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -120,6 +120,7 @@
|
|||||||
.badge-games { background: #3b2f6a; color: #a78bfa; }
|
.badge-games { background: #3b2f6a; color: #a78bfa; }
|
||||||
.badge-books { background: #064e3b; color: #34d399; }
|
.badge-books { background: #064e3b; color: #34d399; }
|
||||||
.badge-films { background: #431407; color: #fb923c; }
|
.badge-films { background: #431407; color: #fb923c; }
|
||||||
|
.badge-unending { background: #0c3a52; color: #38bdf8; }
|
||||||
.badge-other { background: #1e293b; color: #94a3b8; }
|
.badge-other { background: #1e293b; color: #94a3b8; }
|
||||||
.star { color: #fbbf24; font-size: 0.9rem; margin-left: auto; }
|
.star { color: #fbbf24; font-size: 0.9rem; margin-left: auto; }
|
||||||
|
|
||||||
@@ -233,6 +234,10 @@
|
|||||||
{% if item.pages_read is not None %}
|
{% if item.pages_read is not None %}
|
||||||
{{ item.pages_read }} pages{% if item.total_pages %} / {{ item.total_pages }} total{% endif %}
|
{{ item.pages_read }} pages{% if item.total_pages %} / {{ item.total_pages }} total{% endif %}
|
||||||
{% 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' %}
|
{% elif item.category == 'films' %}
|
||||||
{% if item.watched %}✓ Watched{% else %}○ Not watched{% endif %}{% if item.duration_minutes %} · {{ item.duration_minutes }} min{% endif %}
|
{% if item.watched %}✓ Watched{% else %}○ Not watched{% endif %}{% if item.duration_minutes %} · {{ item.duration_minutes }} min{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
Reference in New Issue
Block a user