fix(programmer): day rows — Delta JSON test + non-assignee row gate
- 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 <ruv@ruv.net>
This commit is contained in:
@@ -74,8 +74,6 @@ List<DaySheetRow> buildDayRows({
|
|||||||
|
|
||||||
// Process each task
|
// Process each task
|
||||||
for (final task in tasks) {
|
for (final task in tasks) {
|
||||||
if (!taskMap.containsKey(task.id)) continue;
|
|
||||||
|
|
||||||
final assigneeId = task.assigneeId;
|
final assigneeId = task.assigneeId;
|
||||||
|
|
||||||
// Compute daily seconds for this task
|
// Compute daily seconds for this task
|
||||||
@@ -88,12 +86,14 @@ List<DaySheetRow> buildDayRows({
|
|||||||
final userDailySeconds = dailyByAssignee[userId] ?? {};
|
final userDailySeconds = dailyByAssignee[userId] ?? {};
|
||||||
final assigneeSeconds = userDailySeconds[day] ?? 0;
|
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 assigneeLogsKey = '${task.id}:$userId';
|
||||||
final assigneeLogsThisDay = workLogsByTaskAndAuthor[assigneeLogsKey]
|
final assigneeLogsThisDay = (userId == assigneeId)
|
||||||
?.where((l) => l.workDate == day && l.minutes == null)
|
? (workLogsByTaskAndAuthor[assigneeLogsKey]
|
||||||
.toList() ??
|
?.where((l) => l.workDate == day && l.minutes == null)
|
||||||
[];
|
.toList() ??
|
||||||
|
[])
|
||||||
|
: [];
|
||||||
|
|
||||||
if (assigneeSeconds > 0 || assigneeLogsThisDay.isNotEmpty) {
|
if (assigneeSeconds > 0 || assigneeLogsThisDay.isNotEmpty) {
|
||||||
final notes = assigneeLogsThisDay
|
final notes = assigneeLogsThisDay
|
||||||
|
|||||||
@@ -24,6 +24,10 @@ void main() {
|
|||||||
expect(deltaJsonToPlainText('[{invalid json'), '[{invalid json');
|
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', () {
|
test('Delta JSON arrays starting with [ are attempted to be parsed', () {
|
||||||
// The function attempts to parse JSON that starts with '['
|
// The function attempts to parse JSON that starts with '['
|
||||||
// If parsing fails, it returns the trimmed string
|
// If parsing fails, it returns the trimmed string
|
||||||
|
|||||||
Reference in New Issue
Block a user