mirror of
https://github.com/jfoucry/Pilldroid.git
synced 2024-11-22 04:29:22 +01:00
Improve new stock calcultation
This commit is contained in:
parent
e37ace03dd
commit
5088d912de
1 changed files with 5 additions and 3 deletions
|
@ -163,8 +163,10 @@ public class Medicament implements Serializable {
|
||||||
void newStock() {
|
void newStock() {
|
||||||
Date lastUpdate = new Date(getDateLastUpdate());
|
Date lastUpdate = new Date(getDateLastUpdate());
|
||||||
int numberOfDays = nbOfDaysBetweenDateAndToday(lastUpdate);
|
int numberOfDays = nbOfDaysBetweenDateAndToday(lastUpdate);
|
||||||
double takeDuringPeriod = this.prise * numberOfDays;
|
if (numberOfDays > 0) {
|
||||||
setStock(getStock() - takeDuringPeriod);
|
double takeDuringPeriod = this.prise * numberOfDays;
|
||||||
setDateLastUpdate(dateAtNoon(new Date()).getTime());
|
setStock(getStock() - takeDuringPeriod);
|
||||||
|
setDateLastUpdate(new Date().getTime());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue