Skip to content

Commit 4ceab73

Browse files
committed
make sure that tram wagons are trams...
1 parent 055200f commit 4ceab73

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/js/cache.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,10 @@ function are_coords_invalid([lat, lon]) {
6464
export function handle_tram_compositions(cache) {
6565
for(const composition of tram_compositions) {
6666
const [first_wagon, second_wagon] = composition;
67-
const first_wagon_entry = cache.find(entry => entry.inv_number == first_wagon);
68-
const second_wagon_entry = cache.find(entry => entry.inv_number == second_wagon);
67+
68+
const first_wagon_entry = cache.find(entry => entry.inv_number == first_wagon && entry.type == 'tram');
69+
const second_wagon_entry = cache.find(entry => entry.inv_number == second_wagon && entry.type == 'tram');
70+
6971
const composition_inv_number = `${first_wagon}+${second_wagon}`;
7072
const composition_entry = cache.find(entry => entry.inv_number == composition_inv_number);
7173

0 commit comments

Comments
 (0)