Skip to content

Commit

Permalink
fix "type" in v1 recipe obj for data comparison (#231)
Browse files Browse the repository at this point in the history
  • Loading branch information
rugeli authored Feb 22, 2024
1 parent 72ecf15 commit 2893482
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cellpack/autopack/DBRecipeHandler.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import copy
from enum import Enum

from deepdiff import DeepDiff

Expand Down Expand Up @@ -404,6 +405,9 @@ def prep_data_for_db(data):
modified_data[key] = unpacked_value
if isinstance(unpacked_value, dict):
modified_data[key] = DBUploader.prep_data_for_db(unpacked_value)
# If the value is an enum, convert it to a string. e.g. during a version migration process where "type" in a v1 recipe is an enum
elif isinstance(value, Enum):
modified_data[key] = value.name
# If the value is a dictionary, recursively convert its nested lists to dictionaries
elif isinstance(value, dict):
modified_data[key] = DBUploader.prep_data_for_db(value)
Expand Down

0 comments on commit 2893482

Please sign in to comment.