prevent processing incomplete profiles

This commit is contained in:
Milos Kozak 2018-01-04 23:12:35 +01:00
parent 955ecc6d64
commit b7df21c7d0
3 changed files with 14 additions and 7 deletions

View file

@ -162,9 +162,6 @@ public class CircadianPercentageProfilePlugin implements PluginBase, ProfileInte
baseic[i] = SP.getDouble(SETTINGS_PREFIX + "baseic" + i, baseic[i]); baseic[i] = SP.getDouble(SETTINGS_PREFIX + "baseic" + i, baseic[i]);
baseisf[i] = SP.getDouble(SETTINGS_PREFIX + "baseisf" + i, baseisf[i]); baseisf[i] = SP.getDouble(SETTINGS_PREFIX + "baseisf" + i, baseisf[i]);
} }
createConvertedProfile();
} }
public String externallySetParameters(int timeshift, int percentage) { public String externallySetParameters(int timeshift, int percentage) {
@ -347,6 +344,9 @@ public class CircadianPercentageProfilePlugin implements PluginBase, ProfileInte
@Override @Override
public ProfileStore getProfile() { public ProfileStore getProfile() {
if (convertedProfile == null)
createConvertedProfile();
performLimitCheck(); performLimitCheck();
return convertedProfile; return convertedProfile;
} }
@ -358,6 +358,9 @@ public class CircadianPercentageProfilePlugin implements PluginBase, ProfileInte
@Override @Override
public String getProfileName() { public String getProfileName() {
if (convertedProfile == null)
createConvertedProfile();
performLimitCheck(); performLimitCheck();
return convertedProfileName; return convertedProfileName;
} }

View file

@ -178,7 +178,6 @@ public class LocalProfilePlugin implements PluginBase, ProfileInterface {
} catch (JSONException ignored) { } catch (JSONException ignored) {
} }
} }
createConvertedProfile();
} }
/* /*
@ -244,6 +243,8 @@ public class LocalProfilePlugin implements PluginBase, ProfileInterface {
@Override @Override
public ProfileStore getProfile() { public ProfileStore getProfile() {
if (convertedProfile == null)
createConvertedProfile();
return convertedProfile; return convertedProfile;
} }
@ -254,6 +255,8 @@ public class LocalProfilePlugin implements PluginBase, ProfileInterface {
@Override @Override
public String getProfileName() { public String getProfileName() {
if (convertedProfile == null)
createConvertedProfile();
return DecimalFormatter.to2Decimal(convertedProfile.getDefaultProfile().percentageBasalSum()) + "U "; return DecimalFormatter.to2Decimal(convertedProfile.getDefaultProfile().percentageBasalSum()) + "U ";
} }

View file

@ -13,9 +13,9 @@ import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.Constants; import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.ProfileStore;
import info.nightscout.androidaps.interfaces.PluginBase; import info.nightscout.androidaps.interfaces.PluginBase;
import info.nightscout.androidaps.interfaces.ProfileInterface; import info.nightscout.androidaps.interfaces.ProfileInterface;
import info.nightscout.androidaps.data.ProfileStore;
import info.nightscout.utils.SP; import info.nightscout.utils.SP;
/** /**
@ -146,7 +146,6 @@ public class SimpleProfilePlugin implements PluginBase, ProfileInterface {
basal = SP.getDouble("SimpleProfile" + "basal", 1d); basal = SP.getDouble("SimpleProfile" + "basal", 1d);
targetLow = SP.getDouble("SimpleProfile" + "targetlow", 80d); targetLow = SP.getDouble("SimpleProfile" + "targetlow", 80d);
targetHigh = SP.getDouble("SimpleProfile" + "targethigh", 120d); targetHigh = SP.getDouble("SimpleProfile" + "targethigh", 120d);
createConvertedProfile();
} }
/* /*
@ -211,6 +210,8 @@ public class SimpleProfilePlugin implements PluginBase, ProfileInterface {
@Override @Override
public ProfileStore getProfile() { public ProfileStore getProfile() {
if (convertedProfile == null)
createConvertedProfile();
return convertedProfile; return convertedProfile;
} }