Fix wrong reading time when apply filters
This commit is contained in:
parent
f97653c895
commit
d8f8a59010
@ -35,6 +35,16 @@ class EntryFilterType extends AbstractType
|
|||||||
{
|
{
|
||||||
$builder
|
$builder
|
||||||
->add('readingTime', NumberRangeFilterType::class, [
|
->add('readingTime', NumberRangeFilterType::class, [
|
||||||
|
'apply_filter' => function (QueryInterface $filterQuery, $field, $values) {
|
||||||
|
$value = $values['value'];
|
||||||
|
|
||||||
|
$min = (int) ($value['left_number'][0] * $this->user->getConfig()->getReadingSpeed());
|
||||||
|
$max = (int) ($value['right_number'][0] * $this->user->getConfig()->getReadingSpeed());
|
||||||
|
|
||||||
|
$expression = $filterQuery->getExpr()->between($field, $min, $max);
|
||||||
|
|
||||||
|
return $filterQuery->createCondition($expression);
|
||||||
|
},
|
||||||
'label' => 'entry.filters.reading_time.label',
|
'label' => 'entry.filters.reading_time.label',
|
||||||
])
|
])
|
||||||
->add('createdAt', DateRangeFilterType::class, [
|
->add('createdAt', DateRangeFilterType::class, [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user