fix: prevent duplicate year suffixes in series name and folder creation

Apply the same duplicate-year prevention logic to additional code paths:

- Serie.name_with_year property: skip adding year suffix if name already ends with it
- add_series API endpoint: avoid duplicating year in folder_name_with_year
- Add integration test for Serie.name_with_year idempotency
- Add API test for add_series endpoint year deduplication

Complements the folder_rename_service fix for comprehensive coverage.
This commit is contained in:
2026-05-19 21:25:21 +02:00
parent 75c22fe296
commit 7930e49701
4 changed files with 42 additions and 2 deletions

View File

@@ -271,7 +271,10 @@ class Serie:
'Dororo (2025)'
"""
if self._year:
return f"{self._name} ({self._year})"
year_suffix = f" ({self._year})"
if self._name.endswith(year_suffix):
return self._name
return f"{self._name}{year_suffix}"
return self._name
@property