fix bug when uncomplete autosens was stored to the cache

This commit is contained in:
Milos Kozak 2018-06-25 22:20:00 +02:00
parent 6d1fa2ffda
commit 81ad4c54f3
3 changed files with 12 additions and 3 deletions

View file

@ -32,4 +32,8 @@ public class AutosensResult {
return ret; return ret;
} }
@Override
public String toString() {
return json().toString();
}
} }

View file

@ -332,7 +332,8 @@ public class IobCobOref1Thread extends Thread {
autosensData.extraDeviation.add(0d); autosensData.extraDeviation.add(0d);
previous = autosensData; previous = autosensData;
autosensDataTable.put(bgTime, autosensData); if (bgTime < now())
autosensDataTable.put(bgTime, autosensData);
if (Config.logAutosensData) if (Config.logAutosensData)
log.debug("Running detectSensitivity from: " + DateUtil.dateAndTimeString(oldestTimeWithData) + " to: " + DateUtil.dateAndTimeString(bgTime)); log.debug("Running detectSensitivity from: " + DateUtil.dateAndTimeString(oldestTimeWithData) + " to: " + DateUtil.dateAndTimeString(bgTime));
autosensData.autosensRatio = iobCobCalculatorPlugin.detectSensitivity(oldestTimeWithData, bgTime).ratio; autosensData.autosensRatio = iobCobCalculatorPlugin.detectSensitivity(oldestTimeWithData, bgTime).ratio;

View file

@ -261,10 +261,14 @@ public class IobCobThread extends Thread {
//log.debug("TIME: " + new Date(bgTime).toString() + " BG: " + bg + " SENS: " + sens + " DELTA: " + delta + " AVGDELTA: " + avgDelta + " IOB: " + iob.iob + " ACTIVITY: " + iob.activity + " BGI: " + bgi + " DEVIATION: " + deviation); //log.debug("TIME: " + new Date(bgTime).toString() + " BG: " + bg + " SENS: " + sens + " DELTA: " + delta + " AVGDELTA: " + avgDelta + " IOB: " + iob.iob + " ACTIVITY: " + iob.activity + " BGI: " + bgi + " DEVIATION: " + deviation);
previous = autosensData; previous = autosensData;
autosensDataTable.put(bgTime, autosensData); if (bgTime < now())
autosensDataTable.put(bgTime, autosensData);
if (Config.logAutosensData) if (Config.logAutosensData)
log.debug("Running detectSensitivity from: " + DateUtil.dateAndTimeString(oldestTimeWithData) + " to: " + DateUtil.dateAndTimeString(bgTime)); log.debug("Running detectSensitivity from: " + DateUtil.dateAndTimeString(oldestTimeWithData) + " to: " + DateUtil.dateAndTimeString(bgTime));
autosensData.autosensRatio = iobCobCalculatorPlugin.detectSensitivity(oldestTimeWithData, bgTime).ratio; AutosensResult sensitivity = iobCobCalculatorPlugin.detectSensitivity(oldestTimeWithData, bgTime);
if (Config.logAutosensData)
log.debug("Sensitivity result: " + sensitivity.toString());
autosensData.autosensRatio = sensitivity.ratio;
if (Config.logAutosensData) if (Config.logAutosensData)
log.debug(autosensData.toString()); log.debug(autosensData.toString());
} }