fix basal rendering
This commit is contained in:
parent
197f3bb691
commit
4fda6c4c4f
1 changed files with 21 additions and 19 deletions
|
@ -391,28 +391,30 @@ public class IobCobCalculatorPlugin extends PluginBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public BasalData getBasalData(Profile profile, long time) {
|
public BasalData getBasalData(Profile profile, long time) {
|
||||||
long now = System.currentTimeMillis();
|
synchronized (dataLock) {
|
||||||
time = roundUpTime(time);
|
long now = System.currentTimeMillis();
|
||||||
BasalData retval = basalDataTable.get(time);
|
time = roundUpTime(time);
|
||||||
if (retval == null) {
|
BasalData retval = basalDataTable.get(time);
|
||||||
retval = new BasalData();
|
if (retval == null) {
|
||||||
TemporaryBasal tb = TreatmentsPlugin.getPlugin().getTempBasalFromHistory(time);
|
retval = new BasalData();
|
||||||
retval.basal = profile.getBasal(time);
|
TemporaryBasal tb = TreatmentsPlugin.getPlugin().getTempBasalFromHistory(time);
|
||||||
if (tb != null) {
|
retval.basal = profile.getBasal(time);
|
||||||
retval.isTempBasalRunning = true;
|
if (tb != null) {
|
||||||
retval.tempBasalAbsolute = tb.tempBasalConvertedToAbsolute(time, profile);
|
retval.isTempBasalRunning = true;
|
||||||
|
retval.tempBasalAbsolute = tb.tempBasalConvertedToAbsolute(time, profile);
|
||||||
|
} else {
|
||||||
|
retval.isTempBasalRunning = false;
|
||||||
|
retval.tempBasalAbsolute = retval.basal;
|
||||||
|
}
|
||||||
|
if (time < now) {
|
||||||
|
basalDataTable.append(time, retval);
|
||||||
|
}
|
||||||
|
//log.debug(">>> getBasalData Cache miss " + new Date(time).toLocaleString());
|
||||||
} else {
|
} else {
|
||||||
retval.isTempBasalRunning = false;
|
//log.debug(">>> getBasalData Cache hit " + new Date(time).toLocaleString());
|
||||||
retval.tempBasalAbsolute = retval.basal;
|
|
||||||
}
|
}
|
||||||
if (time < now) {
|
return retval;
|
||||||
basalDataTable.append(time, retval);
|
|
||||||
}
|
|
||||||
//log.debug(">>> getBasalData Cache miss " + new Date(time).toLocaleString());
|
|
||||||
} else {
|
|
||||||
//log.debug(">>> getBasalData Cache hit " + new Date(time).toLocaleString());
|
|
||||||
}
|
}
|
||||||
return retval;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|
Loading…
Reference in a new issue