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_: if not filter_:
return conditions return conditions
for field in ("tags", "system_tags"): for field, field_filter in filter_.items():
field_filter = filter_.get(field) if not (
if not field_filter: field_filter
continue and isinstance(field_filter, list)
if not isinstance(field_filter, list) or not all( and all(isinstance(t, str) for t in field_filter)
isinstance(t, str) for t in field_filter
): ):
raise errors.bad_request.ValidationError( raise errors.bad_request.ValidationError(
f"List of strings expected for the field: {field}" 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"} { "2.17": ${get_all_ex."2.16"} {
request.properties.include_stats_filter { 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 type: object
properties { additionalProperties: true
system_tags {
description: The list of allowed system tags
type: array
items { type: string }
}
}
} }
} }
} }