Skip to content

Commit f4ad820

Browse files
davidp57claude
andcommitted
fix: récupérer les fonctionnalités manquantes de feat-multiple-edit-tags-and-actions
Corrections après merge incomplet vers deploy-synology : Fichiers récupérés de feat-multiple-edit-tags-and-actions: - web/templates/index.html: Barre d'actions bulk complète (Set Priority, Personal Rating, Playtime Tag, etc.) - web/routes/collections.py: Renommage collection_id label_id (système unifié) - web/routes/sync.py: Appels à update_all_auto_labels() pour Steam - web/templates/_filter_bar.html: Composant filtre à jour - web/utils/filters.py: Système de filtres basé sur system labels (just-tried vs started) Corrections dans web/main.py: - Ajout import ensure_system_labels - Ordre correct d'initialisation DB (migrate_collections_to_labels avant ensure_labels_tables) - Suppression ensure_collections_tables() (remplacé par système labels) - Ajout conn.row_factory = sqlite3.Row - Appel ensure_system_labels(conn) après add_igdb_columns Tests mis à jour: - 5 fichiers tests adaptés au nouveau système (just-tried vs started) - 211 tests passing Docker: Testé avec succès, system labels créés correctement Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 25f98ce commit f4ad820

12 files changed

Lines changed: 1202 additions & 296 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,3 +254,4 @@ __marimo__/
254254
.github/skills/openspec-sync-specs/SKILL.md
255255
.github/skills/openspec-verify-change/SKILL.md
256256
.github/copilot-instructions.md
257+
.vscode/settings.json

tests/test_empty_library.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ def empty_db():
3333
last_modified TIMESTAMP,
3434
nsfw BOOLEAN DEFAULT 0,
3535
hidden BOOLEAN DEFAULT 0,
36-
cover_url TEXT
36+
cover_url TEXT,
37+
priority TEXT,
38+
personal_rating REAL
3739
)
3840
""")
3941

@@ -44,7 +46,24 @@ def empty_db():
4446
name TEXT NOT NULL
4547
)
4648
""")
47-
49+
50+
cursor.execute("""
51+
CREATE TABLE labels (
52+
id INTEGER PRIMARY KEY,
53+
name TEXT NOT NULL,
54+
type TEXT,
55+
system INTEGER DEFAULT 0
56+
)
57+
""")
58+
59+
cursor.execute("""
60+
CREATE TABLE game_labels (
61+
game_id INTEGER,
62+
label_id INTEGER,
63+
PRIMARY KEY (game_id, label_id)
64+
)
65+
""")
66+
4867
conn.commit()
4968
yield conn
5069
conn.close()

tests/test_large_library_performance.py

Lines changed: 54 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,48 @@ def large_db():
3535
last_modified TIMESTAMP,
3636
nsfw BOOLEAN DEFAULT 0,
3737
hidden BOOLEAN DEFAULT 0,
38-
cover_url TEXT
38+
cover_url TEXT,
39+
priority TEXT,
40+
personal_rating REAL
3941
)
4042
""")
4143

44+
# Create labels and game_labels tables for tag-based filters
45+
cursor.execute("""
46+
CREATE TABLE labels (
47+
id INTEGER PRIMARY KEY,
48+
name TEXT NOT NULL,
49+
type TEXT,
50+
system INTEGER DEFAULT 0
51+
)
52+
""")
53+
54+
cursor.execute("""
55+
CREATE TABLE game_labels (
56+
game_id INTEGER,
57+
label_id INTEGER,
58+
PRIMARY KEY (game_id, label_id)
59+
)
60+
""")
61+
62+
# Insert system tag labels
63+
system_tags = [
64+
(1, 'Never Launched', 'system_tag', 1),
65+
(2, 'Just Tried', 'system_tag', 1),
66+
(3, 'Played', 'system_tag', 1),
67+
(4, 'Well Played', 'system_tag', 1),
68+
(5, 'Heavily Played', 'system_tag', 1),
69+
]
70+
cursor.executemany("INSERT INTO labels (id, name, type, system) VALUES (?, ?, ?, ?)", system_tags)
71+
4272
# Create indexes (same as production)
4373
cursor.execute("CREATE INDEX idx_games_playtime ON games(playtime_hours)")
4474
cursor.execute("CREATE INDEX idx_games_total_rating ON games(total_rating)")
4575
cursor.execute("CREATE INDEX idx_games_added_at ON games(added_at)")
4676
cursor.execute("CREATE INDEX idx_games_release_date ON games(release_date)")
4777
cursor.execute("CREATE INDEX idx_games_nsfw ON games(nsfw)")
4878
cursor.execute("CREATE INDEX idx_games_last_modified ON games(last_modified)")
49-
79+
5080
# Insert 10,000 games
5181
print("\nGenerating 10,000 test games...")
5282
games = []
@@ -77,9 +107,29 @@ def large_db():
77107
added_at, release_date, last_modified, nsfw, hidden)
78108
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
79109
""", games)
80-
110+
111+
# Assign system tags based on playtime to match tag-based filter expectations
112+
game_labels = []
113+
for i, game in enumerate(games):
114+
game_id = i + 1 # IDs start at 1
115+
playtime = game[2] # playtime_hours
116+
if playtime is None or playtime == 0:
117+
# ~30% have no playtime → some get "Never Launched" for steam
118+
if game[1] == "steam" and random.random() > 0.5:
119+
game_labels.append((game_id, 1)) # Never Launched
120+
elif playtime < 2:
121+
game_labels.append((game_id, 2)) # Just Tried
122+
elif playtime < 10:
123+
game_labels.append((game_id, 3)) # Played
124+
elif playtime < 30:
125+
game_labels.append((game_id, 4)) # Well Played
126+
else:
127+
game_labels.append((game_id, 5)) # Heavily Played
128+
129+
cursor.executemany("INSERT INTO game_labels (game_id, label_id) VALUES (?, ?)", game_labels)
130+
81131
conn.commit()
82-
print(f"Created {len(games)} games")
132+
print(f"Created {len(games)} games with {len(game_labels)} labels")
83133

84134
yield conn
85135
conn.close()

0 commit comments

Comments
 (0)