mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-26 02:25: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 (PebbleHealthActivityOverlay overlay : overlayRecords) {
|
||||||
for (PebbleHealthActivitySample sample : samples) {
|
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
|
// patch in the raw kind
|
||||||
sample.setRawKind(overlay.getRawKind());
|
sample.setRawKind(overlay.getRawKind());
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ class DatalogSessionHealthOverlayData extends DatalogSessionPebbleHealth {
|
|||||||
|
|
||||||
List<PebbleHealthActivityOverlay> overlayList = new ArrayList<>();
|
List<PebbleHealthActivityOverlay> overlayList = new ArrayList<>();
|
||||||
for (OverlayRecord overlayRecord : overlayRecords) {
|
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);
|
overlayDao.insertOrReplaceInTx(overlayList);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
|
@ -71,7 +71,7 @@ class DatalogSessionHealthSleep extends DatalogSessionPebbleHealth {
|
|||||||
|
|
||||||
List<PebbleHealthActivityOverlay> overlayList = new ArrayList<>();
|
List<PebbleHealthActivityOverlay> overlayList = new ArrayList<>();
|
||||||
for (SleepRecord sleepRecord : sleepRecords) {
|
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);
|
overlayDao.insertOrReplaceInTx(overlayList);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
|
Loading…
Reference in New Issue
Block a user