mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-25 01:55:50 +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:
parent
7a16834482
commit
0126b90f20
@ -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());
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user