diff --git a/.serena/cache/php/document_symbols_cache_v23-06-25.pkl b/.serena/cache/php/document_symbols_cache_v23-06-25.pkl index 2953471..420c1a2 100644 Binary files a/.serena/cache/php/document_symbols_cache_v23-06-25.pkl and b/.serena/cache/php/document_symbols_cache_v23-06-25.pkl differ diff --git a/app/Services/JiraService.php b/app/Services/JiraService.php index 0b3765e..51596a1 100644 --- a/app/Services/JiraService.php +++ b/app/Services/JiraService.php @@ -132,9 +132,9 @@ class JiraService throw new \InvalidArgumentException('用户名不能为空'); } - // 查询分配给用户且未完成的任务(不包括子任务) + // 查询分配给用户且未完成的需求(Story/需求类型,不包括子任务) $jql = sprintf( - 'assignee = "%s" AND status != "Done" AND issuetype != "Sub-task" ORDER BY created ASC', + 'assignee = "%s" AND status != "Done" AND issuetype in ("Story", "需求") ORDER BY created ASC', $username ); @@ -181,7 +181,10 @@ class JiraService } else { // 按Sprint分类的需求 if ($organizedTasks->has('sprints') && $organizedTasks['sprints']->isNotEmpty()) { - foreach ($organizedTasks['sprints'] as $sprintName => $tasks) { + $sortedSprints = $organizedTasks['sprints']->sortKeysUsing( + static fn ($left, $right) => strnatcasecmp((string) $left, (string) $right) + ); + foreach ($sortedSprints as $sprintName => $tasks) { $markdown .= "### {$sprintName}\n"; foreach ($tasks as $task) { $checkbox = $this->isTaskCompleted($task['status']) ? '[x]' : '[ ]'; @@ -607,22 +610,23 @@ class JiraService */ private function isTaskCompleted(string $status): bool { - // 不打勾的状态(未完成状态) - $incompleteStatuses = [ - '开发中', - '需求已排期', - '需求已评审', - 'In Progress', - 'To Do', - 'Open', - 'Reopened', - 'In Review', - 'Code Review', - 'Testing', - 'Ready for Testing' + // 只有已完成或已取消才打勾 + $completedStatuses = [ + '已完成', + '完成', + 'Done', + 'Closed', + 'Resolved', + ]; + $cancelledStatuses = [ + '已取消', + '取消', + 'Cancelled', + 'Canceled', ]; - return !in_array($status, $incompleteStatuses, true); + return in_array($status, $completedStatuses, true) + || in_array($status, $cancelledStatuses, true); } /** @@ -641,6 +645,15 @@ class JiraService foreach ($workLogs as $workLog) { $issueKey = $workLog['issue_key']; $issueType = $workLog['issue_type'] ?? 'Unknown'; + $issueSummary = $workLog['issue_summary'] ?? ''; + $parentSummary = $workLog['parent_task']['summary'] ?? ''; + $excludeKeyword = '工作日志'; + + // 排除工作日志相关的Jira + if ((is_string($issueSummary) && mb_strpos($issueSummary, $excludeKeyword) !== false) + || (is_string($parentSummary) && mb_strpos($parentSummary, $excludeKeyword) !== false)) { + continue; + } // 避免重复处理同一个任务 if ($processedIssues->has($issueKey)) {