1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-25 18:15:49 +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()) {
AbstractSampleProvider<? extends AbstractActivitySample> sampleProvider = (AbstractSampleProvider<? extends AbstractActivitySample>) coordinator.getSampleProvider(targetDevice, session); if (coordinator.supports(targetDevice)) {
importActivitySamples(oldDB, targetDevice, session, sampleProvider, user); AbstractSampleProvider<? extends AbstractActivitySample> sampleProvider = (AbstractSampleProvider<? extends AbstractActivitySample>) coordinator.getSampleProvider(targetDevice, session);
importActivitySamples(oldDB, targetDevice, session, sampleProvider, user);
break;
}
} }
} }
} }