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