From a283b97176db9ec1eb24f2b4ff217ac60b048b08 Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Wed, 22 Apr 2026 13:33:31 -0400 Subject: [PATCH] refactor(main): _ensure_fandom_tag stores bare names Post-migration tag.name no longer embeds 'fandom:' prefix. Helper now creates/finds by (kind='fandom', name=bare). Co-Authored-By: Claude Opus 4.7 --- app/main.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/main.py b/app/main.py index 4d5278d..4b04799 100644 --- a/app/main.py +++ b/app/main.py @@ -26,15 +26,14 @@ def _parse_character_fandom(name_after_prefix): def _ensure_fandom_tag(fandom_name): - """Find or create a fandom tag by name. Returns the Tag object. + """Find or create a fandom tag by bare name. Returns the Tag object. Normalizes the display name so callers don't have to remember. """ normalized = normalize_display_name(fandom_name.strip()) - full_name = f"fandom:{normalized}" - fandom_tag = Tag.query.filter_by(name=full_name).first() + fandom_tag = Tag.query.filter_by(kind='fandom', name=normalized).first() if not fandom_tag: - fandom_tag = Tag(name=full_name, kind="fandom") + fandom_tag = Tag(kind='fandom', name=normalized) db.session.add(fandom_tag) db.session.flush() return fandom_tag