feat(ai): 优化拆解重跑与结果展示
This commit is contained in:
@@ -26,6 +26,7 @@ export interface DevTask {
|
||||
expectedStartAt: string;
|
||||
expectedEndAt: string;
|
||||
estimateHours?: number;
|
||||
aiEstimateHours?: number;
|
||||
actualStartAt?: string;
|
||||
actualEndAt?: string;
|
||||
|
||||
@@ -98,12 +99,19 @@ export function formatHours(hours: number): string {
|
||||
|
||||
export function getEstimateHours(task: DevTask): number {
|
||||
if (typeof task.estimateHours === 'number' && task.estimateHours > 0) {
|
||||
return Math.round(task.estimateHours * 2) / 2;
|
||||
return roundEffortHours(task.estimateHours);
|
||||
}
|
||||
if (typeof task.aiEstimateHours === 'number' && task.aiEstimateHours > 0) {
|
||||
return roundEffortHours(task.aiEstimateHours);
|
||||
}
|
||||
if (!task.expectedStartAt || !task.expectedEndAt) return 0;
|
||||
return calcWorkHours(task.expectedStartAt, task.expectedEndAt);
|
||||
}
|
||||
|
||||
function roundEffortHours(hours: number): number {
|
||||
return Number(hours.toFixed(2));
|
||||
}
|
||||
|
||||
export function getActualHours(task: DevTask, now: Date = new Date()): number {
|
||||
if (!task.actualStartAt) return 0;
|
||||
const end = task.actualEndAt ?? now.toISOString();
|
||||
|
||||
Reference in New Issue
Block a user