#feature: update weeklyreport task status
This commit is contained in:
Binary file not shown.
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user