insulincurves - minimum 5
This commit is contained in:
parent
a538160e76
commit
63d46aed56
3 changed files with 19 additions and 7 deletions
|
@ -43,18 +43,18 @@ public abstract class InsulinOrefBasePlugin implements PluginBase, InsulinInterf
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getDia() {
|
public double getDia() {
|
||||||
double dia = MainApp.getConfigBuilder().getProfile() != null ? MainApp.getConfigBuilder().getProfile().getDia() : Constants.defaultDIA;
|
double dia = getUserDefinedDia();
|
||||||
return Math.max(MIN_DIA, dia);
|
return Math.max(MIN_DIA, dia);
|
||||||
//TODO: show on chart if restriction applied
|
}
|
||||||
|
|
||||||
|
public double getUserDefinedDia() {
|
||||||
|
return MainApp.getConfigBuilder().getProfile() != null ? MainApp.getConfigBuilder().getProfile().getDia() : Constants.defaultDIA;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iob iobCalcForTreatment(Treatment treatment, long time, Double dia) {
|
public Iob iobCalcForTreatment(Treatment treatment, long time, Double dia) {
|
||||||
Iob result = new Iob();
|
Iob result = new Iob();
|
||||||
|
|
||||||
|
|
||||||
//curveDefaults
|
|
||||||
|
|
||||||
int peak = getPeak();
|
int peak = getPeak();
|
||||||
|
|
||||||
|
|
||||||
|
@ -78,6 +78,18 @@ public abstract class InsulinOrefBasePlugin implements PluginBase, InsulinInterf
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getComment() {
|
||||||
|
String comment = commentStandardText();
|
||||||
|
double userDia = getUserDefinedDia();
|
||||||
|
if(userDia < MIN_DIA){
|
||||||
|
comment += "\n" + String.format("DIA of %s too short - using %s instead!", userDia, MIN_DIA);
|
||||||
|
}
|
||||||
|
return comment;
|
||||||
|
}
|
||||||
|
|
||||||
abstract int getPeak();
|
abstract int getPeak();
|
||||||
|
|
||||||
|
abstract String commentStandardText();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ public class InsulinOrefRapidActingPlugin extends InsulinOrefBasePlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getComment() {
|
public String commentStandardText() {
|
||||||
return MainApp.sResources.getString(R.string.fastactinginsulincomment);
|
return MainApp.sResources.getString(R.string.fastactinginsulincomment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ public class InsulinOrefUltraRapidActingPlugin extends InsulinOrefBasePlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getComment() {
|
public String commentStandardText() {
|
||||||
return "Fiasp";
|
return "Fiasp";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue