fix(version): 修正概览耗时与排名统计

This commit is contained in:
Script Generator
2026-06-26 13:06:22 +08:00
parent 4cda624dc7
commit dde7a9a623
9 changed files with 857 additions and 367 deletions

View File

@@ -1,5 +1,5 @@
import type { Priority } from './derive';
import { calcWorkHours, type TimeInterval } from './work-hours';
import { calcActualElapsedHours, type TimeInterval } from './work-hours';
export type BugStatus = 'open' | 'fixing' | 'fixed' | 'verifying' | 'closed' | 'rejected';
export type BugSeverity = 'critical' | 'major' | 'minor' | 'trivial';
@@ -32,6 +32,8 @@ export interface Bug {
resolvedAt?: string;
closedAt?: string;
resolution?: string;
estimateHours?: number;
aiEstimateHours?: number;
createdAt: string;
updatedAt: string;
}
@@ -93,7 +95,7 @@ export function getBugActualHours(bug: Bug, now: Date = new Date()): number {
const start = bug.createdAt;
if (!start) return 0;
const end = bug.closedAt ?? bug.resolvedAt ?? (bug.status === 'closed' || bug.status === 'rejected' ? bug.updatedAt : now.toISOString());
return calcWorkHours(start, end);
return calcActualElapsedHours(start, end);
}
export function aggregateBugActualHours(bugs: Bug[], now: Date = new Date()): number {