|
|
@ -985,7 +985,12 @@ exports.getSuppliers = async (req, reply) => {
|
|
|
|
|
|
|
|
|
|
|
|
let tankers = await Tanker.find(tankerQuery);
|
|
|
|
let tankers = await Tanker.find(tankerQuery);
|
|
|
|
|
|
|
|
|
|
|
|
if (price_from && price_to) {
|
|
|
|
const isValidPrice = (val) => {
|
|
|
|
|
|
|
|
const num = parseInt(val);
|
|
|
|
|
|
|
|
return !isNaN(num) && isFinite(num);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isValidPrice(price_from) && isValidPrice(price_to)) {
|
|
|
|
tankers = tankers.filter(tanker => {
|
|
|
|
tankers = tankers.filter(tanker => {
|
|
|
|
const tankerPrice = parsePrice(tanker.price);
|
|
|
|
const tankerPrice = parsePrice(tanker.price);
|
|
|
|
return tankerPrice >= priceFrom && tankerPrice <= priceTo;
|
|
|
|
return tankerPrice >= priceFrom && tankerPrice <= priceTo;
|
|
|
|