UI - МЕЖПРОЕКТНАЯ КОММУНИКАЦИЯ: трехсекционная шкала прогресса чекеров
This commit is contained in:
@@ -22,6 +22,7 @@ from plane.db.models import (
|
||||
ModuleIssue,
|
||||
IssueLabel,
|
||||
)
|
||||
from plane.utils.issue_checker_progress import attach_issue_checker_progress
|
||||
from typing import Optional, Dict, Tuple, Any, Union, List
|
||||
|
||||
|
||||
@@ -118,6 +119,7 @@ def issue_on_results(
|
||||
"parent_id",
|
||||
"cycle_id",
|
||||
"sub_issues_count",
|
||||
"detail_layout",
|
||||
"created_at",
|
||||
"updated_at",
|
||||
"created_by",
|
||||
@@ -141,7 +143,7 @@ def issue_on_results(
|
||||
original_list.append(sub_group_by)
|
||||
|
||||
required_fields.extend(original_list)
|
||||
return list(issues.values(*required_fields))
|
||||
return attach_issue_checker_progress(issues.values(*required_fields))
|
||||
|
||||
|
||||
def issue_group_values(
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
# Copyright (c) 2023-present Plane Software, Inc. and contributors
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
# See the LICENSE file for details.
|
||||
|
||||
STRUCTURED_BLOCKS_KEY = "nodedc_structured_blocks"
|
||||
|
||||
|
||||
def build_issue_checker_progress(detail_layout):
|
||||
blocks = detail_layout.get(STRUCTURED_BLOCKS_KEY) if isinstance(detail_layout, dict) else []
|
||||
|
||||
checker_blocks_count = 0
|
||||
checker_items_count = 0
|
||||
checker_items_completed_count = 0
|
||||
|
||||
if not isinstance(blocks, list):
|
||||
blocks = []
|
||||
|
||||
for block in blocks:
|
||||
if not isinstance(block, dict) or block.get("type") != "checker":
|
||||
continue
|
||||
|
||||
checker_blocks_count += 1
|
||||
items = block.get("items")
|
||||
|
||||
if not isinstance(items, list):
|
||||
continue
|
||||
|
||||
for item in items:
|
||||
if not isinstance(item, dict):
|
||||
continue
|
||||
|
||||
checker_items_count += 1
|
||||
if item.get("checked"):
|
||||
checker_items_completed_count += 1
|
||||
|
||||
return {
|
||||
"checker_blocks_count": checker_blocks_count,
|
||||
"checker_items_count": checker_items_count,
|
||||
"checker_items_completed_count": checker_items_completed_count,
|
||||
}
|
||||
|
||||
|
||||
def attach_issue_checker_progress(items):
|
||||
prepared_items = list(items)
|
||||
|
||||
for item in prepared_items:
|
||||
detail_layout = item.pop("detail_layout", None)
|
||||
item.update(build_issue_checker_progress(detail_layout))
|
||||
|
||||
return prepared_items
|
||||
Reference in New Issue
Block a user