fix(workspace): 修复今日日报刷新后丢失
This commit is contained in:
@@ -218,6 +218,106 @@ test('getWorkspaceDailyReport groups current user activities by category', () =>
|
||||
assert.equal(report.groups.delivery[0].context, 'FTB / 项目管理 / V1.0');
|
||||
});
|
||||
|
||||
test('getWorkspaceDailyReport counts actual hours from today activity sources', () => {
|
||||
const report = getWorkspaceDailyReport({
|
||||
activities: [
|
||||
{
|
||||
id: 'act-started',
|
||||
actorId: 'Alice',
|
||||
date: '2026-06-26',
|
||||
occurredAt: '2026-06-26T02:00:00.000Z',
|
||||
sourceType: 'dev_task',
|
||||
sourceId: 'task-activity-hours',
|
||||
action: 'dev_task_started',
|
||||
category: 'progress',
|
||||
title: 'Daily report hours',
|
||||
summary: 'Started development: Daily report hours',
|
||||
},
|
||||
{
|
||||
id: 'act-submitted',
|
||||
actorId: 'Alice',
|
||||
date: '2026-06-26',
|
||||
occurredAt: '2026-06-26T04:00:00.000Z',
|
||||
sourceType: 'dev_task',
|
||||
sourceId: 'task-activity-hours',
|
||||
action: 'dev_task_submitted',
|
||||
category: 'delivery',
|
||||
title: 'Daily report hours',
|
||||
summary: 'Submitted development task: Daily report hours',
|
||||
},
|
||||
],
|
||||
worklogs: [],
|
||||
workItems: [
|
||||
{
|
||||
id: 'task-activity-hours',
|
||||
type: 'devTask',
|
||||
title: 'Daily report hours',
|
||||
status: 'submitted',
|
||||
completed: true,
|
||||
productName: 'FTB',
|
||||
projectName: 'Project Management',
|
||||
versionName: 'V1.0',
|
||||
versionId: 'version-1',
|
||||
extra: {
|
||||
actualStartAt: '2026-06-26T02:00:00.000Z',
|
||||
actualEndAt: '2026-06-26T04:00:00.000Z',
|
||||
},
|
||||
raw: {
|
||||
id: 'task-activity-hours',
|
||||
actualStartAt: '2026-06-26T02:00:00.000Z',
|
||||
actualEndAt: '2026-06-26T04:00:00.000Z',
|
||||
status: 'submitted',
|
||||
updatedAt: '2026-06-26T04:00:00.000Z',
|
||||
} as any,
|
||||
},
|
||||
],
|
||||
userId: 'Alice',
|
||||
date: '2026-06-26',
|
||||
});
|
||||
|
||||
assert.equal(report.totalHours, 2);
|
||||
assert.equal(report.totalCount, 2);
|
||||
});
|
||||
|
||||
test('getWorkspaceDailyReport rebuilds activity evidence from persisted work item timestamps', () => {
|
||||
const report = getWorkspaceDailyReport({
|
||||
activities: [],
|
||||
worklogs: [],
|
||||
workItems: [
|
||||
{
|
||||
id: 'task-refresh-recovery',
|
||||
type: 'devTask',
|
||||
title: 'Refresh recovery',
|
||||
status: 'submitted',
|
||||
completed: true,
|
||||
productName: 'FTB',
|
||||
projectName: 'Project Management',
|
||||
versionName: 'V1.0',
|
||||
versionId: 'version-1',
|
||||
extra: {
|
||||
actualStartAt: '2026-06-26T02:00:00.000Z',
|
||||
actualEndAt: '2026-06-26T04:00:00.000Z',
|
||||
},
|
||||
raw: {
|
||||
id: 'task-refresh-recovery',
|
||||
title: 'Refresh recovery',
|
||||
actualStartAt: '2026-06-26T02:00:00.000Z',
|
||||
actualEndAt: '2026-06-26T04:00:00.000Z',
|
||||
status: 'submitted',
|
||||
updatedAt: '2026-06-26T04:00:00.000Z',
|
||||
} as any,
|
||||
},
|
||||
],
|
||||
userId: 'Alice',
|
||||
date: '2026-06-26',
|
||||
});
|
||||
|
||||
assert.deepEqual(report.groups.progress.map((item) => item.action), ['dev_task_started']);
|
||||
assert.deepEqual(report.groups.delivery.map((item) => item.action), ['dev_task_submitted']);
|
||||
assert.equal(report.totalHours, 2);
|
||||
assert.equal(report.totalCount, 2);
|
||||
});
|
||||
|
||||
test('getWorkspaceDailyReport flags multi-day in-progress items without today progress', () => {
|
||||
const report = getWorkspaceDailyReport({
|
||||
activities,
|
||||
|
||||
Reference in New Issue
Block a user