f9b8831c71
- Add workDate field to ProgrammerTaskWorkLog (defaults to Manila day of createdAt) - Add deltaJsonToPlainText function to quill_field.dart for Delta/plain text conversion - Implement buildDayRows function to generate day sheet rows with proper sorting - Implement DaySheetRow serialization and deserialization - Add comprehensive tests for day rows builder and workDate field - Verify backward compatibility via existing programmer_task_ledger_test Co-Authored-By: claude-flow <ruv@ruv.net>
45 lines
1.5 KiB
Dart
45 lines
1.5 KiB
Dart
import '../utils/app_time.dart';
|
|
import '../utils/programmer_daily_time.dart';
|
|
|
|
/// A work-log entry on a programmer task (plain, online-first model).
|
|
///
|
|
/// The assignee logs progress notes with [minutes] == null (their time comes
|
|
/// from the running clock). A non-assignee "helper" logs with [minutes] set —
|
|
/// their contributed time, which feeds the per-contributor time ledger and can
|
|
/// be deducted from the helper's own running task.
|
|
class ProgrammerTaskWorkLog {
|
|
final String id;
|
|
final String taskId;
|
|
final String authorId;
|
|
final String description;
|
|
final int? minutes;
|
|
final DateTime createdAt;
|
|
final DateTime workDate;
|
|
|
|
ProgrammerTaskWorkLog({
|
|
required this.id,
|
|
required this.taskId,
|
|
required this.authorId,
|
|
required this.description,
|
|
this.minutes,
|
|
required this.createdAt,
|
|
DateTime? workDate,
|
|
}) : workDate = workDate ?? manilaDay(createdAt);
|
|
|
|
factory ProgrammerTaskWorkLog.fromMap(Map<String, dynamic> map) {
|
|
final createdAt = AppTime.parse(map['created_at'] as String);
|
|
final workDate = map['work_date'] != null
|
|
? parseDayKey(map['work_date'] as String)
|
|
: manilaDay(createdAt);
|
|
return ProgrammerTaskWorkLog(
|
|
id: map['id'].toString(),
|
|
taskId: map['task_id'].toString(),
|
|
authorId: map['author_id'].toString(),
|
|
description: map['description'] as String? ?? '',
|
|
minutes: (map['minutes'] as num?)?.toInt(),
|
|
createdAt: createdAt,
|
|
workDate: workDate,
|
|
);
|
|
}
|
|
}
|