restrict aproaching daily limit to once every 30 minutes R-Korean

This commit is contained in:
AdrianLxM 2018-05-05 21:03:35 +02:00
parent b43eff8e55
commit c2315b7bea

View file

@ -201,9 +201,11 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService {
NSUpload.uploadDeviceStatus();
if (mDanaRPump.dailyTotalUnits > mDanaRPump.maxDailyTotalUnits * Constants.dailyLimitWarning) {
log.debug("Approaching daily limit: " + mDanaRPump.dailyTotalUnits + "/" + mDanaRPump.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) + ": " + mDanaRPump.dailyTotalUnits + "/" + mDanaRPump.maxDailyTotalUnits + "U");
};
}
} catch (Exception e) {
log.error("Unhandled exception", e);