feat(programmer): dated work-log corrections

Co-Authored-By: claude-flow <ruv@ruv.net>
This commit is contained in:
2026-09-28 14:08:28 +08:00
parent cc8d8ab8bf
commit be16a3cd0d
4 changed files with 85 additions and 13 deletions
@@ -16,11 +16,15 @@ import '../programmer_task_prompts.dart';
/// a non-assignee helper gets Hours + Minutes fields and is prompted to deduct
/// that time from their own running task. The assignee is prompted to pause
/// after logging.
///
/// When [workDate] is supplied the entry is a correction for a past day:
/// the header names that date and the pause/deduct prompts are skipped.
class WorkLogSection extends ConsumerStatefulWidget {
const WorkLogSection({super.key, required this.task, required this.isAssignee});
const WorkLogSection({super.key, required this.task, required this.isAssignee, this.workDate});
final ProgrammerTask task;
final bool isAssignee;
final DateTime? workDate;
@override
ConsumerState<WorkLogSection> createState() => _WorkLogSectionState();
@@ -68,15 +72,18 @@ class _WorkLogSectionState extends ConsumerState<WorkLogSection> {
taskId: widget.task.id,
description: quillToDeltaJson(_descQuill),
minutes: minutes,
workDate: widget.workDate,
);
_descQuill.clear();
_hoursCtrl.clear();
_minutesCtrl.clear();
if (!mounted) return;
if (widget.isAssignee) {
await maybePromptPauseTimer(context, ref, widget.task);
} else if (minutes != null) {
await maybePromptDeductHelperTime(context, ref, minutes, widget.task.id);
if (widget.workDate == null) {
if (widget.isAssignee) {
await maybePromptPauseTimer(context, ref, widget.task);
} else if (minutes != null) {
await maybePromptDeductHelperTime(context, ref, minutes, widget.task.id);
}
}
} catch (e) {
messenger.showSnackBar(SnackBar(content: Text('Could not save: $e')));
@@ -97,7 +104,11 @@ class _WorkLogSectionState extends ConsumerState<WorkLogSection> {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const AppSectionHeader('Work Log'),
AppSectionHeader(
widget.workDate != null
? 'Correction for ${AppTime.formatDate(widget.workDate!)}'
: 'Work Log',
),
QuillFieldEditor(
controller: _descQuill,
placeholder: widget.isAssignee