1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-25 18:15:49 +01:00

Store the timestamps as sent by the pebble. Use a strict inequality operator at the end of the period to exclude the last sample.

This commit is contained in:
Daniele Gobbetti 2016-08-18 21:44:06 +02:00
parent 7a16834482
commit 0126b90f20
3 changed files with 3 additions and 3 deletions

View File

@ -51,7 +51,7 @@ public class PebbleHealthSampleProvider extends AbstractSampleProvider<PebbleHea
for (PebbleHealthActivityOverlay overlay : overlayRecords) {
for (PebbleHealthActivitySample sample : samples) {
if (overlay.getTimestampFrom() <= sample.getTimestamp() && sample.getTimestamp() <= overlay.getTimestampTo()) {
if (overlay.getTimestampFrom() <= sample.getTimestamp() && sample.getTimestamp() < overlay.getTimestampTo()) {
// patch in the raw kind
sample.setRawKind(overlay.getRawKind());
}

View File

@ -72,7 +72,7 @@ class DatalogSessionHealthOverlayData extends DatalogSessionPebbleHealth {
List<PebbleHealthActivityOverlay> overlayList = new ArrayList<>();
for (OverlayRecord overlayRecord : overlayRecords) {
overlayList.add(new PebbleHealthActivityOverlay(overlayRecord.timestampStart, overlayRecord.timestampStart + overlayRecord.durationSeconds - 1, deviceId, userId, overlayRecord.type)); //TODO: consider if "-1" is what we really want
overlayList.add(new PebbleHealthActivityOverlay(overlayRecord.timestampStart, overlayRecord.timestampStart + overlayRecord.durationSeconds, deviceId, userId, overlayRecord.type)); //TODO: consider if "-1" is what we really want
}
overlayDao.insertOrReplaceInTx(overlayList);
} catch (Exception ex) {

View File

@ -71,7 +71,7 @@ class DatalogSessionHealthSleep extends DatalogSessionPebbleHealth {
List<PebbleHealthActivityOverlay> overlayList = new ArrayList<>();
for (SleepRecord sleepRecord : sleepRecords) {
overlayList.add(new PebbleHealthActivityOverlay(sleepRecord.bedTimeStart, sleepRecord.bedTimeEnd - 1, deviceId, userId, sleepRecord.type)); //TODO: consider if "-1" is what we really want
overlayList.add(new PebbleHealthActivityOverlay(sleepRecord.bedTimeStart, sleepRecord.bedTimeEnd, deviceId, userId, sleepRecord.type)); //TODO: consider if "-1" is what we really want
}
overlayDao.insertOrReplaceInTx(overlayList);
} catch (Exception ex) {