Allow arbitrary task fields in project statistics filter

This commit is contained in:
allegroai 2022-05-18 10:29:36 +03:00
parent ecffe26be4
commit 60b9c8de14
2 changed files with 7 additions and 14 deletions

View File

@ -809,12 +809,11 @@ class ProjectBLL:
if not filter_:
return conditions
for field in ("tags", "system_tags"):
field_filter = filter_.get(field)
if not field_filter:
continue
if not isinstance(field_filter, list) or not all(
isinstance(t, str) for t in field_filter
for field, field_filter in filter_.items():
if not (
field_filter
and isinstance(field_filter, list)
and all(isinstance(t, str) for t in field_filter)
):
raise errors.bad_request.ValidationError(
f"List of strings expected for the field: {field}"

View File

@ -582,15 +582,9 @@ get_all_ex {
}
"2.17": ${get_all_ex."2.16"} {
request.properties.include_stats_filter {
description: The filter for selecting entities that participate in statistics calculation
description: The filter for selecting entities that participate in statistics calculation. For each task field that you want to filter on pass the list of allowed values. Prepend the value with '-' to exclude
type: object
properties {
system_tags {
description: The list of allowed system tags
type: array
items { type: string }
}
}
additionalProperties: true
}
}
}