#feature: update weeklyreport task status
This commit is contained in:
Binary file not shown.
@@ -132,9 +132,9 @@ class JiraService
|
|||||||
throw new \InvalidArgumentException('用户名不能为空');
|
throw new \InvalidArgumentException('用户名不能为空');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询分配给用户且未完成的任务(不包括子任务)
|
// 查询分配给用户且未完成的需求(Story/需求类型,不包括子任务)
|
||||||
$jql = sprintf(
|
$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
|
$username
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -181,7 +181,10 @@ class JiraService
|
|||||||
} else {
|
} else {
|
||||||
// 按Sprint分类的需求
|
// 按Sprint分类的需求
|
||||||
if ($organizedTasks->has('sprints') && $organizedTasks['sprints']->isNotEmpty()) {
|
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";
|
$markdown .= "### {$sprintName}\n";
|
||||||
foreach ($tasks as $task) {
|
foreach ($tasks as $task) {
|
||||||
$checkbox = $this->isTaskCompleted($task['status']) ? '[x]' : '[ ]';
|
$checkbox = $this->isTaskCompleted($task['status']) ? '[x]' : '[ ]';
|
||||||
@@ -607,22 +610,23 @@ class JiraService
|
|||||||
*/
|
*/
|
||||||
private function isTaskCompleted(string $status): bool
|
private function isTaskCompleted(string $status): bool
|
||||||
{
|
{
|
||||||
// 不打勾的状态(未完成状态)
|
// 只有已完成或已取消才打勾
|
||||||
$incompleteStatuses = [
|
$completedStatuses = [
|
||||||
'开发中',
|
'已完成',
|
||||||
'需求已排期',
|
'完成',
|
||||||
'需求已评审',
|
'Done',
|
||||||
'In Progress',
|
'Closed',
|
||||||
'To Do',
|
'Resolved',
|
||||||
'Open',
|
];
|
||||||
'Reopened',
|
$cancelledStatuses = [
|
||||||
'In Review',
|
'已取消',
|
||||||
'Code Review',
|
'取消',
|
||||||
'Testing',
|
'Cancelled',
|
||||||
'Ready for Testing'
|
'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) {
|
foreach ($workLogs as $workLog) {
|
||||||
$issueKey = $workLog['issue_key'];
|
$issueKey = $workLog['issue_key'];
|
||||||
$issueType = $workLog['issue_type'] ?? 'Unknown';
|
$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)) {
|
if ($processedIssues->has($issueKey)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user