Skip to content

Commit

Permalink
fixup: fix dataset not interable issues
Browse files Browse the repository at this point in the history
  • Loading branch information
struan committed Jan 8, 2024
1 parent a586e1d commit d608327
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions hub/views/area.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit d608327

Please sign in to comment.