import sqlite3 from datetime import datetime conn = sqlite3.connect("/app/tracker.db") cursor = conn.cursor() # 先查看当前 Phase 4 任务 cursor.execute('SELECT name, status FROM tasks WHERE phase LIKE "%Phase 4%" OR phase LIKE "%Phase%4%"') tasks = cursor.fetchall() print(f"当前 Phase 4 任务数: {len(tasks)}") for name, status in tasks[:5]: print(f" - {name}: {status}") # Phase 4 已完成的关键任务 phase4_completed_keywords = [ "JWT", "Password", "Redis", "Email", "注册", "登录", "登出", "密码重置", "工作空间", "邀请", "成员", "权限", "订阅", "Repository", "API", "Docker", "Kubernetes", "健康检查", "Celery", "GitHub", "测试", "文档", "MIT", "README", ] # 更新所有包含关键词的 Phase 4 任务为已完成 now = datetime.now().isoformat() updated = 0 for keyword in phase4_completed_keywords: cursor.execute( """ UPDATE tasks SET status = 'completed', updated_at = ? WHERE (phase LIKE "%Phase 4%" OR phase LIKE "%Phase%4%") AND (name LIKE ? OR description LIKE ?) AND status != 'completed' """, (now, f"%{keyword}%", f"%{keyword}%"), ) updated += cursor.rowcount conn.commit() # 统计结果 cursor.execute( 'SELECT COUNT(*) FROM tasks WHERE (phase LIKE "%Phase 4%" OR phase LIKE "%Phase%4%") AND status = "completed"' ) completed = cursor.fetchone()[0] cursor.execute('SELECT COUNT(*) FROM tasks WHERE phase LIKE "%Phase 4%" OR phase LIKE "%Phase%4%"') total = cursor.fetchone()[0] print(f"\n✅ 更新完成:") print(f" - 本次更新: {updated} 个任务") print(f" - Phase 4 进度: {completed}/{total} 已完成 ({completed/total*100:.1f}%)") conn.close()