mirror of
https://github.com/rommapp/romm.git
synced 2026-07-01 08:16:21 +00:00
Enhances the server stats page with two new per-platform statistics: - Metadata coverage: shows which sources matched ROMs (ordered by user's scan priority config) - Region breakdown: shows ROM counts per region with flag emojis Backend adds two new efficient queries (single GROUP BY for metadata, Python-side aggregation for regions). Frontend redesigns platform cards with a tabular detail layout, size bar visualization, and expandable region chips. > This PR was developed with AI assistance (Claude Code) per CONTRIBUTING.md disclosure requirements. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
29 lines
896 B
Python
29 lines
896 B
Python
from endpoints.responses.stats import StatsReturn
|
|
from handler.database import db_stats_handler
|
|
from utils.router import APIRouter
|
|
|
|
router = APIRouter(
|
|
prefix="/stats",
|
|
tags=["stats"],
|
|
)
|
|
|
|
|
|
@router.get("")
|
|
def stats() -> StatsReturn:
|
|
"""Endpoint to return the current RomM stats
|
|
|
|
Returns:
|
|
dict: Dictionary with all the stats
|
|
"""
|
|
|
|
return {
|
|
"PLATFORMS": db_stats_handler.get_platforms_count(),
|
|
"ROMS": db_stats_handler.get_roms_count(),
|
|
"SAVES": db_stats_handler.get_saves_count(),
|
|
"STATES": db_stats_handler.get_states_count(),
|
|
"SCREENSHOTS": db_stats_handler.get_screenshots_count(),
|
|
"TOTAL_FILESIZE_BYTES": db_stats_handler.get_total_filesize(),
|
|
"METADATA_COVERAGE": db_stats_handler.get_metadata_coverage_by_platform(),
|
|
"REGION_BREAKDOWN": db_stats_handler.get_region_breakdown_by_platform(),
|
|
}
|