restrict aproaching daily limit to once every 30 minutes RS
This commit is contained in:
parent
5458df0907
commit
d99fafe375
|
@ -87,6 +87,7 @@ public class DanaRSService extends Service {
|
|||
private Treatment bolusingTreatment = null;
|
||||
|
||||
private long lastHistoryFetched = 0;
|
||||
private long lastApproachingDailyLimit = 0;
|
||||
|
||||
public DanaRSService() {
|
||||
try {
|
||||
|
@ -165,10 +166,12 @@ public class DanaRSService extends Service {
|
|||
NSUpload.uploadDeviceStatus();
|
||||
if (danaRPump.dailyTotalUnits > danaRPump.maxDailyTotalUnits * Constants.dailyLimitWarning) {
|
||||
log.debug("Approaching daily limit: " + danaRPump.dailyTotalUnits + "/" + danaRPump.maxDailyTotalUnits);
|
||||
if(System.currentTimeMillis() > lastApproachingDailyLimit + 30 * 60 * 1000) {
|
||||
Notification reportFail = new Notification(Notification.APPROACHING_DAILY_LIMIT, MainApp.gs(R.string.approachingdailylimit), Notification.URGENT);
|
||||
MainApp.bus().post(new EventNewNotification(reportFail));
|
||||
NSUpload.uploadError(MainApp.gs(R.string.approachingdailylimit) + ": " + danaRPump.dailyTotalUnits + "/" + danaRPump.maxDailyTotalUnits + "U");
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("Unhandled exception", e);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue