Fix and UI imporvements
This commit is contained in:
@@ -114,16 +114,45 @@ async def seed_distribution_history(db: AsyncSession):
|
||||
total_distance_km = random.uniform(75.0, 95.0) # Realistic for 3 retail outlets in region
|
||||
estimated_duration_minutes = random.randint(180, 240) # 3-4 hours for 3 stops
|
||||
|
||||
# Route sequence (order of deliveries)
|
||||
# Route sequence (order of deliveries) with full GPS coordinates for map display
|
||||
# Determine status based on date
|
||||
is_past = delivery_date < BASE_REFERENCE_DATE
|
||||
point_status = "delivered" if is_past else "pending"
|
||||
|
||||
route_sequence = [
|
||||
{"stop": 1, "tenant_id": str(DEMO_TENANT_CHILD_1), "location": "Madrid Centro"},
|
||||
{"stop": 2, "tenant_id": str(DEMO_TENANT_CHILD_2), "location": "Barcelona Gràcia"},
|
||||
{"stop": 3, "tenant_id": str(DEMO_TENANT_CHILD_3), "location": "Valencia Ruzafa"}
|
||||
{
|
||||
"tenant_id": str(DEMO_TENANT_CHILD_1),
|
||||
"name": "Madrid Centro",
|
||||
"address": "Calle Gran Vía 28, 28013 Madrid, Spain",
|
||||
"latitude": 40.4168,
|
||||
"longitude": -3.7038,
|
||||
"status": point_status,
|
||||
"id": str(uuid.uuid4()),
|
||||
"sequence": 1
|
||||
},
|
||||
{
|
||||
"tenant_id": str(DEMO_TENANT_CHILD_2),
|
||||
"name": "Barcelona Gràcia",
|
||||
"address": "Carrer Gran de Gràcia 15, 08012 Barcelona, Spain",
|
||||
"latitude": 41.4036,
|
||||
"longitude": 2.1561,
|
||||
"status": point_status,
|
||||
"id": str(uuid.uuid4()),
|
||||
"sequence": 2
|
||||
},
|
||||
{
|
||||
"tenant_id": str(DEMO_TENANT_CHILD_3),
|
||||
"name": "Valencia Ruzafa",
|
||||
"address": "Carrer de Sueca 51, 46006 Valencia, Spain",
|
||||
"latitude": 39.4647,
|
||||
"longitude": -0.3679,
|
||||
"status": point_status,
|
||||
"id": str(uuid.uuid4()),
|
||||
"sequence": 3
|
||||
}
|
||||
]
|
||||
|
||||
# Determine status based on whether the date is in the past or future
|
||||
# Past routes are completed, today and future routes are planned
|
||||
is_past = delivery_date < BASE_REFERENCE_DATE
|
||||
# Route status (already determined is_past above)
|
||||
route_status = DeliveryRouteStatus.completed if is_past else DeliveryRouteStatus.planned
|
||||
|
||||
route = DeliveryRoute(
|
||||
|
||||
Reference in New Issue
Block a user