This commit is contained in:
@@ -48,16 +48,24 @@ def map_source_to_description(source: str) -> str:
|
||||
elif "omdb:" in source_lower:
|
||||
return "OMDb Release"
|
||||
|
||||
# Sonarr sources
|
||||
elif "sonarr:" in source_lower:
|
||||
return "Sonarr API"
|
||||
|
||||
# Manual and other sources
|
||||
elif "manual" in source_lower:
|
||||
return "Manual Entry"
|
||||
elif "digital_release" in source_lower:
|
||||
return "Digital Release"
|
||||
elif "nfo_file_existing" in source_lower:
|
||||
return "NFO File (Legacy)"
|
||||
elif "nfo:" in source_lower:
|
||||
return "NFO File"
|
||||
elif "webhook:" in source_lower:
|
||||
return "Webhook/API"
|
||||
|
||||
elif "database" in source_lower:
|
||||
return "Database"
|
||||
|
||||
# Fallback for unknown patterns
|
||||
return source.title()
|
||||
|
||||
@@ -468,11 +476,18 @@ async def get_dashboard_stats(dependencies: dict):
|
||||
|
||||
cursor.execute("SELECT COUNT(*) FROM episodes WHERE source = 'no_valid_date_source'")
|
||||
episodes_no_valid_source = db._get_first_value(cursor.fetchone())
|
||||
|
||||
# Recent activity (last 7 days)
|
||||
|
||||
# Recent activity (last 7 days) - count items processed, not history events
|
||||
cursor.execute("""
|
||||
SELECT COUNT(*) FROM processing_history
|
||||
WHERE processed_at > NOW() - INTERVAL '7 days'
|
||||
SELECT COUNT(*) FROM (
|
||||
SELECT imdb_id FROM movies
|
||||
WHERE created_at > NOW() - INTERVAL '7 days'
|
||||
OR updated_at > NOW() - INTERVAL '7 days'
|
||||
UNION
|
||||
SELECT DISTINCT imdb_id FROM episodes
|
||||
WHERE created_at > NOW() - INTERVAL '7 days'
|
||||
OR updated_at > NOW() - INTERVAL '7 days'
|
||||
) AS recent_items
|
||||
""")
|
||||
recent_activity = db._get_first_value(cursor.fetchone())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user