Skip to content

Commit

Permalink
fixes faulty motor kind association on service layer
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielBarberini committed Oct 14, 2024
1 parent dbb6f9d commit 8b216a1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
5 changes: 2 additions & 3 deletions lib/services/flight.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
from rocketpy.simulation.flight import Flight as RocketPyFlight
from rocketpy.utilities import get_instance_attributes

from lib.models.flight import Flight
from lib.services.environment import EnvironmentService
from lib.services.rocket import RocketService
from lib.views.flight import FlightSummary
from lib.views.flight import FlightSummary, FlightView


class FlightService:
Expand All @@ -18,7 +17,7 @@ def __init__(self, flight: RocketPyFlight = None):
self._flight = flight

@classmethod
def from_flight_model(cls, flight: Flight) -> Self:
def from_flight_model(cls, flight: FlightView) -> Self:
"""
Get the rocketpy flight object.
Expand Down
8 changes: 4 additions & 4 deletions lib/services/motor.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
TankGeometry,
)

from lib.models.motor import Motor, MotorKinds, TankKinds
from lib.views.motor import MotorSummary
from lib.models.motor import MotorKinds, TankKinds
from lib.views.motor import MotorSummary, MotorView


class MotorService:
Expand All @@ -26,7 +26,7 @@ def __init__(self, motor: RocketPyMotor = None):
self._motor = motor

@classmethod
def from_motor_model(cls, motor: Motor) -> Self:
def from_motor_model(cls, motor: MotorView) -> Self:
"""
Get the rocketpy motor object.
Expand All @@ -46,7 +46,7 @@ def from_motor_model(cls, motor: Motor) -> Self:
"reshape_thrust_curve": False or motor.reshape_thrust_curve,
}

match motor.motor_kind:
match MotorKinds(motor.selected_motor_kind):
case MotorKinds.LIQUID:
rocketpy_motor = LiquidMotor(**motor_core)
case MotorKinds.HYBRID:
Expand Down
6 changes: 3 additions & 3 deletions lib/services/rocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
from rocketpy.utilities import get_instance_attributes

from lib import logger
from lib.models.rocket import Rocket, Parachute
from lib.models.rocket import Parachute
from lib.models.aerosurfaces import NoseCone, Tail, Fins
from lib.services.motor import MotorService
from lib.views.rocket import RocketSummary
from lib.views.rocket import RocketView, RocketSummary


class RocketService:
Expand All @@ -27,7 +27,7 @@ def __init__(self, rocket: RocketPyRocket = None):
self._rocket = rocket

@classmethod
def from_rocket_model(cls, rocket: Rocket) -> Self:
def from_rocket_model(cls, rocket: RocketView) -> Self:
"""
Get the rocketpy rocket object.
Expand Down

0 comments on commit 8b216a1

Please sign in to comment.