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);
|
||||
if (old != null) {
|
||||
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
|
||||
old.copyFrom(profileSwitch);
|
||||
getDaoProfileSwitch().create(old);
|
||||
getDaoProfileSwitch().create(profileSwitch);
|
||||
log.debug("PROFILESWITCH: Updating record by date from: " + Source.getString(profileSwitch.source) + " " + old.toString());
|
||||
scheduleProfileSwitchChange();
|
||||
return true;
|
||||
|
|
|
@ -10,7 +10,6 @@ import org.json.JSONObject;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
||||
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.PointsWithLabelGraphSeries;
|
||||
import info.nightscout.utils.DateUtil;
|
||||
import info.nightscout.utils.DecimalFormatter;
|
||||
import info.nightscout.utils.SafeParse;
|
||||
|
||||
@DatabaseTable(tableName = DatabaseHelper.DATABASE_PROFILESWITCHES)
|
||||
public class ProfileSwitch implements Interval, DataPointWithLabelInterface {
|
||||
|
@ -68,7 +65,7 @@ public class ProfileSwitch implements Interval, DataPointWithLabelInterface {
|
|||
}
|
||||
|
||||
public String getCustomizedName() {
|
||||
String name = DecimalFormatter.to2Decimal(getProfileObject().percentageBasalSum()) + "U ";
|
||||
String name = profileName;
|
||||
if (isCPP) {
|
||||
name += "(" + percentage + "%," + timeshift + "h)";
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ import info.nightscout.androidaps.R;
|
|||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
import info.nightscout.androidaps.interfaces.ProfileInterface;
|
||||
import info.nightscout.androidaps.data.ProfileStore;
|
||||
import info.nightscout.utils.DecimalFormatter;
|
||||
import info.nightscout.utils.SP;
|
||||
|
||||
/**
|
||||
|
@ -247,7 +248,7 @@ public class LocalProfilePlugin implements PluginBase, ProfileInterface {
|
|||
|
||||
@Override
|
||||
public String getProfileName() {
|
||||
return convertedProfileName;
|
||||
return DecimalFormatter.to2Decimal(convertedProfile.getDefaultProfile().percentageBasalSum()) + "U ";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -274,7 +274,7 @@ public class NSUpload {
|
|||
JSONObject data = new JSONObject();
|
||||
data.put("eventType", CareportalEvent.PROFILESWITCH);
|
||||
data.put("duration", profileSwitch.durationInMinutes);
|
||||
data.put("profile", profileSwitch.profileName);
|
||||
data.put("profile", profileSwitch.getCustomizedName());
|
||||
data.put("profileJson", profileSwitch.profileJson);
|
||||
data.put("profilePlugin", profileSwitch.profilePlugin);
|
||||
if (profileSwitch.isCPP) {
|
||||
|
|
Loading…
Reference in a new issue