Add sourceLatitude/sourceLongitude to OrderType and stages
All checks were successful
Build Docker Image / build (push) Successful in 1m42s
All checks were successful
Build Docker Image / build (push) Successful in 1m42s
This commit is contained in:
@@ -14,6 +14,8 @@ class OrderType(graphene.ObjectType):
|
||||
currency = graphene.String()
|
||||
sourceLocationUuid = graphene.String()
|
||||
sourceLocationName = graphene.String()
|
||||
sourceLatitude = graphene.Float()
|
||||
sourceLongitude = graphene.Float()
|
||||
destinationLocationUuid = graphene.String()
|
||||
destinationLocationName = graphene.String()
|
||||
createdAt = graphene.String()
|
||||
@@ -102,6 +104,12 @@ class TeamQuery(graphene.ObjectType):
|
||||
data = response.json()
|
||||
result = []
|
||||
for order_data in data:
|
||||
# Get source coordinates from first stage if not on order level
|
||||
stages_data = order_data.get('stages', [])
|
||||
first_stage = stages_data[0] if stages_data else {}
|
||||
source_lat = order_data.get('source_latitude') or first_stage.get('source_latitude')
|
||||
source_lon = order_data.get('source_longitude') or first_stage.get('source_longitude')
|
||||
|
||||
order = OrderType(
|
||||
uuid=order_data.get('uuid'),
|
||||
name=order_data.get('name'),
|
||||
@@ -112,6 +120,8 @@ class TeamQuery(graphene.ObjectType):
|
||||
currency=order_data.get('currency'),
|
||||
sourceLocationUuid=order_data.get('source_location_uuid'),
|
||||
sourceLocationName=order_data.get('source_location_name'),
|
||||
sourceLatitude=source_lat,
|
||||
sourceLongitude=source_lon,
|
||||
destinationLocationUuid=order_data.get('destination_location_uuid'),
|
||||
destinationLocationName=order_data.get('destination_location_name'),
|
||||
createdAt=order_data.get('created_at'),
|
||||
@@ -138,8 +148,14 @@ class TeamQuery(graphene.ObjectType):
|
||||
stageType=stage.get('stage_type'),
|
||||
transportType=stage.get('transport_type'),
|
||||
sourceLocationName=stage.get('source_location_name'),
|
||||
sourceLatitude=stage.get('source_latitude'),
|
||||
sourceLongitude=stage.get('source_longitude'),
|
||||
destinationLocationName=stage.get('destination_location_name'),
|
||||
destinationLatitude=stage.get('destination_latitude'),
|
||||
destinationLongitude=stage.get('destination_longitude'),
|
||||
locationName=stage.get('location_name'),
|
||||
locationLatitude=stage.get('location_latitude'),
|
||||
locationLongitude=stage.get('location_longitude'),
|
||||
selectedCompany=CompanyType(
|
||||
uuid=stage.get('selected_company', {}).get('uuid', ''),
|
||||
name=stage.get('selected_company', {}).get('name', ''),
|
||||
|
||||
Reference in New Issue
Block a user