refactor(statistic): decouple statistics collection from report generation

Introduces a dedicated `HTMLReportGenerator` class in `report_generator.py` to handle all aspects of HTML and chart rendering. This decouples the report presentation logic from the data collection process within `StatisticOutputTask`.

Key changes include:
- Migrated all HTML and JavaScript generation into the new `HTMLReportGenerator`.
- Extracted all statistic key constants into a separate `statistic_keys.py` file for improved organization.
- Renamed `_generate_chart_data` to `_collect_chart_data` to better reflect its purpose.
- Improved data handling robustness by using `.get()` for dictionary access and safely handling database query results.
This commit is contained in:
minecraft1024a
2025-11-12 20:34:36 +08:00
committed by Windpicker-owo
parent db00b2aaf3
commit 8721546390
5 changed files with 429 additions and 692 deletions

View File

@@ -400,7 +400,7 @@ MoFox_Bot(第三方修改版)
base_init_tasks = [
async_task_manager.add_task(OnlineTimeRecordTask()),
async_task_manager.add_task(StatisticOutputTask()),
async_task_manager.add_task(TelemetryHeartBeatTask()),
#async_task_manager.add_task(TelemetryHeartBeatTask()),
]
await asyncio.gather(*base_init_tasks, return_exceptions=True)