mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-27 20:36:51 +01:00
Check for non empty list of sleep sessions
This commit is contained in:
parent
b5e3374a9e
commit
5c0c5ed952
@ -75,13 +75,15 @@ public class SleepChartFragment extends AbstractChartFragment {
|
|||||||
List<? extends ActivitySample> samples = getSamplesofSleep(db, device);
|
List<? extends ActivitySample> samples = getSamplesofSleep(db, device);
|
||||||
|
|
||||||
MySleepChartsData mySleepChartsData = refreshSleepAmounts(device, samples);
|
MySleepChartsData mySleepChartsData = refreshSleepAmounts(device, samples);
|
||||||
long tstart = mySleepChartsData.sleepSessions.get(0).getSleepStart().getTime() / 1000;
|
if (mySleepChartsData.sleepSessions.size()>0) {
|
||||||
long tend = mySleepChartsData.sleepSessions.get(mySleepChartsData.sleepSessions.size() - 1).getSleepEnd().getTime() / 1000;
|
long tstart = mySleepChartsData.sleepSessions.get(0).getSleepStart().getTime() / 1000;
|
||||||
|
long tend = mySleepChartsData.sleepSessions.get(mySleepChartsData.sleepSessions.size() - 1).getSleepEnd().getTime() / 1000;
|
||||||
|
|
||||||
for (Iterator<ActivitySample> iterator = (Iterator<ActivitySample>) samples.iterator(); iterator.hasNext(); ) {
|
for (Iterator<ActivitySample> iterator = (Iterator<ActivitySample>) samples.iterator(); iterator.hasNext(); ) {
|
||||||
ActivitySample sample = iterator.next();
|
ActivitySample sample = iterator.next();
|
||||||
if (sample.getTimestamp() < tstart || sample.getTimestamp() > tend) {
|
if (sample.getTimestamp() < tstart || sample.getTimestamp() > tend) {
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DefaultChartsData chartsData = refresh(device, samples);
|
DefaultChartsData chartsData = refresh(device, samples);
|
||||||
|
Loading…
Reference in New Issue
Block a user