Merge pull request #2315 from jotomo/refactor-rename-treatmentsplugin-getcarbtreatments

Refactor: improve misleading method name.
This commit is contained in:
Milos Kozak 2019-12-28 21:48:57 +01:00 committed by GitHub
commit e1394ec5dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 14 deletions

View file

@ -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();

View file

@ -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]";
}

View file

@ -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]";
}

View file

@ -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)