fix: 公式报告进度步数用实际脉冲数而非原始数据量 (87→30)
旧: total_steps = 4 + 63 + 20 = 87 (但大部分步骤不发脉冲) 新: total_steps = 4 + 63//10 + 20 = 30 (与 _next 调用次数一致)
This commit is contained in:
@ -956,14 +956,14 @@ class WaterQualityReportGenerator:
|
||||
else:
|
||||
output_path = Path(output_path)
|
||||
|
||||
# 扫描实际数据量
|
||||
# 扫描实际数据量,计算进度脉冲数(非数据量本身)
|
||||
csv_files = sorted(csv_dir.glob("*.csv")) if csv_dir.is_dir() else []
|
||||
tif_files = (sorted(thematic_dir.glob("*.tif")) + sorted(thematic_dir.glob("*.png"))
|
||||
) if thematic_dir.is_dir() else []
|
||||
n_csv = len(csv_files)
|
||||
n_maps = min(len(tif_files), 20) # 最多展示 20 张
|
||||
n_fixed = 4 # 封面 + 背景 + 预处理 + 总结
|
||||
total_steps = n_fixed + n_csv + n_maps
|
||||
n_maps = min(len(tif_files), 20)
|
||||
n_csv_pulses = max(1, n_csv // 10) # 每 10 个 CSV 一次脉冲
|
||||
total_steps = 4 + n_csv_pulses + n_maps # 固定章节 + 统计脉冲 + 每张专题图
|
||||
print(f"[公式报告] 数据: {n_csv} CSV, {len(tif_files)} 专题图 → 总步数 {total_steps}")
|
||||
|
||||
progress = self._create_progress(total=total_steps, desc="生成公式报告", on_step=on_progress)
|
||||
|
||||
Reference in New Issue
Block a user