diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index 5a00c0dbe..f37882e9f 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php @@ -14,6 +14,7 @@ use Symfony\Component\Validator\Constraints as Assert; use Wallabag\AnnotationBundle\Entity\Annotation; use Wallabag\CoreBundle\Helper\EntityTimestampsTrait; use Wallabag\CoreBundle\Helper\UrlHasher; +use Wallabag\CoreBundle\Tools\Utils; use Wallabag\UserBundle\Entity\User; /** @@ -658,6 +659,14 @@ class Entry $this->readingTime = $readingTime; } + /** + * @return float + */ + public function getUserReadingTime() + { + return round($this->readingTime / $this->getUser()->getConfig()->getReadingSpeed() * Utils::DEFAULT_WORDS_PER_MINUTE); + } + /** * @return string */ diff --git a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php index 2642f9e27..757578444 100644 --- a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php +++ b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php @@ -16,6 +16,7 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Wallabag\CoreBundle\Repository\EntryRepository; +use Wallabag\CoreBundle\Tools\Utils; use Wallabag\UserBundle\Entity\User; class EntryFilterType extends AbstractType @@ -57,8 +58,8 @@ class EntryFilterType extends AbstractType return; } - $min = (int) ($lower * $user->getConfig()->getReadingSpeed() / 200); - $max = (int) ($upper * $user->getConfig()->getReadingSpeed() / 200); + $min = (int) ($lower * $user->getConfig()->getReadingSpeed() / Utils::DEFAULT_WORDS_PER_MINUTE); + $max = (int) ($upper * $user->getConfig()->getReadingSpeed() / Utils::DEFAULT_WORDS_PER_MINUTE); if (null === $lower && null !== $upper) { // only lower value is defined: query all entries with reading LOWER THAN this value diff --git a/src/Wallabag/CoreBundle/Helper/EntriesExport.php b/src/Wallabag/CoreBundle/Helper/EntriesExport.php index 350a396f8..0273f21e6 100644 --- a/src/Wallabag/CoreBundle/Helper/EntriesExport.php +++ b/src/Wallabag/CoreBundle/Helper/EntriesExport.php @@ -210,7 +210,7 @@ class EntriesExport $publishedDate = $entry->getPublishedAt()->format('Y-m-d'); } - $readingTime = round($entry->getReadingTime() / $user->getConfig()->getReadingSpeed() * 200); + $readingTime = $entry->getUserReadingTime(); $titlepage = $content_start . '