From 12842bfa12a86a1977ddb906f0f45a3e8d29473a Mon Sep 17 00:00:00 2001 From: Marc Rejohn Castillano Date: Sun, 27 Sep 2026 21:08:30 +0800 Subject: [PATCH] =?UTF-8?q?fix(programmer):=20day=20rows=20=E2=80=94=20Del?= =?UTF-8?q?ta=20JSON=20test=20+=20non-assignee=20row=20gate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add Delta JSON happy-path test case to deltaJsonToPlainText tests - Fix double-row bug: notes-only assignee rows only when userId == assigneeId - Remove dead code: tautological taskMap.containsKey check in loop Co-Authored-By: claude-flow --- lib/utils/programmer_day_rows.dart | 14 +++++++------- test/programmer_day_rows_test.dart | 4 ++++ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/lib/utils/programmer_day_rows.dart b/lib/utils/programmer_day_rows.dart index 896bcf90..0cb13d8c 100644 --- a/lib/utils/programmer_day_rows.dart +++ b/lib/utils/programmer_day_rows.dart @@ -74,8 +74,6 @@ List buildDayRows({ // Process each task for (final task in tasks) { - if (!taskMap.containsKey(task.id)) continue; - final assigneeId = task.assigneeId; // Compute daily seconds for this task @@ -88,12 +86,14 @@ List buildDayRows({ final userDailySeconds = dailyByAssignee[userId] ?? {}; final assigneeSeconds = userDailySeconds[day] ?? 0; - // Check for assignee row: has seconds that day OR authored notes-only log that day + // Check for assignee row: has seconds that day OR (is assignee AND authored notes-only log that day) final assigneeLogsKey = '${task.id}:$userId'; - final assigneeLogsThisDay = workLogsByTaskAndAuthor[assigneeLogsKey] - ?.where((l) => l.workDate == day && l.minutes == null) - .toList() ?? - []; + final assigneeLogsThisDay = (userId == assigneeId) + ? (workLogsByTaskAndAuthor[assigneeLogsKey] + ?.where((l) => l.workDate == day && l.minutes == null) + .toList() ?? + []) + : []; if (assigneeSeconds > 0 || assigneeLogsThisDay.isNotEmpty) { final notes = assigneeLogsThisDay diff --git a/test/programmer_day_rows_test.dart b/test/programmer_day_rows_test.dart index 60cb7639..a2c337c6 100644 --- a/test/programmer_day_rows_test.dart +++ b/test/programmer_day_rows_test.dart @@ -24,6 +24,10 @@ void main() { expect(deltaJsonToPlainText('[{invalid json'), '[{invalid json'); }); + test('Delta JSON with insert is converted to plain text', () { + expect(deltaJsonToPlainText('[{"insert":"Hello\\n"}]'), 'Hello'); + }); + test('Delta JSON arrays starting with [ are attempted to be parsed', () { // The function attempts to parse JSON that starts with '[' // If parsing fails, it returns the trimmed string