Skip to content

Commit

Permalink
fix(feat) Removed too much
Browse files Browse the repository at this point in the history
  • Loading branch information
Hans-Chrstian committed Aug 13, 2024
1 parent c827a99 commit 6e0eaae
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions ckanext/gdi_userportal/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,18 @@ def _parse_to_array(self, data_dict, field):
def before_dataset_index(self, data_dict):
for field in self._dcatap_fields_to_normalize:
data_dict = self._parse_to_array(data_dict, field)

context = {"model": model, "session": model.Session}
dataset_dict = {"type": "dataset"}
schema = toolkit.get_action("scheming_dataset_schema_show")(context, dataset_dict)

repeating_fields = [x.get("field_name") for x in schema.get("dataset_fields", []) if "repeating_subfields" in x]
for field in repeating_fields:
try:
data_dict[field] = [json.dumps(x) for x in data_dict[field]]
except (json.JSONDecodeError, KeyError):
pass


if data_dict.get("res_format"):
data_dict["res_format"] = list(dict.fromkeys(data_dict.get("res_format")))
Expand Down

0 comments on commit 6e0eaae

Please sign in to comment.