diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-04-24 20:24:23 +0200 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-04-24 20:24:23 +0200 |
commit | d8f8a5901086f243f9fa215d52baea6833e1cb55 (patch) | |
tree | c0aeca569d0509b244e4138d765856dd4b364a9c /src | |
parent | f97653c895c5cdd91e766b1c12998f75b99f5a74 (diff) | |
download | wallabag-d8f8a5901086f243f9fa215d52baea6833e1cb55.tar.gz wallabag-d8f8a5901086f243f9fa215d52baea6833e1cb55.tar.zst wallabag-d8f8a5901086f243f9fa215d52baea6833e1cb55.zip |
Fix wrong reading time when apply filters
Diffstat (limited to 'src')
-rw-r--r-- | src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php index dcdb3ab7..5c2216cf 100644 --- a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php +++ b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php | |||
@@ -35,6 +35,16 @@ class EntryFilterType extends AbstractType | |||
35 | { | 35 | { |
36 | $builder | 36 | $builder |
37 | ->add('readingTime', NumberRangeFilterType::class, [ | 37 | ->add('readingTime', NumberRangeFilterType::class, [ |
38 | 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { | ||
39 | $value = $values['value']; | ||
40 | |||
41 | $min = (int) ($value['left_number'][0] * $this->user->getConfig()->getReadingSpeed()); | ||
42 | $max = (int) ($value['right_number'][0] * $this->user->getConfig()->getReadingSpeed()); | ||
43 | |||
44 | $expression = $filterQuery->getExpr()->between($field, $min, $max); | ||
45 | |||
46 | return $filterQuery->createCondition($expression); | ||
47 | }, | ||
38 | 'label' => 'entry.filters.reading_time.label', | 48 | 'label' => 'entry.filters.reading_time.label', |
39 | ]) | 49 | ]) |
40 | ->add('createdAt', DateRangeFilterType::class, [ | 50 | ->add('createdAt', DateRangeFilterType::class, [ |