mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-28 04:46:51 +01:00
fix negative steps in Charts with Morpheuz
This commit is contained in:
parent
43d7566c0b
commit
9520e23439
@ -17,7 +17,7 @@ public class ActivityAnalysis {
|
||||
ActivityAmount previousAmount = null;
|
||||
ActivitySample previousSample = null;
|
||||
for (ActivitySample sample : samples) {
|
||||
ActivityAmount amount = null;
|
||||
ActivityAmount amount;
|
||||
switch (sample.getKind()) {
|
||||
case ActivityKind.TYPE_DEEP_SLEEP:
|
||||
amount = deepSleep;
|
||||
@ -43,8 +43,6 @@ public class ActivityAnalysis {
|
||||
previousAmount.addSeconds(sharedTimeDifference);
|
||||
amount.addSeconds(sharedTimeDifference);
|
||||
}
|
||||
} else {
|
||||
// nothing to do, we can only calculate when we have the next sample
|
||||
}
|
||||
|
||||
previousAmount = amount;
|
||||
@ -69,7 +67,10 @@ public class ActivityAnalysis {
|
||||
public int calculateTotalSteps(List<? extends ActivitySample> samples) {
|
||||
int totalSteps = 0;
|
||||
for (ActivitySample sample : samples) {
|
||||
totalSteps += sample.getSteps();
|
||||
int steps = sample.getSteps();
|
||||
if (steps > 0) {
|
||||
totalSteps += sample.getSteps();
|
||||
}
|
||||
}
|
||||
return totalSteps;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user