Skip to content

Commit

Permalink
Fix issue where plot data was always stored in db (#599)
Browse files Browse the repository at this point in the history
  • Loading branch information
ml-evs authored Feb 18, 2024
1 parent 74d64bc commit 1fa1480
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pydatalab/pydatalab/blocks/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,17 @@ def __init__(
def to_db(self):
"""returns a dictionary with the data for this
block, ready to be input into mongodb"""

LOGGER.debug("Casting block %s to database object.", self.__class__.__name__)

if "bokeh_plot_data" in self.data:
self.data.pop("bokeh_plot_data")

if "file_id" in self.data:
dict_for_db = self.data.copy() # gross, I know
dict_for_db["file_id"] = ObjectId(dict_for_db["file_id"])
return dict_for_db

if "bokeh_plot_data" in self.data:
self.data.pop("bokeh_plot_data")
return self.data

@classmethod
Expand Down

0 comments on commit 1fa1480

Please sign in to comment.