mirror of
https://github.com/jfoucry/Pilldroid.git
synced 2024-11-22 04:29:22 +01:00
Add Prise test
This commit is contained in:
parent
171147b6c5
commit
a03c2dfe77
1 changed files with 10 additions and 8 deletions
|
@ -61,16 +61,18 @@ public class PillDroidJobService extends JobService {
|
|||
catch (Exception ignored){}
|
||||
|
||||
if (firstMedicament != null) {
|
||||
Date dateAlert = UtilDate.removeDaysToDate(firstMedicament.getAlertThreshold(), firstMedicament.getDateEndOfStock());
|
||||
if (firstMedicament.getPrise() != 0) {
|
||||
Date dateAlert = UtilDate.removeDaysToDate(firstMedicament.getAlertThreshold(), firstMedicament.getDateEndOfStock());
|
||||
|
||||
if (dateAlert.getTime() < now.getTime()) {
|
||||
dateSchedule = now.getTime() + 120000; // If dateAlert < now we schedule an alert for now + 120 seconds
|
||||
} else {
|
||||
dateSchedule = dateAlert.getTime(); // If dateAlert > now we use dateAlert as scheduleDate
|
||||
if (dateAlert.getTime() < now.getTime()) {
|
||||
dateSchedule = now.getTime() + 120000; // If dateAlert < now we schedule an alert for now + 120 seconds
|
||||
} else {
|
||||
dateSchedule = dateAlert.getTime(); // If dateAlert > now we use dateAlert as scheduleDate
|
||||
}
|
||||
|
||||
long delay = dateSchedule - now.getTime();
|
||||
scheduleNotification(delay);
|
||||
}
|
||||
|
||||
long delay = dateSchedule - now.getTime();
|
||||
scheduleNotification(delay);
|
||||
}
|
||||
|
||||
Log.d(TAG, "Job finished");
|
||||
|
|
Loading…
Reference in a new issue