From bb580e425c9a0c11fdbf8cd0eba1fb218c7d3073 Mon Sep 17 00:00:00 2001 From: Daniel Chang Date: Tue, 24 Sep 2024 14:14:58 -0400 Subject: [PATCH] check description key exist (#160) --- src/askem_beaker/contexts/dataset/context.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/askem_beaker/contexts/dataset/context.py b/src/askem_beaker/contexts/dataset/context.py index 41a59b2..b807744 100644 --- a/src/askem_beaker/contexts/dataset/context.py +++ b/src/askem_beaker/contexts/dataset/context.py @@ -234,7 +234,13 @@ async def save_dataset_request(self, message): new_dataset = copy.deepcopy(parent_dataset) del new_dataset["id"] new_dataset["name"] = new_name - new_dataset["description"] += f"\\nTransformed from dataset '{parent_dataset['name']}' ({parent_dataset['id']}) at {datetime.datetime.utcnow().strftime('%c %Z')}" + + transformed_info = f"Transformed from dataset '{parent_dataset['name']}' ({parent_dataset['id']}) at {datetime.datetime.utcnow().strftime('%c %Z')}" + if "description" in new_dataset: + new_dataset["description"] += f"\\n{transformed_info}" + else: + new_dataset["description"] = transformed_info + new_dataset["fileNames"] = [filename] #clear the columns field on the new dataset as there was likely a change to either the columns or the data. HMI-Server will deal with regenerating this. new_dataset["columns"] = []