Spaces:
Sleeping
Sleeping
OnlyBiggg
commited on
Commit
·
2d0a288
1
Parent(s):
546292e
fix trip
Browse files
app/dialogflow/services/dialog_service.py
CHANGED
|
@@ -98,6 +98,7 @@ class DialogService:
|
|
| 98 |
return []
|
| 99 |
payload = { k: v for k, v in {
|
| 100 |
"channel": "web_client",
|
|
|
|
| 101 |
"only_online_trip": True,
|
| 102 |
"from_time": from_time,
|
| 103 |
"to_time": to_time,
|
|
@@ -106,7 +107,6 @@ class DialogService:
|
|
| 106 |
"sort_by": ["price", "departure_time"]
|
| 107 |
}.items() if v is not None
|
| 108 |
}
|
| 109 |
-
print(payload)
|
| 110 |
|
| 111 |
data = []
|
| 112 |
response = await api.post("/search/trips", payload=payload)
|
|
@@ -136,8 +136,6 @@ class DialogService:
|
|
| 136 |
def get_all_trip_by_office(trips: list, origin_id: int = None, dest_id: int = None) -> list:
|
| 137 |
if origin_id is None and dest_id is None:
|
| 138 |
return trips
|
| 139 |
-
time_trips = [ trip["raw_departure_time"] for trip in trips]
|
| 140 |
-
print(time_trips)
|
| 141 |
|
| 142 |
result = []
|
| 143 |
for trip in trips:
|
|
@@ -167,12 +165,10 @@ class DialogService:
|
|
| 167 |
return []
|
| 168 |
|
| 169 |
time_trips = [ trip["raw_departure_time"] for trip in trips]
|
| 170 |
-
print(time_trips)
|
| 171 |
index = bisect_left(time_trips, time)
|
| 172 |
start = max(0, index - 2)
|
| 173 |
end = min(len(time_trips), index + 2)
|
| 174 |
trips_result = trips[start:end]
|
| 175 |
-
print([ trip["raw_departure_time"] for trip in trips_result])
|
| 176 |
return trips_result
|
| 177 |
|
| 178 |
|
|
|
|
| 98 |
return []
|
| 99 |
payload = { k: v for k, v in {
|
| 100 |
"channel": "web_client",
|
| 101 |
+
"size":300,
|
| 102 |
"only_online_trip": True,
|
| 103 |
"from_time": from_time,
|
| 104 |
"to_time": to_time,
|
|
|
|
| 107 |
"sort_by": ["price", "departure_time"]
|
| 108 |
}.items() if v is not None
|
| 109 |
}
|
|
|
|
| 110 |
|
| 111 |
data = []
|
| 112 |
response = await api.post("/search/trips", payload=payload)
|
|
|
|
| 136 |
def get_all_trip_by_office(trips: list, origin_id: int = None, dest_id: int = None) -> list:
|
| 137 |
if origin_id is None and dest_id is None:
|
| 138 |
return trips
|
|
|
|
|
|
|
| 139 |
|
| 140 |
result = []
|
| 141 |
for trip in trips:
|
|
|
|
| 165 |
return []
|
| 166 |
|
| 167 |
time_trips = [ trip["raw_departure_time"] for trip in trips]
|
|
|
|
| 168 |
index = bisect_left(time_trips, time)
|
| 169 |
start = max(0, index - 2)
|
| 170 |
end = min(len(time_trips), index + 2)
|
| 171 |
trips_result = trips[start:end]
|
|
|
|
| 172 |
return trips_result
|
| 173 |
|
| 174 |
|