use customized name only for LocalProfile
This commit is contained in:
parent
3b90d02e05
commit
1994cd707c
5 changed files with 9 additions and 10 deletions
|
@ -1541,9 +1541,10 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
old = getDaoProfileSwitch().queryForId(profileSwitch.date);
|
old = getDaoProfileSwitch().queryForId(profileSwitch.date);
|
||||||
if (old != null) {
|
if (old != null) {
|
||||||
if (!old.isEqual(profileSwitch)) {
|
if (!old.isEqual(profileSwitch)) {
|
||||||
|
profileSwitch.source = old.source;
|
||||||
|
profileSwitch.profileName = old.profileName; // preserver profileName to prevent multiple CPP extension
|
||||||
getDaoProfileSwitch().delete(old); // need to delete/create because date may change too
|
getDaoProfileSwitch().delete(old); // need to delete/create because date may change too
|
||||||
old.copyFrom(profileSwitch);
|
getDaoProfileSwitch().create(profileSwitch);
|
||||||
getDaoProfileSwitch().create(old);
|
|
||||||
log.debug("PROFILESWITCH: Updating record by date from: " + Source.getString(profileSwitch.source) + " " + old.toString());
|
log.debug("PROFILESWITCH: Updating record by date from: " + Source.getString(profileSwitch.source) + " " + old.toString());
|
||||||
scheduleProfileSwitchChange();
|
scheduleProfileSwitchChange();
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -10,7 +10,6 @@ import org.json.JSONObject;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import info.nightscout.androidaps.data.Profile;
|
import info.nightscout.androidaps.data.Profile;
|
||||||
|
@ -18,8 +17,6 @@ import info.nightscout.androidaps.interfaces.Interval;
|
||||||
import info.nightscout.androidaps.plugins.Overview.graphExtensions.DataPointWithLabelInterface;
|
import info.nightscout.androidaps.plugins.Overview.graphExtensions.DataPointWithLabelInterface;
|
||||||
import info.nightscout.androidaps.plugins.Overview.graphExtensions.PointsWithLabelGraphSeries;
|
import info.nightscout.androidaps.plugins.Overview.graphExtensions.PointsWithLabelGraphSeries;
|
||||||
import info.nightscout.utils.DateUtil;
|
import info.nightscout.utils.DateUtil;
|
||||||
import info.nightscout.utils.DecimalFormatter;
|
|
||||||
import info.nightscout.utils.SafeParse;
|
|
||||||
|
|
||||||
@DatabaseTable(tableName = DatabaseHelper.DATABASE_PROFILESWITCHES)
|
@DatabaseTable(tableName = DatabaseHelper.DATABASE_PROFILESWITCHES)
|
||||||
public class ProfileSwitch implements Interval, DataPointWithLabelInterface {
|
public class ProfileSwitch implements Interval, DataPointWithLabelInterface {
|
||||||
|
@ -68,7 +65,7 @@ public class ProfileSwitch implements Interval, DataPointWithLabelInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCustomizedName() {
|
public String getCustomizedName() {
|
||||||
String name = DecimalFormatter.to2Decimal(getProfileObject().percentageBasalSum()) + "U ";
|
String name = profileName;
|
||||||
if (isCPP) {
|
if (isCPP) {
|
||||||
name += "(" + percentage + "%," + timeshift + "h)";
|
name += "(" + percentage + "%," + timeshift + "h)";
|
||||||
}
|
}
|
||||||
|
|
|
@ -941,7 +941,7 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
||||||
ProfileSwitch profileSwitch = getProfileSwitchFromHistory(time);
|
ProfileSwitch profileSwitch = getProfileSwitchFromHistory(time);
|
||||||
if (profileSwitch != null) {
|
if (profileSwitch != null) {
|
||||||
if (profileSwitch.profileJson != null) {
|
if (profileSwitch.profileJson != null) {
|
||||||
return customized?profileSwitch.getCustomizedName():profileSwitch.profileName;
|
return customized ? profileSwitch.getCustomizedName() : profileSwitch.profileName;
|
||||||
} else {
|
} else {
|
||||||
Profile profile = activeProfile.getProfile().getSpecificProfile(profileSwitch.profileName);
|
Profile profile = activeProfile.getProfile().getSpecificProfile(profileSwitch.profileName);
|
||||||
if (profile != null)
|
if (profile != null)
|
||||||
|
|
|
@ -16,6 +16,7 @@ import info.nightscout.androidaps.R;
|
||||||
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.androidaps.data.ProfileStore;
|
||||||
|
import info.nightscout.utils.DecimalFormatter;
|
||||||
import info.nightscout.utils.SP;
|
import info.nightscout.utils.SP;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -247,7 +248,7 @@ public class LocalProfilePlugin implements PluginBase, ProfileInterface {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getProfileName() {
|
public String getProfileName() {
|
||||||
return convertedProfileName;
|
return DecimalFormatter.to2Decimal(convertedProfile.getDefaultProfile().percentageBasalSum()) + "U ";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -274,7 +274,7 @@ public class NSUpload {
|
||||||
JSONObject data = new JSONObject();
|
JSONObject data = new JSONObject();
|
||||||
data.put("eventType", CareportalEvent.PROFILESWITCH);
|
data.put("eventType", CareportalEvent.PROFILESWITCH);
|
||||||
data.put("duration", profileSwitch.durationInMinutes);
|
data.put("duration", profileSwitch.durationInMinutes);
|
||||||
data.put("profile", profileSwitch.profileName);
|
data.put("profile", profileSwitch.getCustomizedName());
|
||||||
data.put("profileJson", profileSwitch.profileJson);
|
data.put("profileJson", profileSwitch.profileJson);
|
||||||
data.put("profilePlugin", profileSwitch.profilePlugin);
|
data.put("profilePlugin", profileSwitch.profilePlugin);
|
||||||
if (profileSwitch.isCPP) {
|
if (profileSwitch.isCPP) {
|
||||||
|
|
Loading…
Reference in a new issue