fix displaying temps from extended on overview page
This commit is contained in:
parent
9e7b018589
commit
4c312366c2
|
@ -148,12 +148,18 @@ public class TempBasal {
|
|||
return isInProgress(new Date());
|
||||
}
|
||||
|
||||
public double tempBasalConvertedToAbsolute() {
|
||||
if (isAbsolute) return absolute;
|
||||
else {
|
||||
public double tempBasalConvertedToAbsolute(Date time) {
|
||||
if (isExtended) {
|
||||
NSProfile profile = MainApp.getConfigBuilder().getActiveProfile().getProfile();
|
||||
double absval = profile.getBasal(NSProfile.secondsFromMidnight()) * percent / 100;
|
||||
double absval = profile.getBasal(NSProfile.secondsFromMidnight(time)) + absolute;
|
||||
return absval;
|
||||
} else {
|
||||
if (isAbsolute) return absolute;
|
||||
else {
|
||||
NSProfile profile = MainApp.getConfigBuilder().getActiveProfile().getProfile();
|
||||
double absval = profile.getBasal(NSProfile.secondsFromMidnight(time)) * percent / 100;
|
||||
return absval;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -534,7 +534,7 @@ public class OverviewFragment extends Fragment implements PluginBase {
|
|||
for (long time = fromTime; time < now; time += 5 * 60 * 1000L) {
|
||||
TempBasal tb = MainApp.getConfigBuilder().getActiveTempBasals().getTempBasal(new Date(time));
|
||||
if (tb != null)
|
||||
basalArray.add(new BarDataPoint(time, tb.tempBasalConvertedToAbsolute(), true));
|
||||
basalArray.add(new BarDataPoint(time, tb.tempBasalConvertedToAbsolute(new Date(time)), true));
|
||||
else
|
||||
basalArray.add(new BarDataPoint(time, profile.getBasal(NSProfile.secondsFromMidnight(new Date(time))), false));
|
||||
}
|
||||
|
|
|
@ -230,6 +230,9 @@ public class TempBasalsFragment extends Fragment implements PluginBase, TempBasa
|
|||
for (TempBasal t : tempBasals) {
|
||||
if (t.isInProgress(time)) return t;
|
||||
}
|
||||
if (useExtendedBoluses) {
|
||||
return getExtendedBolus(time);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue