Better job requests

This commit is contained in:
Robert Bendun 2021-04-26 21:37:29 +02:00
parent 62a761d270
commit d00a867f5f

View File

@ -151,7 +151,10 @@ class Products {
} }
getJobRequest() { getJobRequest() {
const maybeProduct = this.filter((_product, amount, _i, _j, end) => amount < 50 && end(true)) const maybeProduct = this.filter((_product, amount, _i, _j, end) => amount < 50).sort((a, b) => {
return a.amount - b.amount
})
console.log(maybeProduct);
return maybeProduct.length === 0 ? null : maybeProduct[0] return maybeProduct.length === 0 ? null : maybeProduct[0]
} }