feat(ai): 优化拆解重跑与结果展示

This commit is contained in:
Script Generator
2026-06-26 11:01:11 +08:00
parent 55e24442ab
commit 56e0fe562d
36 changed files with 1342 additions and 186 deletions

View File

@@ -18,6 +18,7 @@ export interface TestCase {
assigneeId?: string;
status: TestCaseStatus;
estimateHours?: number;
aiEstimateHours?: number;
startedAt?: string;
completedAt?: string;
executedAt?: string;
@@ -88,7 +89,8 @@ export function normalizeTestCase(testCase: Partial<TestCase>, index = 0): TestC
priority: testCase.priority || 'P2',
assigneeId: testCase.assigneeId,
status: testCase.status || 'pending',
estimateHours: typeof testCase.estimateHours === 'number' && testCase.estimateHours > 0 ? testCase.estimateHours : 0.5,
estimateHours: typeof testCase.estimateHours === 'number' && testCase.estimateHours > 0 ? testCase.estimateHours : undefined,
aiEstimateHours: typeof testCase.aiEstimateHours === 'number' && testCase.aiEstimateHours > 0 ? testCase.aiEstimateHours : undefined,
startedAt: testCase.startedAt,
completedAt: testCase.completedAt,
executedAt: testCase.executedAt,
@@ -125,9 +127,13 @@ export function calcTestProgress(cases: TestCase[]): { total: number; executed:
}
export function getTestCaseEstimateHours(tc: TestCase): number {
return typeof tc.estimateHours === 'number' && tc.estimateHours > 0
? Math.round(tc.estimateHours * 2) / 2
: 0.5;
if (typeof tc.estimateHours === 'number' && tc.estimateHours > 0) {
return Number(tc.estimateHours.toFixed(2));
}
if (typeof tc.aiEstimateHours === 'number' && tc.aiEstimateHours > 0) {
return Number(tc.aiEstimateHours.toFixed(2));
}
return 0;
}
export function getTestCaseActualHours(tc: TestCase, now: Date = new Date()): number {