1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-26 10:35:50 +01:00

Only import old activity data once per device, not for every provider

This commit is contained in:
cpfeiffer 2016-08-18 20:29:20 +02:00
parent fbf06c1fe3
commit 6e98defe94

View File

@ -385,8 +385,11 @@ public class DBHelper {
try (SQLiteDatabase oldDB = oldDbHandler.getReadableDatabase()) { try (SQLiteDatabase oldDB = oldDbHandler.getReadableDatabase()) {
User user = DBHelper.getUser(session); User user = DBHelper.getUser(session);
for (DeviceCoordinator coordinator : DeviceHelper.getInstance().getAllCoordinators()) { for (DeviceCoordinator coordinator : DeviceHelper.getInstance().getAllCoordinators()) {
if (coordinator.supports(targetDevice)) {
AbstractSampleProvider<? extends AbstractActivitySample> sampleProvider = (AbstractSampleProvider<? extends AbstractActivitySample>) coordinator.getSampleProvider(targetDevice, session); AbstractSampleProvider<? extends AbstractActivitySample> sampleProvider = (AbstractSampleProvider<? extends AbstractActivitySample>) coordinator.getSampleProvider(targetDevice, session);
importActivitySamples(oldDB, targetDevice, session, sampleProvider, user); importActivitySamples(oldDB, targetDevice, session, sampleProvider, user);
break;
}
} }
} }
} }