Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/repositories/flight.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ async def read_flight_by_id(self, flight_id: str) -> Optional[FlightModel]:
@repository_exception_handler
async def update_flight_by_id(self, flight_id: str, flight: FlightModel):
await self.update_by_id(
flight.model_dump(exclude_none=True), data_id=flight_id
flight.model_dump(exclude_none=False), data_id=flight_id
)
Comment thread
coderabbitai[bot] marked this conversation as resolved.

@repository_exception_handler
Expand Down
2 changes: 1 addition & 1 deletion src/repositories/motor.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ async def read_motor_by_id(self, motor_id: str) -> Optional[MotorModel]:
@repository_exception_handler
async def update_motor_by_id(self, motor_id: str, motor: MotorModel):
await self.update_by_id(
motor.model_dump(exclude_none=True), data_id=motor_id
motor.model_dump(exclude_none=False), data_id=motor_id

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was not able to initialise fields back to null om update

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably because of some legacy rockets (e.g before drop null was deployed). Could you please test if this is also the case for rockets created after drop null was implemented?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested some old rockets and motors from April this year and null assignment is working fine for them. Not sure when this migration took place but it looks quite backward compatible.
If it breaks for any older than that, it might require some sort of backfill for them.

)

@repository_exception_handler
Expand Down
2 changes: 1 addition & 1 deletion src/repositories/rocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ async def read_rocket_by_id(self, rocket_id: str) -> Optional[RocketModel]:
@repository_exception_handler
async def update_rocket_by_id(self, rocket_id: str, rocket: RocketModel):
await self.update_by_id(
rocket.model_dump(exclude_none=True), data_id=rocket_id
rocket.model_dump(exclude_none=False), data_id=rocket_id
)

@repository_exception_handler
Expand Down
8 changes: 5 additions & 3 deletions src/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ def for_flight(cls) -> 'DiscretizeConfig':


class InfinityEncoder(RocketPyEncoder):
def default(self, o):
obj = o
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

def default(self, obj):
if (
isinstance(obj, Function)
and not callable(obj.source)
Expand All @@ -73,7 +75,7 @@ def default(self, o):
mutate_self=False,
)
if isinstance(obj, Flight):
obj._Flight__evaluate_post_process()
obj._Flight__evaluate_post_process
Comment thread
GabrielBarberini marked this conversation as resolved.
Outdated
solution = np.array(obj.solution)
size = len(solution)
if size > 25:
Expand Down
Loading