X-Problem gelöst
Dieser Commit ist enthalten in:
@ -117,6 +117,11 @@ class DatabaseManager:
|
||||
if field not in account_data:
|
||||
logger.error(f"Fehlendes Pflichtfeld: {field}")
|
||||
return -1
|
||||
# Prüfe auch ob Felder nicht leer sind
|
||||
if not account_data[field] or account_data[field] == "":
|
||||
logger.error(f"Pflichtfeld ist leer: {field} = '{account_data[field]}'")
|
||||
logger.error(f"Account-Daten: {account_data}")
|
||||
return -1
|
||||
|
||||
# Sicherstellen, dass created_at vorhanden ist
|
||||
if "created_at" not in account_data:
|
||||
@ -218,11 +223,21 @@ class DatabaseManager:
|
||||
Liste von Dictionaries mit Account-Daten
|
||||
"""
|
||||
try:
|
||||
# Platform-Name standardisieren
|
||||
from domain.value_objects.platform_name import PlatformName
|
||||
try:
|
||||
platform_obj = PlatformName(platform)
|
||||
canonical_platform = platform_obj.canonical
|
||||
except ValueError:
|
||||
# Fallback für unbekannte Platforms
|
||||
canonical_platform = platform.lower()
|
||||
|
||||
conn = sqlite3.connect(self.db_path)
|
||||
conn.row_factory = sqlite3.Row
|
||||
cursor = conn.cursor()
|
||||
|
||||
cursor.execute("SELECT * FROM accounts WHERE platform = ? ORDER BY id DESC", (platform.lower(),))
|
||||
# Case-insensitive Suche mit LOWER() für Backward-Compatibility
|
||||
cursor.execute("SELECT * FROM accounts WHERE LOWER(platform) = LOWER(?) ORDER BY id DESC", (canonical_platform,))
|
||||
rows = cursor.fetchall()
|
||||
|
||||
conn.close()
|
||||
@ -377,7 +392,17 @@ class DatabaseManager:
|
||||
cursor = conn.cursor()
|
||||
|
||||
if platform:
|
||||
cursor.execute("SELECT COUNT(*) FROM accounts WHERE platform = ?", (platform.lower(),))
|
||||
# Platform-Name standardisieren
|
||||
from domain.value_objects.platform_name import PlatformName
|
||||
try:
|
||||
platform_obj = PlatformName(platform)
|
||||
canonical_platform = platform_obj.canonical
|
||||
except ValueError:
|
||||
# Fallback für unbekannte Platforms
|
||||
canonical_platform = platform.lower()
|
||||
|
||||
# Case-insensitive Suche
|
||||
cursor.execute("SELECT COUNT(*) FROM accounts WHERE LOWER(platform) = LOWER(?)", (canonical_platform,))
|
||||
else:
|
||||
cursor.execute("SELECT COUNT(*) FROM accounts")
|
||||
|
||||
|
||||
In neuem Issue referenzieren
Einen Benutzer sperren