fix(programmer): reassignment while paused must not open new segment
Capture whether segment was running before reassignment, and only reopen for new assignee if it was. A paused task that gets reassigned should not start accruing time for the new assignee until explicitly resumed. Also add test: reassignment while paused does not open segment. Co-Authored-By: claude-flow <ruv@ruv.net>
This commit is contained in:
@@ -235,4 +235,33 @@ void main() {
|
||||
final result = dailySecondsByAssignee(task: task, logs: logs, now: now);
|
||||
expect(result['a']![DateTime.utc(2026, 9, 27)], 3600); // not 6 hours
|
||||
});
|
||||
|
||||
test('reassignment while paused does not open a new segment for the new assignee', () {
|
||||
// task: started 09:00, paused 10:00, reassigned {assignee_id:'b'} 11:00, completed 12:00 (all Sep 27)
|
||||
// expected: a -> 3600s (09-10), b -> 0 (no interval opened after paused reassignment)
|
||||
final task = _task(
|
||||
status: ProgrammerTaskStatus.completed,
|
||||
creatorId: 'a',
|
||||
assigneeId: 'b',
|
||||
startedAt: AppTime.fromComponents(year: 2026, month: 9, day: 27, hour: 9),
|
||||
completedAt:
|
||||
AppTime.fromComponents(year: 2026, month: 9, day: 27, hour: 12),
|
||||
);
|
||||
final logs = [
|
||||
_ev('started', 27, 9),
|
||||
_ev('paused', 27, 10),
|
||||
_ev('reassigned', 27, 11, 0, {'assignee_id': 'b'}),
|
||||
_ev('completed', 27, 12),
|
||||
];
|
||||
final now =
|
||||
AppTime.fromComponents(year: 2026, month: 9, day: 27, hour: 20);
|
||||
|
||||
final result = dailySecondsByAssignee(task: task, logs: logs, now: now);
|
||||
expect(result['a']![DateTime.utc(2026, 9, 27)], 3600); // a worked 09-10
|
||||
// b should have no time, or null entry
|
||||
expect(
|
||||
result['b']?[DateTime.utc(2026, 9, 27)] ?? 0,
|
||||
0,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user