Skip to content

Commit

Permalink
Add log statement to debug filtered unprocessed trips
Browse files Browse the repository at this point in the history
  • Loading branch information
JGreenlee committed Sep 9, 2024
1 parent 18047b0 commit 852a7b1
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions www/js/diary/timelineHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -621,13 +621,16 @@ export function readUnprocessedTrips(

logDebug(`mapping trips to tripObjs of size ${rawTripObjs.length}`);
/* Filtering: we will keep trips that are 1) defined and 2) have a distance >= 100m,
or duration >= 5 minutes
https://github.com/e-mission/e-mission-docs/issues/966#issuecomment-1709112578 */
const tripObjs = rawTripObjs.filter(
(trip) => trip && (trip.distance >= 100 || trip.duration >= 300),
);
logDebug(`after filtering undefined and distance < 100m,
tripObjs size = ${tripObjs.length}`);
or duration >= 5 minutes
https://github.com/e-mission/e-mission-docs/issues/966#issuecomment-1709112578 */
const tripObjs = rawTripObjs.filter((trip) => {
if (!trip || trip.distance < 100 || trip.duration < 300) {
logDebug(`Trip ${JSON.stringify(trip)} is falsy, < 100m, or < 5 min. Dropping`);
return false;
}
return true;
});
logDebug(`after filtering, tripObjs size = ${tripObjs.length}`);
// Link 0th trip to first, first to second, ...
for (let i = 0; i < tripObjs.length - 1; i++) {
linkTrips(tripObjs[i], tripObjs[i + 1]);
Expand Down

0 comments on commit 852a7b1

Please sign in to comment.