Skip to content

Commit

Permalink
fix(commands): fix type check
Browse files Browse the repository at this point in the history
  • Loading branch information
maugde committed Nov 27, 2024
1 parent efcdc34 commit 0b25e3e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion antarest/study/storage/variantstudy/variant_study_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,13 @@ def append_commands(
command_objs = self._check_commands_validity(study_id, commands)
validated_commands = transform_command_to_dto(command_objs, commands)
first_index = len(study.commands)

# type check in case user is None
if not params.user or not params.user.id:
user_id = None
else:
user_id = params.user.id

# noinspection PyArgumentList
new_commands = [
CommandBlock(
Expand All @@ -209,7 +216,7 @@ def append_commands(
index=(first_index + i),
version=command.version,
study_version=str(command.study_version),
user_id=params.user.id,
user_id=user_id,
updated_at=datetime.utcnow(),
)
for i, command in enumerate(validated_commands)
Expand Down

0 comments on commit 0b25e3e

Please sign in to comment.