diff --git a/GBDaoGenerator/src/nodomain/freeyourgadget/gadgetbridge/daogen/GBDaoGenerator.java b/GBDaoGenerator/src/nodomain/freeyourgadget/gadgetbridge/daogen/GBDaoGenerator.java index 01091eb70..fb3508b73 100644 --- a/GBDaoGenerator/src/nodomain/freeyourgadget/gadgetbridge/daogen/GBDaoGenerator.java +++ b/GBDaoGenerator/src/nodomain/freeyourgadget/gadgetbridge/daogen/GBDaoGenerator.java @@ -158,15 +158,16 @@ public class GBDaoGenerator { private static Entity addPebbleHealthActivityKindOverlay(Schema schema, Entity user, Entity device) { Entity activityOverlay = addEntity(schema, "PebbleHealthActivityOverlay"); activityOverlay.addIdProperty(); - Property timestampFrom = activityOverlay.addIntProperty("timestampFrom").notNull().getProperty(); - Property timestampTo = activityOverlay.addIntProperty("timestampTo").notNull().getProperty(); - activityOverlay.addIntProperty("rawKind").notNull(); Property userId = activityOverlay.addLongProperty("userId").getProperty(); activityOverlay.addToOne(user, userId); Property deviceId = activityOverlay.addLongProperty("deviceId").getProperty(); activityOverlay.addToOne(device, deviceId); + Property timestampFrom = activityOverlay.addIntProperty("timestampFrom").notNull().getProperty(); + Property timestampTo = activityOverlay.addIntProperty("timestampTo").notNull().getProperty(); + activityOverlay.addIntProperty("rawKind").notNull(); + Index indexUnique = new Index(); indexUnique.addProperty(deviceId); indexUnique.addProperty(timestampFrom); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/DatalogSessionHealthOverlayData.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/DatalogSessionHealthOverlayData.java index 677060a57..83b8c9162 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/DatalogSessionHealthOverlayData.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/DatalogSessionHealthOverlayData.java @@ -72,7 +72,7 @@ class DatalogSessionHealthOverlayData extends DatalogSessionPebbleHealth { List overlayList = new ArrayList<>(); for (OverlayRecord overlayRecord : overlayRecords) { - overlayList.add(new PebbleHealthActivityOverlay(null, overlayRecord.timestampStart, overlayRecord.timestampStart + overlayRecord.durationSeconds - 1, overlayRecord.type, userId, deviceId)); //TODO: consider if "-1" is what we really want + overlayList.add(new PebbleHealthActivityOverlay(null, userId, deviceId, overlayRecord.timestampStart, overlayRecord.timestampStart + overlayRecord.durationSeconds - 1, overlayRecord.type)); //TODO: consider if "-1" is what we really want } overlayDao.insertOrReplaceInTx(overlayList); } catch (Exception ex) { diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/DatalogSessionHealthSleep.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/DatalogSessionHealthSleep.java index 762ba7062..bd1c15af4 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/DatalogSessionHealthSleep.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/DatalogSessionHealthSleep.java @@ -71,7 +71,7 @@ class DatalogSessionHealthSleep extends DatalogSessionPebbleHealth { List overlayList = new ArrayList<>(); for (SleepRecord sleepRecord : sleepRecords) { - overlayList.add(new PebbleHealthActivityOverlay(null, sleepRecord.bedTimeStart, sleepRecord.bedTimeEnd - 1, sleepRecord.type, userId, deviceId)); //TODO: consider if "-1" is what we really want + overlayList.add(new PebbleHealthActivityOverlay(null, userId, deviceId, sleepRecord.bedTimeStart, sleepRecord.bedTimeEnd - 1, sleepRecord.type)); //TODO: consider if "-1" is what we really want } overlayDao.insertOrReplaceInTx(overlayList); } catch (Exception ex) {