Fix comma parsing when users search for amount:12,34

This commit is contained in:
James Cole
2020-12-01 12:24:23 +01:00
parent dd85b8d46a
commit c563340532

View File

@@ -498,17 +498,27 @@ class OperatorQuerySearch implements SearchInterface
// amount
//
case 'amount_exactly':
$amount = app('steam')->positive((string)$value);
// strip comma's, make dots.
$value = str_replace(',', '.', (string)$value);
$amount = app('steam')->positive($value);
Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));
$this->collector->amountIs($amount);
break;
case 'amount_less':
$amount = app('steam')->positive((string)$value);
// strip comma's, make dots.
$value = str_replace(',', '.', (string)$value);
$amount = app('steam')->positive($value);
Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));
$this->collector->amountLess($amount);
break;
case 'amount_more':
$amount = app('steam')->positive((string)$value);
// strip comma's, make dots.
$value = str_replace(',', '.', (string)$value);
$amount = app('steam')->positive($value);
Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));
$this->collector->amountMore($amount);
break;