Skip to content

Commit 74c9cce

Browse files
Fixed route queries
1 parent c9f2b64 commit 74c9cce

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/controllers/routes/getRoutesByFeed.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ export async function getRoutesByFeed(database: D1Database, offset: number, limi
88
" WHERE (center_latitude > ?3 AND center_latitude < ?4)" +
99
" AND (center_longitude > ?5 AND center_longitude < ?6)" +
1010
" ORDER BY timestamp DESC LIMIT ?2 OFFSET ?1"
11-
).bind(offset, limit, bounds.latitude.north, bounds.latitude.south, bounds.longitude.west, bounds.longitude.east).all<Route>();
11+
).bind(offset, limit, bounds.latitude.south, bounds.latitude.north, bounds.longitude.west, bounds.longitude.east).all<Route>();
1212

1313
return query.results ?? [];
1414
};
15+

src/routes/routes/create.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,12 @@ export const createRouteRequestSchema = {
102102
export async function handleCreateRouteRequest(request: RequestWithKey, env: Env, context: EventContext<Env, string, null>) {
103103
const { polyline, distance, duration, waypoints } = request.content;
104104

105-
const decodedPolyline = decode(polyline);
105+
const decodedPolyline = decode(polyline).map((coordinate) => {
106+
return {
107+
latitude: coordinate[0],
108+
longitude: coordinate[1]
109+
}
110+
});
106111

107112
const center = getCenter(decodedPolyline);
108113

0 commit comments

Comments
 (0)