Skip to content

Commit d7e5ac4

Browse files
committed
fixing attributes_metadata type, strict function
1 parent 0b507cb commit d7e5ac4

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

src/opengeodeweb_back/routes/blueprint_routes.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -266,22 +266,19 @@ def texture_coordinates() -> flask.Response:
266266
return flask.make_response({"texture_coordinates": texture_coordinates}, 200)
267267

268268

269-
def attributes_metadata(manager: og.AttributeManager) -> list[dict[str, Any]]:
270-
attributes: list[dict[str, Any]] = []
269+
def attributes_metadata(manager: og.AttributeManager) -> list[dict[str, str | float]]:
270+
attributes: list[dict[str, str | float]] = []
271271
nb_elements = manager.nb_elements()
272272
for name in manager.attribute_names():
273273
attribute = manager.find_generic_attribute(name)
274274
min_value, max_value = -1.0, -1.0
275275
if attribute.is_genericable():
276-
get_val = (
277-
attribute.value
278-
if hasattr(attribute, "value")
279-
else attribute.generic_value
280-
)
281276
values = []
277+
nb_items = attribute.nb_items()
282278
for index in range(nb_elements):
283-
value = get_val(index)
284-
values.extend(value if isinstance(value, list) else [value])
279+
for item in range(nb_items):
280+
value = attribute.generic_item_value(index, item)
281+
values.append(value)
285282

286283
valid_values = [
287284
value for value in values if value is not None and not math.isnan(value)

0 commit comments

Comments
 (0)