Commit 63d873b3 by Damien Moulard

2297 fix error when changing stats period

parent 6ce91bb9
Pipeline #1790 passed with stage
in 1 minute 39 seconds
...@@ -240,7 +240,6 @@ function compute_products_coverage_qties() { ...@@ -240,7 +240,6 @@ function compute_products_coverage_qties() {
order_doc.coeff = coeff; order_doc.coeff = coeff;
if (order_doc.coverage_days != null) { if (order_doc.coverage_days != null) {
compute_and_affect_product_supplier_quantities(coeff, order_doc.coverage_days); compute_and_affect_product_supplier_quantities(coeff, order_doc.coverage_days);
resolve();
} else if (order_doc.targeted_amount != null) { } else if (order_doc.targeted_amount != null) {
const small_step = 0.1, const small_step = 0.1,
max_iter = 182; // Assume that no more than 1/2 year coverage is far enough max_iter = 182; // Assume that no more than 1/2 year coverage is far enough
...@@ -265,10 +264,6 @@ function compute_products_coverage_qties() { ...@@ -265,10 +264,6 @@ function compute_products_coverage_qties() {
step = small_step; // we have gone too far, let's go back, using small step step = small_step; // we have gone too far, let's go back, using small step
days -= step; days -= step;
} }
/* console.log(iter)
console.log(order_total_value_f + '/' + targeted_amount_f)
console.log(days)
console.log(go_on)*/
} else { } else {
if (step == small_step) { if (step == small_step) {
// amount was above the target, let's compute again with the previous value // amount was above the target, let's compute again with the previous value
...@@ -282,13 +277,10 @@ function compute_products_coverage_qties() { ...@@ -282,13 +277,10 @@ function compute_products_coverage_qties() {
iter++; iter++;
} }
resolve();
} }
/* console.log(rder_doc.coverage_days);
console.log(order_doc.targeted_amount)*/
});
resolve();
});
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment