Spaces:
Sleeping
Sleeping
Create data/flight_dummy_data.py
Browse files
garuda/data/flight_dummy_data.py
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from datetime import datetime, timedelta
|
| 2 |
+
|
| 3 |
+
flight_db = []
|
| 4 |
+
booking_db = []
|
| 5 |
+
refund_db = []
|
| 6 |
+
|
| 7 |
+
routes = [
|
| 8 |
+
("CGK", "DPS", 120, 1200000),
|
| 9 |
+
("CGK", "SUB", 90, 900000),
|
| 10 |
+
("CGK", "SIN", 110, 1800000),
|
| 11 |
+
]
|
| 12 |
+
|
| 13 |
+
class_multiplier = {
|
| 14 |
+
"ECONOMY": 1.0,
|
| 15 |
+
"BUSINESS": 2.0,
|
| 16 |
+
"FIRST": 3.5
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
flight_counter = 1
|
| 20 |
+
|
| 21 |
+
start_date = datetime(2026, 6, 1)
|
| 22 |
+
|
| 23 |
+
for day in range(30):
|
| 24 |
+
current_day = start_date + timedelta(days=day)
|
| 25 |
+
|
| 26 |
+
for origin, destination, duration, base_price in routes:
|
| 27 |
+
|
| 28 |
+
for seat_class in ["ECONOMY", "BUSINESS", "FIRST"]:
|
| 29 |
+
|
| 30 |
+
depart = current_day.replace(hour=8, minute=0)
|
| 31 |
+
arrive = depart + timedelta(minutes=duration)
|
| 32 |
+
|
| 33 |
+
flight_db.append({
|
| 34 |
+
"flight_id": f"FL{flight_counter:04}",
|
| 35 |
+
"airline": "Garuda Indonesia",
|
| 36 |
+
"origin": origin,
|
| 37 |
+
"destination": destination,
|
| 38 |
+
"departure_time": depart,
|
| 39 |
+
"arrival_time": arrive,
|
| 40 |
+
"duration_minutes": duration,
|
| 41 |
+
"seat_class": seat_class,
|
| 42 |
+
"price": base_price * class_multiplier[seat_class]
|
| 43 |
+
})
|
| 44 |
+
|
| 45 |
+
flight_counter += 1
|