refactor: optimize route deletion logic in RoutesModule

This commit is contained in:
Marc Emmanuel 2026-01-30 17:04:45 +01:00
parent ff74fa9292
commit bb94044320

View file

@ -694,12 +694,11 @@ class RoutesModule {
for (const point of route.points) { for (const point of route.points) {
const from = point[2]; const from = point[2];
if (!routes[from]) continue; if (!routes[from]) continue;
console.log(Object.entries(routes[from]));
for (const [to, routeId] of Object.entries(routes[from])) { for (const [to, routeId] of Object.entries(routes[from])) {
if (routeId === route.i) { if (routeId === route.i) {
delete routes[from][to]; delete routes[from][parseInt(to, 10)];
delete routes[to][from]; delete routes[parseInt(to, 10)][from];
} }
} }
} }