From d60832793905b3c9399df02b47c11c72a321c3f9 Mon Sep 17 00:00:00 2001 From: Struan Donald Date: Mon, 8 Jan 2024 15:16:24 +0000 Subject: [PATCH] fixup: fix dataset not interable issues --- hub/views/area.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/hub/views/area.py b/hub/views/area.py index 2953b0ec6..8510d6696 100644 --- a/hub/views/area.py +++ b/hub/views/area.py @@ -253,9 +253,15 @@ def get_context_data(self, **kwargs): if data.get("data", None) is not None: if data_set.category is not None: - if not isinstance(data["data"], AreaData): + if ( + data_set.category != "opinion" + and not data_set.is_range + and not isinstance(data["data"], AreaData) + ): if len(data["data"]) == 1: data["data"] = data["data"][0] + if data_set.category == "opinion" or data_set.is_range: + data["do_not_shorten"] = True categories[data_set.category].append(data) else: categories["place"].append(data) @@ -272,7 +278,9 @@ def get_context_data(self, **kwargs): else: if len(data_points) != 0: data_set_name = data_points[0].data_type.data_set.name - if len(data_points) == 1: + if len(data_points) == 1 and not data_item.get( + "do_not_shorten", False + ): data["data"] = data_points[0] else: data_set_name = None