Add support for project stats with children flag

This commit is contained in:
allegroai
2022-02-13 19:26:47 +02:00
parent 36e013b40c
commit e334246b46
4 changed files with 15 additions and 1 deletions

View File

@@ -456,11 +456,16 @@ class ProjectBLL:
company: str,
project_ids: Sequence[str],
specific_state: Optional[EntityVisibility] = None,
include_children: bool = True,
) -> Tuple[Dict[str, dict], Dict[str, dict]]:
if not project_ids:
return {}, {}
child_projects = _get_sub_projects(project_ids, _only=("id", "name"))
child_projects = (
_get_sub_projects(project_ids, _only=("id", "name"))
if include_children
else {}
)
project_ids_with_children = set(project_ids) | {
c.id for c in itertools.chain.from_iterable(child_projects.values())
}