Merge pull request #387 from MilosKozak/invalid-overview
Fill treatments in Overview
This commit is contained in:
commit
0551f7f16d
|
@ -8,8 +8,6 @@ import com.j256.ormlite.table.DatabaseTable;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import info.nightscout.androidaps.Constants;
|
import info.nightscout.androidaps.Constants;
|
||||||
|
@ -17,7 +15,6 @@ import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.data.Iob;
|
import info.nightscout.androidaps.data.Iob;
|
||||||
import info.nightscout.androidaps.interfaces.InsulinInterface;
|
import info.nightscout.androidaps.interfaces.InsulinInterface;
|
||||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.androidaps.data.Profile;
|
|
||||||
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;
|
||||||
|
@ -152,7 +149,10 @@ public class Treatment implements DataPointWithLabelInterface {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getColor() {
|
public int getColor() {
|
||||||
return Color.CYAN;
|
if (isValid)
|
||||||
|
return Color.CYAN;
|
||||||
|
else
|
||||||
|
return MainApp.instance().getResources().getColor(android.R.color.holo_red_light);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -69,8 +69,8 @@ public class FillDialog extends DialogFragment implements OnClickListener {
|
||||||
|
|
||||||
insulin = (TextView) view.findViewById(R.id.treatments_newtreatment_insulinamount);
|
insulin = (TextView) view.findViewById(R.id.treatments_newtreatment_insulinamount);
|
||||||
Double maxInsulin = MainApp.getConfigBuilder().applyBolusConstraints(Constants.bolusOnlyForCheckLimit);
|
Double maxInsulin = MainApp.getConfigBuilder().applyBolusConstraints(Constants.bolusOnlyForCheckLimit);
|
||||||
|
double bolusstep = MainApp.getConfigBuilder().getPumpDescription().bolusStep;
|
||||||
editInsulin = new PlusMinusEditText(view, R.id.treatments_newtreatment_insulinamount, R.id.treatments_newtreatment_insulinamount_plus, R.id.treatments_newtreatment_insulinamount_minus, 0d, 0d, maxInsulin, 0.05d, new DecimalFormat("0.00"), false);
|
editInsulin = new PlusMinusEditText(view, R.id.treatments_newtreatment_insulinamount, R.id.treatments_newtreatment_insulinamount_plus, R.id.treatments_newtreatment_insulinamount_minus, 0d, 0d, maxInsulin, bolusstep, new DecimalFormat("0.00"), false);
|
||||||
|
|
||||||
//setup preset buttons
|
//setup preset buttons
|
||||||
Button button1 = (Button) view.findViewById(R.id.fill_preset_button1);
|
Button button1 = (Button) view.findViewById(R.id.fill_preset_button1);
|
||||||
|
@ -164,7 +164,7 @@ public class FillDialog extends DialogFragment implements OnClickListener {
|
||||||
DetailedBolusInfo detailedBolusInfo = new DetailedBolusInfo();
|
DetailedBolusInfo detailedBolusInfo = new DetailedBolusInfo();
|
||||||
detailedBolusInfo.insulin = finalInsulinAfterConstraints;
|
detailedBolusInfo.insulin = finalInsulinAfterConstraints;
|
||||||
detailedBolusInfo.context = context;
|
detailedBolusInfo.context = context;
|
||||||
detailedBolusInfo.source = Source.NONE;
|
detailedBolusInfo.source = Source.USER;
|
||||||
detailedBolusInfo.isValid = false; // do not count it in IOB (for pump history)
|
detailedBolusInfo.isValid = false; // do not count it in IOB (for pump history)
|
||||||
PumpEnactResult result = pump.deliverTreatment(detailedBolusInfo);
|
PumpEnactResult result = pump.deliverTreatment(detailedBolusInfo);
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
|
|
|
@ -1599,8 +1599,6 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
|
|
||||||
for (int tx = 0; tx < treatments.size(); tx++) {
|
for (int tx = 0; tx < treatments.size(); tx++) {
|
||||||
Treatment t = treatments.get(tx);
|
Treatment t = treatments.get(tx);
|
||||||
if (!t.isValid)
|
|
||||||
continue;
|
|
||||||
if (t.getX() < fromTime || t.getX() > endTime) continue;
|
if (t.getX() < fromTime || t.getX() > endTime) continue;
|
||||||
t.setY(getNearestBg((long) t.getX(), bgReadingsArray));
|
t.setY(getNearestBg((long) t.getX(), bgReadingsArray));
|
||||||
filteredTreatments.add(t);
|
filteredTreatments.add(t);
|
||||||
|
|
Loading…
Reference in a new issue