Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

store estimated reading time in database (#393) #1297

Merged
merged 1 commit into from
Aug 12, 2015
Merged

Conversation

nicosomb
Copy link
Member

@nicosomb nicosomb commented Aug 7, 2015

see #393

@nicosomb nicosomb added this to the 2.0 milestone Aug 7, 2015
@tcitworld
Copy link
Member

Any idea what's happening with Travis CI ?

@tcitworld
Copy link
Member

I wonder if we should try looking for another solution. This method to estimate reading time is kind of really bad with non-Latin characters and/or some languages.

@nicosomb
Copy link
Member Author

nicosomb commented Aug 7, 2015

What do you suggest?

@tcitworld
Copy link
Member

try looking for another solution

;-)

@nicosomb
Copy link
Member Author

nicosomb commented Aug 7, 2015

@j0k3r I really don't understand why tests failed. Maybe I'm so tired. Go to bed. If you can help me ... ;-)

@tcitworld
Copy link
Member

Didn't find any real alternative, but it seems to me we could take in consideration pictures, with a time related to their size.

@nicosomb
Copy link
Member Author

nicosomb commented Aug 8, 2015

Yeah, I found my error. Fixed.

@nicosomb
Copy link
Member Author

nicosomb commented Aug 8, 2015

but it seems to me we could take in consideration pictures

Seriously? It's an estimation of reading time, I don't think we should take in consideration pictures.

@tcitworld
Copy link
Member

Well, I thought it more like the time spent on the whole article. Weren't we considering counting the length of videos too ?

*/
public static function getReadingTime($text)
{
return floor(str_word_count(strip_tags($text)) / 200);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WP plugin seems to use 250 words per minutes (see here), maybe we can adjust it ?
Also, it could be interesting to explain the calculation, at least what is this number 200.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you just add a comment about the 200 number? Telling that it is referencing to words per minute

@j0k3r
Copy link
Member

j0k3r commented Aug 9, 2015

I don't this a lot of tests in this PR :)

@tcitworld
Copy link
Member

Wikipedia shows some data about the number of words reads per minute : https://en.m.wikipedia.org/wiki/Reading_(process)#Reading_rate

@nicosomb
Copy link
Member Author

@modos189 I'll add filters to filter articles by estimated reading view. I'll add a select list (with 3 items "< 5min", "between 5 and 10" and "> 10 min") and 2 text fields "min" and "max" to allow the user to filter with personal filters.
If my explanations are clear, can you imagine how we can implement that on Unread / starred / archive screen?

Next, we'll have a new filter, by domain name.

@modos189
Copy link
Contributor

screen6

@nicosomb
Copy link
Member Author

I'm not sure that the filters icon is obvious for everyone.
And do you think popin is good for users?
Do you think we can consider a right sidebar?

Thank you for your reactivity.

@tcitworld
Copy link
Member

It's normal when using material design, but on an desktop view it's taking time to access.

@tcitworld
Copy link
Member

Also, maybe buttons instead of a list to choose from (one click instead of two).

@nicosomb
Copy link
Member Author

It's normal when using material design
You talk about which point?

@tcitworld
Copy link
Member

The filter icon. You find it on any android app using material design.

@nicosomb
Copy link
Member Author

I don't this a lot of tests in this PR :)

This PR is still in progress, don't worry ;-)

@modos189
Copy link
Contributor

screen7
I do not want the icon to change

@tcitworld
Copy link
Member

I find this nice.

@nicosomb
Copy link
Member Author

👍

@tcitworld
Copy link
Member

And we can add more filter options in the future.

@tcitworld
Copy link
Member

As for more filters (I write it here, I know it's dirty), there should be the date when the entry was created and the type (MIME type in database).

EDIT : also author if we manage to have sufficient results

@nicosomb
Copy link
Member Author

@j0k3r how do you think we can implement tests for this feature? Just by adding some articles (and setting estimating time by hand) and filling filter form?

@@ -32,6 +36,7 @@ public function addEntryAction(Request $request)

$entry->setTitle($content->getTitle());
$entry->setContent($content->getBody());
$entry->setReadingTime(Tools::getReadingTime($content->getBody()));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't you do that directly in the EntryEntity ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

$entries = $this->getDoctrine()
$form = $this->get('form.factory')->create(new EntryFilterType());

$filterBuilder = $this->getDoctrine()
->getRepository('WallabagCoreBundle:Entry')
->findUnreadByUser($this->getUser()->getId());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you really need to call it find? getFilterForUnreadByUser doesn't work?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It must start by findBy or findOne...

@j0k3r
Copy link
Member

j0k3r commented Aug 10, 2015

Just defined some fixtures (and/or updated existing one) and they will have estimated time. Then create a test for a filter by filling the form and check number of results.

@nicosomb
Copy link
Member Author

I pushed my draft for test. I need help for this one, if you can have a look...

@nicosomb
Copy link
Member Author

Ready for review.

->orderBy('e.id', 'desc')
->getQuery();

$pagerAdapter = new DoctrineORMAdapter($qb);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you removed lines where DoctrineORMAdapter & PagerFanta were used, you can remove these use at the beginning of the file

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still used at the end of the file.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woops, sorry

@nicosomb nicosomb changed the title [WIP] store estimated reading time in database (#393) store estimated reading time in database (#393) Aug 12, 2015
@nicosomb
Copy link
Member Author

finally good to merge?

j0k3r added a commit that referenced this pull request Aug 12, 2015
store estimated reading time in database (#393)
@j0k3r j0k3r merged commit 930334c into v2 Aug 12, 2015
@j0k3r j0k3r deleted the v2-estimated-time branch August 12, 2015 07:05
@nicosomb nicosomb modified the milestones: 2.0, 2.0.0-alpha Aug 12, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants