Skip to content

Commit fbe5a88

Browse files
committed
Assign color flags to attributes directly instead of using 'setattr'
1 parent 04273fc commit fbe5a88

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/murfey/workflows/register_data_collection_group.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,13 @@ def run(message: dict, murfey_db: SQLModelSession) -> dict[str, bool]:
7171
if collection_mode := message.get("collection_mode"):
7272
atlas_record.mode = collection_mode
7373
if color_flags := message.get("color_flags", {}):
74-
for col_name, value in color_flags.items():
75-
setattr(atlas_record, col_name, value)
74+
atlas_record.hasGrey = color_flags.get("hasGrey")
75+
atlas_record.hasRed = color_flags.get("hasRed")
76+
atlas_record.hasGreen = color_flags.get("hasGreen")
77+
atlas_record.hasBlue = color_flags.get("hasBlue")
78+
atlas_record.hasCyan = color_flags.get("hasCyan")
79+
atlas_record.hasYellow = color_flags.get("hasYellow")
80+
atlas_record.hasMagenta = color_flags.get("hasMagenta")
7681
atlas_id = _transport_object.do_insert_atlas(atlas_record).get(
7782
"return_value", None
7883
)

0 commit comments

Comments
 (0)