Remove courses that have reached their destination

This commit is contained in:
Mattéo Delabre 2021-05-15 13:10:56 +02:00
parent ef8d88de28
commit ff84c7c93b
Signed by: matteo
GPG Key ID: AE3FBD02DC583ABB
1 changed files with 7 additions and 0 deletions

View File

@ -286,6 +286,13 @@ const updateData = async courses => {
courses[id] = newCourse;
}
}
// Remove stale courses
for (const id of Object.keys(courses)) {
if (courses[id].departureStop === courses[id].finalStop) {
delete courses[id];
}
}
};
const tick = (courses, time) => {