From bc9fa5a798918a6e529b4f27a6eb3e48d2513a1e Mon Sep 17 00:00:00 2001 From: seaislee1209 Date: Thu, 5 Mar 2026 21:51:36 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=8A=A5=E5=91=8A=E8=BF=9B=E5=BA=A6?= =?UTF-8?q?=E5=8F=AA=E7=AE=97=E4=B8=AD=E6=9C=9F=E4=BA=A7=E5=87=BA=20+=20?= =?UTF-8?q?=E7=A7=BB=E9=99=A4=E6=97=A0=E6=95=88=E6=97=A5=E6=8A=A5=E6=8E=A5?= =?UTF-8?q?=E6=94=B6=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 日报/周报进度从 total_submitted_seconds 改为只算 PRODUCTION 阶段 (修复魔法少女 398%→118% 等虚高问题) - 移除日报接收人 17762840667(飞书发送失败) Co-Authored-By: Claude Opus 4.6 --- backend/.env | 2 +- backend/services/report_service.py | 20 ++++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/backend/.env b/backend/.env index a45c59c..1f20f1b 100644 --- a/backend/.env +++ b/backend/.env @@ -15,6 +15,6 @@ FEISHU_APP_ID=cli_a90478156bf85bd7 FEISHU_APP_SECRET=87N2nnx6Yv56TPjl2GraLdKOjFiGOSGp # 日报接收人手机号(主管+组长+制片+股东) -DAILY_REPORT_RECEIVERS=18002277047,13811803069,13636518028,13811126887,19521028015,13570527019,15920585849,17762840667,17798147128,13726331058,13751770010,18826166683 +DAILY_REPORT_RECEIVERS=18002277047,13811803069,13636518028,13811126887,19521028015,13570527019,15920585849,17798147128,13726331058,13751770010,18826166683 # 周报/月报接收人手机号(含成本信息,仅股东+主管) REPORT_RECEIVERS=18002277047,13811803069,13636518028,13811126887 diff --git a/backend/services/report_service.py b/backend/services/report_service.py index a5eceec..3ad40d4 100644 --- a/backend/services/report_service.py +++ b/backend/services/report_service.py @@ -93,10 +93,14 @@ def generate_daily_report(db: Session) -> dict: projects_data = [] for p in active_projects: - waste = calc_waste_for_project(p.id, db) - total_secs = waste.get("total_submitted_seconds", 0) + # 只用中期产出算进度(与项目详情页一致) + prod_secs = db.query(sa_func.sum(Submission.total_seconds)).filter( + Submission.project_id == p.id, + Submission.total_seconds > 0, + Submission.project_phase == PhaseGroup.PRODUCTION, + ).scalar() or 0 target = p.target_total_seconds - progress = round(total_secs / target * 100, 1) if target > 0 else 0 + progress = round(prod_secs / target * 100, 1) if target > 0 else 0 proj_today_secs = sum( s.total_seconds for s in today_subs @@ -191,10 +195,14 @@ def generate_weekly_report(db: Session) -> dict: projects_data = [] for p in active_projects: - waste = calc_waste_for_project(p.id, db) - total_secs = waste.get("total_submitted_seconds", 0) + # 只用中期产出算进度(与项目详情页一致) + prod_secs = db.query(sa_func.sum(Submission.total_seconds)).filter( + Submission.project_id == p.id, + Submission.total_seconds > 0, + Submission.project_phase == PhaseGroup.PRODUCTION, + ).scalar() or 0 target = p.target_total_seconds - progress = round(total_secs / target * 100, 1) if target > 0 else 0 + progress = round(prod_secs / target * 100, 1) if target > 0 else 0 proj_week_secs = sum( s.total_seconds for s in week_subs