Merge pull request #1979 from andyrozman/bug_1972_double_bolus_fill_cancula

Fix for fill canula double bolus
This commit is contained in:
Milos Kozak 2019-08-23 22:09:41 +02:00 committed by GitHub
commit cd550e4c0f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -294,14 +294,19 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
}
/**
* Returns all Treatments after specified timestamp. Also returns invalid entries (required to
* map "Fill Canulla" entries to history (and not to add double bolus for it)
*
* @param fromTimestamp
* @return
*/
@Override
public List<Treatment> getTreatmentsFromHistoryAfterTimestamp(long fromTimestamp) {
List<Treatment> in5minback = new ArrayList<>();
long time = System.currentTimeMillis();
synchronized (treatments) {
for (Treatment t : treatments) {
if (!t.isValid)
continue;
if (t.date <= time && t.date >= fromTimestamp)
in5minback.add(t);
}