mirror of
https://github.com/clearml/clearml-server
synced 2025-02-07 05:27:23 +00:00
Fix project statistics calculation when both include and exclude child task filters present
This commit is contained in:
parent
e94d7fcfa9
commit
dbebdf2885
@ -170,6 +170,7 @@ class ProjectBLL:
|
|||||||
|
|
||||||
now = datetime.utcnow()
|
now = datetime.utcnow()
|
||||||
affected = set()
|
affected = set()
|
||||||
|
p: Project
|
||||||
for p in filter(None, (old_parent, new_parent)):
|
for p in filter(None, (old_parent, new_parent)):
|
||||||
p.update(last_update=now)
|
p.update(last_update=now)
|
||||||
affected.update({p.id, *(p.path or [])})
|
affected.update({p.id, *(p.path or [])})
|
||||||
@ -184,6 +185,7 @@ class ProjectBLL:
|
|||||||
|
|
||||||
new_name = fields.pop("name", None)
|
new_name = fields.pop("name", None)
|
||||||
if new_name:
|
if new_name:
|
||||||
|
# noinspection PyTypeChecker
|
||||||
new_name, new_location = _validate_project_name(new_name)
|
new_name, new_location = _validate_project_name(new_name)
|
||||||
old_name, old_location = _validate_project_name(project.name)
|
old_name, old_location = _validate_project_name(project.name)
|
||||||
if new_location != old_location:
|
if new_location != old_location:
|
||||||
@ -823,7 +825,7 @@ class ProjectBLL:
|
|||||||
}
|
}
|
||||||
|
|
||||||
def sum_runtime(
|
def sum_runtime(
|
||||||
a: Mapping[str, Mapping], b: Mapping[str, Mapping]
|
a: Mapping[str, dict], b: Mapping[str, dict]
|
||||||
) -> Dict[str, dict]:
|
) -> Dict[str, dict]:
|
||||||
return {
|
return {
|
||||||
section: a.get(section, 0) + b.get(section, 0)
|
section: a.get(section, 0) + b.get(section, 0)
|
||||||
@ -1059,7 +1061,7 @@ class ProjectBLL:
|
|||||||
if not parent_ids:
|
if not parent_ids:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
parents = Task.get_many_with_join(
|
parents: Sequence[dict] = Task.get_many_with_join(
|
||||||
company_id,
|
company_id,
|
||||||
query=Q(id__in=parent_ids),
|
query=Q(id__in=parent_ids),
|
||||||
query_dict={"name": name} if name else None,
|
query_dict={"name": name} if name else None,
|
||||||
@ -1166,7 +1168,7 @@ class ProjectBLL:
|
|||||||
|
|
||||||
if or_conditions:
|
if or_conditions:
|
||||||
if len(or_conditions) == 1:
|
if len(or_conditions) == 1:
|
||||||
conditions = next(iter(or_conditions))
|
conditions.update(next(iter(or_conditions)))
|
||||||
else:
|
else:
|
||||||
conditions["$and"] = [c for c in or_conditions]
|
conditions["$and"] = [c for c in or_conditions]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user