Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: Reading Time Pro - Feedback & Issues

Status Resolved
Add-on / Version Reading Time Pro 0.1.0
Severity
EE Version 5.2.1

BoldMinded (Brian)

Apr 09, 2019

Hey Brian,

We installed the beta for Reading Time Pro today. Is looking good but I have some questions & feedback.
Please check out this video: https://share.vidyard.com/watch/HrsbAprHbYUZ8nNuFRiQHw?
Here are the steps:

1. After installing the addon I browsed the listing page. It seems it evaluates whatever’s inside the exp:channel:entries tag. Because the listing page has so little content, it saved a few seconds of reading time on each entry.

2. To reset that I have to re-save an entry, and then visit the detail page with the full text before I visit the listing page. This is ok for new entries (I haven’t tried, but I would assume using the preview could be enough to save the right content on entry save), but we have another +1000 blog articles that would need re-saving. Is there a way we can work around this? Or could we ask the plugin to save the reading time of a specific content field, even if it’s not parsed on that listing exp:channel:entries loop?

3. The {finished_reading_time:relative} tag outputs “in xxx minutes” or “less than a minute”. On the first case, can we remove the word “in”? I tried to have more control with {reading_time format="%i"} but it seems PHP always outputs the leading zero on the minutes format, and looks odd.

That’s my feedback so far. Other than that it performs fast and works nicely.
Please keep me in copy as well as Sarah. Once we get your responses we’ll be able to close and publish into production.
Thank you for your work!

Best regards,
Santiago.-

 

#1

BoldMinded (Brian)

Hi, Santiago!

1) Did you add the reading_time_field=”” parameter to your listing entry page? If so that would explain why it captured such a small reading time. You shouldn’t have to add it to the listing page, only the entries tag that contains the full content, but in the listing page just add the {finished_reading_time:relative} to display the output.

2) Thanks for mentioning the reset stuff, maybe I can add a CP page or something to perform a global reset of reading times so you don’t have to re-save each entry separately. For now you may need to just run an DB query to delete the value in that field. If this isn’t something you’re comfortable with I can help with that, but I would need to know what the field_id is of the custom field.

3) The :relative modifier is an EE thing, not something I wrote. You might be able to add your own language file to override what EE is trying to do. I think this is the value it uses for the text: https://github.com/ExpressionEngine/ExpressionEngine/blob/stability/system/ee/legacy/language/english/core_lang.php#L209

#2

BoldMinded (Brian)

Comment has been marked private.

#3

BoldMinded (Brian)

That is the wrong build. Try this one instead. https://www.dropbox.com/s/ggl2m38xjqgrlyk/reading-time-pro-020-522a50f6.zip?dl=0

#4

Sarah Friedlander

Brian,

I was testing this. When going into the backend options, to see the list or click the reset, I get this:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 36864 bytes) in /var/www/staging/html/w-admin/ee/EllisLab/ExpressionEngine/Service/Model/Model.php on line 724

If I refresh the page I get to see the list, but I can’t reset it. Can you have a look?

#5

Sarah Friedlander

FYI also from my tests, the entry preview parses the plugin just fine, but doesn’t save the info on the db. Not sure if that’s by design. Thanks!

Santiago.-

#6

BoldMinded (Brian)

I was worried about that the performance of the deletion. I asked EllisLab in the forum the best way to batch clear a single field across a ton of entries, so waiting on feedback from them on that.

#7

BoldMinded (Brian)

“but doesn’t save the info on the db. Not sure if that’s by design.” - it should definitely be saving the value to the DB. Are you able to take a quick video of this so I can see what you are seeing (including the DB)?

#8

BoldMinded (Brian)

“but doesn’t save the info on the db. Not sure if that’s by design.” - it should definitely be saving the value to the DB. Are you able to take a quick video of this so I can see what you are seeing (including the DB)?

#9

Sarah Friedlander

HI Brian,

I will let Santiago respond about the db issue. He will send you a video for that. I do have a question about the word “in”. I know you showed us where it was, but Santiago was having a hard time finding it. I’m wondering if you would be able to fix that for us, so that we don’t have to override EE files override files every time we upgrade.

Let me know. Thanks!

  • Sarah
#10

BoldMinded (Brian)

I think you can do user based language overrides. In system/user/language/make an english folder, and a core_lang.php file with the following contents:

<?php  if ( !defined('BASEPATH')) exit('No direct script access allowed');

$lang = [
    'future' => 'whatever you want %s.',
];

If that does not work, you may have to copy the entire language/english folder from EE’s core to your user folder and make the change there. It depends on how EE loads and merges those arrays.

#11

Sarah Friedlander

Thanks Brian, the language bit did the work nicely.

I installed your addon on production and got tons of errors: https://drive.google.com/file/d/15xH-a8HDJQXPHp3HkkklunIDeJEhEIBg/view?usp=sharing What do you think?

Regarding the “not saving in the db” bit, let’s see if I can explain myself better. Check out this video: https://share.vidyard.com/watch/y6HMqopJGRmQ5Cb48BA3cJ?

  1. I opened with saved reading time data. I saved the entry and the data was reset.
  2. After saving I opened the preview. On the live preview the tag parses nicely and shows the right result. I save the entry again.
  3. Though the tag parsed correctly, after saving and refreshing I still get the “Reading time has not been calculated.”

I would assume that after step #2, since the tag parsed the content on the live preview, that action would save the reading time. Makes sense?

Looking forward to your feedback. Santiago.-

#12

BoldMinded (Brian)

Did you get that query error in any local or dev environments first? What exactly are you doing when you get that error? Just loading the settings page? How many channels do you have the reading time field assigned to? Did you create 1 reading time field and assign it to multiple channels, or multiple reading time fields and assign each one to a specific channel? The specific you can get about your usage of this (channel and field names used, maybe even field_ids) the more it helps me understand what might be happening. Can you update the ticket again with CP login so I can take a peak at the environment?

Thanks for the video. It probably does save the reading time to the DB when loading the live preview, but since the publish page is still open, it isn’t live updating to fetch the newly saved value, so it might be saving a blank value back to the database immediately when you click the save button. I’ll take a further look into this scenario.

#13

BoldMinded (Brian)

Also, I might have to update the settings page to add checkboxes to select which entries you want to reset the reading times for to create a batch query. Trying to update 100s or 1000s of entries at once will likely cause problems (and might be the error you posted the screenshot of). Which means you’d be able to reset just 20 entries at a time.

#14

BoldMinded (Brian)

Comment has been marked private.

#15

BoldMinded (Brian)

Do you have a URL to your staging site that I can take a look at that is using RTP? Also, do you mind if I take a screenshot of the front-end entry displaying the calculated reading time and use the screenshot in when promoting the item and in the docs? My local environment is bare bones and doesn’t really have a design to provide context. 😊

#16

BoldMinded (Brian)

Comment has been marked private.

#17

Sarah Friedlander

Comment has been marked private.

#18

BoldMinded (Brian)

The user/pass in the ticket is not working.

#19

Sarah Friedlander

Can you try again?

#20

BoldMinded (Brian)

Login works now, thanks.

#21

BoldMinded (Brian)

You didn’t have the parameter on the entries tag:

{exp:channel:entries channel="news_articles" dynamic="no" limit="100" reading_time_field="reading_time"}
#22

Sarah Friedlander

OK I added that. It’s parsing the content of the listing, like I reported earlier on the thread. Have a look: https://www.w-systems.com/blog

My code: {exp:channel:entries channel=”news_articles” paginate=”bottom” dynamic=”no” limit=”12” reading_time_field=”reading_time” }

Let me know. I installed 0.4 already btw. Santiago.-

#23

BoldMinded (Brian)

Comment has been marked private.

#24

Sarah Friedlander

OK. Any ideas about the listing?

#25

BoldMinded (Brian)

I refreshed the reading times on some of the more recent entries and it seems to have calculated it right. Remember, don’t put the reading_time_field=”reading_time” parameter on your blog list page, just the page that is displaying the full blog content. The list page won’t display a reading time until the full page has been loaded at least once.

#26

Sarah Friedlander

Hi Brian,

So to confirm - in order to calculate correctly we would have to go in and resave all blog article entries?

  • S
#27

Sarah Friedlander

Hi Brian,

I tried resaving a few entries and it keeps defaulting back to seconds.

#28

Sarah Friedlander

Brian,

If I don’t add the reading_time_field=“reading_time” to the listing, the {finished_reading_time:relative} tag won’t parse. What do you suggest to fix that? I thought you were answering this on https://boldminded.com/support/ticket/1955#comment21, sorry for the confusion.

We’re also worried that whenever we make any changes and save the entry, we’ll have to go to the entry again on the frontend. We can do that for a first round, but on daily basis with +1000 articles that will be a nightmare. Is there any way it could calculate and save on the backend, w/o having to go through the actual entry on the website?

Thanks, Santiago.

#29

BoldMinded (Brian)

Comment has been marked private.

#30

BoldMinded (Brian)

“If I don’t add the reading_time_field=“reading_time” to the listing, the {finished_reading_time:relative} tag won’t parse.” - I’m looking into this.

#31

BoldMinded (Brian)

Yeah, I see the issue now. I’ll send a new build soonish.

#32

BoldMinded (Brian)

Comment has been marked private.

#33

BoldMinded (Brian)

Comment has been marked private.

#34

Sarah Friedlander

Fantastic. Works like a charm.

Regarding this bit: You don’t have to save them to re-calculate, that is why I made the module page so you can select entries and reset the values. To re-calculate you have to load one fo the full detail pages, e.g. https://www.w-systems.com/blog/building-a-prospect-list

The module works just fine too, and it’s useful when we want to reset on purpose. But if I save an entry, it does reset/empty the existing value. So if I, let’s say, only fix a typo, I still have to go into the full detail page on the frontend to have the correct value re-saved into the database. This doesn’t affect the detail page, because whenever I load it it’s going to update the value, but it does affect the values on the listing page.

Here’s another quick video, in case it’s useful: https://share.vidyard.com/watch/2Boaf4ggt8TiuFxgFZ54BE?

Thanks for the fast responses! Santiago

#35

BoldMinded (Brian)

I watched the video and tried to replicate it locally but wasn’t able to. That appeared to have reset the field value for all entries, does that describe what you are seeing?

#36

Sarah Friedlander

Not quite. It only resets the field value of the entry you’re saving. I just gave you an example where I only had one entry with reading time value. So, current behaviour: 1. Entry “A” has a reading time of 6 minutes. 2. I edit entry “A”, and save. 3. As soon as I save, the entry’s reading time is set to empty. 4. I must go into the detail url again, so it re-saves the reading time.

Expected behaviour: 1. Entry “A” has a reading time of 6 minutes. 2. I edit entry “A”, and save. It doesn’t erase or override the reading time. This means it still shows up perfectly on listings. 4. If I want to, I can go into the detail url, and it will refresh/update the reading time.

Hope that makes more sense. S-

#37

BoldMinded (Brian)

It only resets the field value of the entry you’re saving… 1. Entry “A” has a reading time of 6 minutes. 2. I edit entry “A”, and save. 3. As soon as I save, the entry’s reading time is set to empty. 4. I must go into the detail url again, so it re-saves the reading time.

Which is the correct behavior, sounds like that is working correctly to me.

I edit entry “A”, and save. It doesn’t erase or override the reading time. This means it still shows up perfectly on listings.

If someone edits an entry, it could be changing the amount of words, thus the reading time would need to be re-calculated.

If I want to, I can go into the detail url, and it will refresh/update the reading time

That would require some sort of trigger, such as a query string parameter to tell it to refresh the reading time, otherwise it would refresh it every page load, which defeats the purpose of caching it (and defeats the purpose of this add-on).

Yes, when you edit an entry it will wipe out the reading time value. The first time someone loads the detail page it will re-calculate and immediately show the reading time to the user. Until that is done, the listing page won’t have a reading time, so maybe a conditional on the listing page would be appropriate to not show anything until the detail page has been loaded at least once. Maybe you can instruct content editors to to visit the page after they make any updates. This is a bit of a chicken and egg scenario, yes, but either scenario requires some manual intervention to load the detail page and force the calculation to happen. The only automated way around this is to get much more complex with the add-on and have it load the page in the background after saving with a cURL request similar to how CE Cache re-warms the page, but that wasn’t in scope.

#38

BoldMinded (Brian)

I could add an option to the fieldtype that is a checkbox that when checked won’t reset the reading time when saving an entry. It would be checked by default though.

#39

Sarah Friedlander

You had also mentioned this: The only automated way around this is to get much more complex with the add-on and have it load the page in the background after saving with a cURL request similar to how CE Cache re-warms the page, but that wasn’t in scope.

I know this was not in scope, but I am wondering what an estimate would be to have this feature built out?

(This is Sarah responding again, Santiago is out on vacation this week for the Easter holidays).

#40

BoldMinded (Brian)

I’d have to think about that one for a bit. I’ll get back to you tomorrow. The problem is, unless you’re using Structure it is difficult to know what the URL is to any entry due to how un-restricting EE’s templates are.

#41

BoldMinded (Brian)

I might be able to use the Preview URL used in the Live Preview feature. Still, will need to think about it.

#42

Sarah Friedlander

No problem - give it some thought.

We have a pretty large marketing team, so relying on each content writer, marketing manager an associate marketing manager to load the live page is a hard task. My hope was that on save we would be able to calculate the reading time (the backend to EE) instead of it loading only when you go to the live page on the frontend.

Think about it - I don’t want to make this more difficult than it needs to be.

#43

BoldMinded (Brian)

I think I can make this work as long as the Structure URL or Live Preview URL are defined, which it sounds like you’re using the LP, so that is good. This one is a bit of a nebulous feature, so I’m estimating 2-8 hours of work. Again I’ll have a better idea of how long it’ll take after I spend 1-2 hours working on it. I’ll make it so if neither the Structure URL or Live Preview URL are available, it just won’t attempt to load the page, b/c then it gets super complex.

#44

BoldMinded (Brian)

Comment has been marked private.

#45

BoldMinded (Brian)

The build in the previous message will attempt to refresh the reading time of the actual detail page so long as it has one of the following:

• A Structure URL • A Pages URL • A Live Preview URL is defined in the channel’s settings

If it still doesn’t work, check the developer log. The server needs to be able to make requests to itself. Locally I had to an entry to my hosts file, e.g.

127.0.0.1    local.dev
#46

Sarah Friedlander

Hi Brian,

Sorry for the silence - I’m swamped with some other items at work today. I can review the comments either later tonight or tomorrow. We do not use Structure URL for the blog now, and we don’t always generate a live preview before saving.

What does the new build accomplish? I’m happy to agree upon the hours of work, but I want to make sure that we both agree with the scope and desired result before proceeding.

Thank you!

-S

#47

Sarah Friedlander

Hi Brian,

I tested out this build on our staging site - when I go into the backend of an entry and save instead of it calculating the time it changes the time read to the word “read”. Here’s a video showing this: https://www.screencast.com/t/9xwdnWsvq2HU

Thanks, Sarah

#48

BoldMinded (Brian)

Comment has been marked private.

#49

Sarah Friedlander

Here you go - Easier as a txt file, the image was quite large.

https://www.dropbox.com/s/b2lg67itujc88vt/Blog Post Dev Log.txt?dl=0

#50

BoldMinded (Brian)

So it is clearly able to make a request to that page, which should have set the reading time correctly.

I’ll double check locally but this has worked for me in all instances.

#51

Sarah Friedlander

OK, thanks. If you want access to our staging environment to test, let me know.

  • Sarah
#52

BoldMinded (Brian)

Staging access might help, yes. Are you able to provide FTP? If so make sure the login works before you send it (seems half the time I get sent FTP info it doesn’t work the first time I try it b/c the user doesn’t have write permissions or something).

#53

BoldMinded (Brian)

Edit the ticket and add the FTP info in the provided fields. When the ticket is closed the info is removed from my DB, it’s the most secure way to share it.

#54

Sarah Friedlander

Will do. I just added a task for my DevOps team to give you FTP access. I’ll test it before I send it to you.

#55

BoldMinded (Brian)

Comment has been marked private.

#56

Sarah Friedlander

No change - still turning everything to “read”. I’m working on getting you FTP access along with login to staging

#57

BoldMinded (Brian)

“read” is just the text from the language file, it means there is no reading time value being saved to the db.

#58

Sarah Friedlander

I added login via FTP as well as EE CP to the ticket. I tested both. For FTP these are the settings you’ll need: https://www.dropbox.com/s/absk4b1r2odn249/Screenshot 2019-04-18 17.06.28.png?dl=0

Please note that since this is staging the website is in offline mode. If you need to do testing to see logs, you can temporarily activate and turn it to online mode.

  • Sarah
#59

BoldMinded (Brian)

I think I figured it out. It was a couple of things:

The site/test-3 template which appeared to actually load the blog article content didn’t have the calculated_reading_time parameter:

{exp:channel:entries entry_id="{embed:entry_id}" dynamic="no" status="not Closed" calculate_reading_time="yes" wpm="150"}

And the main issue was that CE Cache is attempting to perform it’s own cache busting routine which apparently terminated any subsequent request. So I changed how the process is triggered in Reading Time Pro so it waits until the very end.

New build in the next comment.

#60

BoldMinded (Brian)

Comment has been marked private.

#61

Sarah Friedlander

Hi Brian,

Did you make changes to the site/test-3 template on staging? I just want to understand so I can make sure to make the same updates on our production environment.

This new version is working like a charm. I do have one request. Right now the read time is only calculated on save. Could we have reading time pro calculate the read time either on save of the EE entry or on external page load?

For example: https://staging.w-systems.com/blog/the-ultimate-guide-to-planning-your-sugarcrm-strategy-in-2019 is calculated incorrectly and it would be nice if on page load it would display the correct time instead of going into the backend to save old entries.

  • S
#62

BoldMinded (Brian)

The only template code I changed was adding calculate_reading_time=”yes” to the entries tag in site/test-3 as indicated above.

Could we have reading time pro calculate the read time either on save of the EE entry or on external page load?

That is what it currently does. For the entries that are calculated incorrectly you can use the add-on’s settings page to clear the incorrect times, then when the page is loaded again on the front-end it will save the correct reading time. Reading times are cleared or reset in one of two ways:

  1. Saving the entry as you normally would in the CP
  2. Using the settings page to remove the current reading times, then new page loads on the front-end will save the new reading time.

I could add a hidden config override to always re-calculate the reading time every page load on the front-end, but TBH I feel like that defeats the purpose the add-on, which is to be as fast as possible.

#63

Sarah Friedlander

Hi Brian,

I apologize for the delay. I understand what you are saying here that the reading times are cleared or reset in one of two ways:

  1. Saving the entry as you normally would in the CP
  2. Using the settings page to remove the current reading times, then new page loads on the front-end will save the new reading time.

However, what I am asking for is that IF the current time that is already calculated is incorrect, upon saving the entry as you normally would in the CP (#1) it would be able to overwrite with the correct reading time. Does that make?

  • Sarah
#64

BoldMinded (Brian)

That does make sense, but I think my hidden config option I previously mentioned would be best for that. The word counting is what takes the most processing time, and to always check to see if the DB needs to be updated or not means that processing has to be done every page load to check the word count, so it might as well just update the database each time too, b/c that is super fast.

I’ll make the update in the next day or two and send you a new build.

#65

BoldMinded (Brian)

Comment has been marked private.

#66

Sarah Friedlander

Thanks Brian,

Forgive my ignorance, which config file would I put the following code?

$config['rtp_always_calculate'] = 'y';
#67

BoldMinded (Brian)

In your main config.php file.

#68

Sarah Friedlander

Hey Brian, this is Santiago.

I added the latest build and the rtp_always_calculate override. Seems to work perfectly on the blog entry, but not on listings. If I add the parameter to the config file, the listing page returns empty values for {reading_time} and {finished_reading_time:relative}. Any ideas?

#69

BoldMinded (Brian)

Comment has been marked private.

#70

Sarah Friedlander

Thanks Brian! Works perfectly.

Santiago.-

#71

BoldMinded (Brian)

Excellent!

#72

Sarah Friedlander

Looks like it’s working perfectly. You can close.

#73

BoldMinded (Brian)

Comment has been marked private.

Login to reply