Remove faulty positions from database

maxw3ll5 years ago

We had some parsing issues in the past which resulted in wrong positions being added to the database. Now I would like to remove those positions to fix the statistics calculation (e.g. total distance) for the affected devices.

What do I have to consider when removing rows from the tc_positions table?
I was thinking something like this:

DELETE FROM tc_positions
WHERE fixtime < '2017'
AND id NOT IN
  (SELECT positionId
   FROM tc_devices
   WHERE positionId IS NOT NULL);
Anton Tananaev5 years ago

If positions were in the past, they should not affect distance calculation.

maxw3ll5 years ago

How is total distance calculated than?

Anton Tananaev5 years ago

It is accumulated only based on last known location. If you have locations older than the current latest one, those will not affect total distance.