Skip to content

Commit

Permalink
Fix project statistics calculation when both include and exclude chil…
Browse files Browse the repository at this point in the history
…d task filters present
  • Loading branch information
clearml committed Dec 31, 2024
1 parent e94d7fc commit dbebdf2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions apiserver/bll/project/project_bll.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ def move_project(

now = datetime.utcnow()
affected = set()
p: Project
for p in filter(None, (old_parent, new_parent)):
p.update(last_update=now)
affected.update({p.id, *(p.path or [])})
Expand All @@ -184,6 +185,7 @@ def update(cls, company: str, project_id: str, **fields):

new_name = fields.pop("name", None)
if new_name:
# noinspection PyTypeChecker
new_name, new_location = _validate_project_name(new_name)
old_name, old_location = _validate_project_name(project.name)
if new_location != old_location:
Expand Down Expand Up @@ -823,7 +825,7 @@ def sum_status_count(
}

def sum_runtime(
a: Mapping[str, Mapping], b: Mapping[str, Mapping]
a: Mapping[str, dict], b: Mapping[str, dict]
) -> Dict[str, dict]:
return {
section: a.get(section, 0) + b.get(section, 0)
Expand Down Expand Up @@ -1059,7 +1061,7 @@ def get_task_parents(
if not parent_ids:
return []

parents = Task.get_many_with_join(
parents: Sequence[dict] = Task.get_many_with_join(
company_id,
query=Q(id__in=parent_ids),
query_dict={"name": name} if name else None,
Expand Down Expand Up @@ -1166,7 +1168,7 @@ def get_match_conditions(

if or_conditions:
if len(or_conditions) == 1:
conditions = next(iter(or_conditions))
conditions.update(next(iter(or_conditions)))
else:
conditions["$and"] = [c for c in or_conditions]

Expand Down

0 comments on commit dbebdf2

Please sign in to comment.