|
|
|
@ -281,10 +281,9 @@ export default createStore({
@@ -281,10 +281,9 @@ export default createStore({
|
|
|
|
|
|
|
|
|
|
if (field.data.percentDone <= 100) { |
|
|
|
|
let minutesSincePlanting = moment.duration(moment().diff(field.data.planted)).asMinutes(); |
|
|
|
|
field.data.percentDone = |
|
|
|
|
Number( |
|
|
|
|
Number(minutesSincePlanting) / Number(seed.cropData.timeToGrow) * 100 |
|
|
|
|
).toFixed(2); |
|
|
|
|
field.data.percentDone = Number( |
|
|
|
|
Number(minutesSincePlanting) / Number(seed.cropData.timeToGrow) * 100 |
|
|
|
|
).toFixed(2); |
|
|
|
|
|
|
|
|
|
if (field.data.percentDone >= 100) { |
|
|
|
|
field.data.percentDone = 100; |
|
|
|
@ -333,6 +332,7 @@ export default createStore({
@@ -333,6 +332,7 @@ export default createStore({
|
|
|
|
|
let animalData = AnimalService.getAnimalByID(animal.id); |
|
|
|
|
if (!animal.production) { |
|
|
|
|
animal.production = { |
|
|
|
|
started: moment(), |
|
|
|
|
ready: moment().add(animalData.production.time, 'minutes'), |
|
|
|
|
percent: 0, |
|
|
|
|
canBeCollected: false |
|
|
|
@ -344,8 +344,11 @@ export default createStore({
@@ -344,8 +344,11 @@ export default createStore({
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (animal.production.percent <= 100) { |
|
|
|
|
let minutesLeft = moment.duration(moment(animal.production.ready).diff(moment())).asMinutes(); |
|
|
|
|
animal.production.percent = Number((Number(animalData.production.time) * 100) / Number(minutesLeft) - 100).toFixed(2); |
|
|
|
|
let minutesSinceLastCollection = moment.duration(moment().diff(animal.production.started)).asMinutes(); |
|
|
|
|
animal.production.percent = Number( |
|
|
|
|
Number(minutesSinceLastCollection) / Number(animalData.production.time) * 100 |
|
|
|
|
).toFixed(2); |
|
|
|
|
|
|
|
|
|
if (animal.production.percent >= 100) { |
|
|
|
|
animal.production.percent = 100; |
|
|
|
|
animal.production.canBeCollected = true; |
|
|
|
|