fix(version): 修正概览耗时与排名统计
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import type { Priority } from './derive';
|
||||
import { calcWorkHours, formatWorkHours, type TimeInterval } from './work-hours';
|
||||
import { calcActualElapsedHours, calcWorkHours, formatWorkHours, type TimeInterval } from './work-hours';
|
||||
|
||||
export type DevTaskStatus = 'todo' | 'in_progress' | 'testing' | 'submitted';
|
||||
|
||||
@@ -114,8 +114,8 @@ function roundEffortHours(hours: number): number {
|
||||
|
||||
export function getActualHours(task: DevTask, now: Date = new Date()): number {
|
||||
if (!task.actualStartAt) return 0;
|
||||
const end = task.actualEndAt ?? now.toISOString();
|
||||
return calcWorkHours(task.actualStartAt, end);
|
||||
const end = task.actualEndAt ?? (task.status === 'submitted' ? task.updatedAt : now.toISOString());
|
||||
return calcActualElapsedHours(task.actualStartAt, end);
|
||||
}
|
||||
|
||||
export interface AggregatedHours {
|
||||
@@ -167,7 +167,7 @@ export function devTaskIntervals(tasks: DevTask[], now: Date = new Date()): Time
|
||||
const nowIso = now.toISOString();
|
||||
for (const t of tasks) {
|
||||
if (!t.actualStartAt) continue;
|
||||
out.push({ start: t.actualStartAt, end: t.actualEndAt ?? nowIso });
|
||||
out.push({ start: t.actualStartAt, end: t.actualEndAt ?? (t.status === 'submitted' ? t.updatedAt : nowIso) });
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user