Merge pull request #2315 from jotomo/refactor-rename-treatmentsplugin-getcarbtreatments
Refactor: improve misleading method name.
This commit is contained in:
commit
e1394ec5dd
|
@ -31,7 +31,7 @@ public interface TreatmentsInterface {
|
||||||
MealData getMealData();
|
MealData getMealData();
|
||||||
|
|
||||||
List<Treatment> getTreatmentsFromHistory();
|
List<Treatment> getTreatmentsFromHistory();
|
||||||
List<Treatment> getTreatments5MinBackFromHistory(long time);
|
List<Treatment> getCarbTreatments5MinBackFromHistory(long time);
|
||||||
List<Treatment> getTreatmentsFromHistoryAfterTimestamp(long timestamp);
|
List<Treatment> getTreatmentsFromHistoryAfterTimestamp(long timestamp);
|
||||||
long getLastBolusTime();
|
long getLastBolusTime();
|
||||||
|
|
||||||
|
|
|
@ -237,11 +237,11 @@ public class IobCobOref1Thread extends Thread {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Treatment> recentTreatments = TreatmentsPlugin.getPlugin().getTreatments5MinBackFromHistory(bgTime);
|
List<Treatment> recentCarbTreatments = TreatmentsPlugin.getPlugin().getCarbTreatments5MinBackFromHistory(bgTime);
|
||||||
for (int ir = 0; ir < recentTreatments.size(); ir++) {
|
for (Treatment recentCarbTreatment : recentCarbTreatments) {
|
||||||
autosensData.carbsFromBolus += recentTreatments.get(ir).carbs;
|
autosensData.carbsFromBolus += recentCarbTreatment.carbs;
|
||||||
autosensData.activeCarbsList.add(new AutosensData.CarbsInPast(recentTreatments.get(ir)));
|
autosensData.activeCarbsList.add(new AutosensData.CarbsInPast(recentCarbTreatment));
|
||||||
autosensData.pastSensitivity += "[" + DecimalFormatter.to0Decimal(recentTreatments.get(ir).carbs) + "g]";
|
autosensData.pastSensitivity += "[" + DecimalFormatter.to0Decimal(recentCarbTreatment.carbs) + "g]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -236,11 +236,11 @@ public class IobCobThread extends Thread {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Treatment> recentTreatments = TreatmentsPlugin.getPlugin().getTreatments5MinBackFromHistory(bgTime);
|
List<Treatment> recentCarbTreatments = TreatmentsPlugin.getPlugin().getCarbTreatments5MinBackFromHistory(bgTime);
|
||||||
for (int ir = 0; ir < recentTreatments.size(); ir++) {
|
for (Treatment recentCarbTreatment : recentCarbTreatments) {
|
||||||
autosensData.carbsFromBolus += recentTreatments.get(ir).carbs;
|
autosensData.carbsFromBolus += recentCarbTreatment.carbs;
|
||||||
autosensData.activeCarbsList.add(new AutosensData.CarbsInPast(recentTreatments.get(ir)));
|
autosensData.activeCarbsList.add(new AutosensData.CarbsInPast(recentCarbTreatment));
|
||||||
autosensData.pastSensitivity += "[" + DecimalFormatter.to0Decimal(recentTreatments.get(ir).carbs) + "g]";
|
autosensData.pastSensitivity += "[" + DecimalFormatter.to0Decimal(recentCarbTreatment.carbs) + "g]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -361,11 +361,10 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Treatment> getTreatments5MinBackFromHistory(long time) {
|
public List<Treatment> getCarbTreatments5MinBackFromHistory(long time) {
|
||||||
List<Treatment> in5minback = new ArrayList<>();
|
List<Treatment> in5minback = new ArrayList<>();
|
||||||
synchronized (treatments) {
|
synchronized (treatments) {
|
||||||
for (Integer pos = 0; pos < treatments.size(); pos++) {
|
for (Treatment t : treatments) {
|
||||||
Treatment t = treatments.get(pos);
|
|
||||||
if (!t.isValid)
|
if (!t.isValid)
|
||||||
continue;
|
continue;
|
||||||
if (t.date <= time && t.date > time - 5 * 60 * 1000 && t.carbs > 0)
|
if (t.date <= time && t.date > time - 5 * 60 * 1000 && t.carbs > 0)
|
||||||
|
|
Loading…
Reference in a new issue