mirror of
https://github.com/Piwigo/Piwigo.git
synced 2025-04-28 04:09:56 +03:00
fixes #563 quick search filter, wrong limits on upper range limit
This commit is contained in:
parent
88c0ff76c5
commit
0a90a68915
1 changed files with 14 additions and 8 deletions
|
@ -389,15 +389,21 @@ class QNumericRangeScope extends QSearchScope
|
|||
$val = floatval($matches[1]);
|
||||
if (isset($matches[2]))
|
||||
{
|
||||
$mult = 1;
|
||||
if ($matches[2]=='k' || $matches[2]=='K')
|
||||
{
|
||||
$val *= 1000;
|
||||
if ($i) $val += 999;
|
||||
}
|
||||
if ($matches[2]=='m' || $matches[2]=='M')
|
||||
{
|
||||
$val *= 1000000;
|
||||
if ($i) $val += 999999;
|
||||
$mult = 1000;
|
||||
else
|
||||
$mult = 1000000;
|
||||
$val *= $mult;
|
||||
if ($i && !$strict[1])
|
||||
{// round up the upper limit if possible - e.g 6k goes up to 6999, but 6.12k goes only up to 6129
|
||||
if ( ($dot_pos = strpos($matches[1], '.')) !== false )
|
||||
{
|
||||
$requested_precision = strlen($matches[1]) - $dot_pos - 1;
|
||||
$mult /= pow(10, $requested_precision);
|
||||
}
|
||||
if ($mult>1)
|
||||
$val += $mult-1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue