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

Long reading times not properly shown #120

Open
mwermelinger opened this issue Oct 29, 2019 · 9 comments
Open

Long reading times not properly shown #120

mwermelinger opened this issue Oct 29, 2019 · 9 comments
Assignees
Labels

Comments

@mwermelinger
Copy link

I have a file with 4137 words and in the settings I have put a reading speed of 35 words per minute. It's a pedagogical text and I want to account for my students' time to re-read and highlight passages, write notes, etc. hence the low WPM.

So the text should take 4137/35 = 118.2 minutes = 118 minutes and 12 seconds to process, but the display only shows 18:12. The most significant digit is gone! The error also occurs if the display of the word and character count is disabled, so it's not a lack of space issue. I'm using word count 3.1.0.

I'm not quite sure what's the point of providing the reading time to the second given that any word counting algorithm and reading speed setting will be approximate. I'd rather have hours and minutes, so 1:58 in this case. If the file is a whole novel or play (think Project Gutenberg) then these longer times will occur even with higher WPM speeds and should be correctly displayed.

Thanks in advance for looking into this.

@MasterOfTheTiger
Copy link
Contributor

I wrote some code associcated with this. I may have not considered this case. I agree that hour:minute would probably be better, since the margin of error is likely much greater than several seconds when it comes to estimating reading time, and that level of accuracy simply isn't necessary.

There are two ways I can see fixing this:

  • Removing the limit to numbers shown in minutes
  • Changing it to display hours:minutes and having no limit on hours.

It could also change systems depending on how long the text is. E.g. 30s, 10m, 2.5h, 2d, etc. But that would require a bigger change on the functionality of the estimated time feature.

@davidlday davidlday added the bug label Oct 30, 2019
@MasterOfTheTiger
Copy link
Contributor

@davidlday I am willing to work on this, but how should it be resolved?

@mwermelinger
Copy link
Author

Thanks for this. My preference would be to do as in your 2nd bullet point

@davidlday
Copy link
Collaborator

@davidlday I am willing to work on this, but how should it be resolved?

Option 2 would also be my preference. @OleMchls - any preference?

@OleMchls
Copy link
Owner

OleMchls commented Nov 1, 2019

I’m also for option two. However, I’d like to highlight that I think the correct solution would include this part that @MasterOfTheTiger mentioned:

It could also change systems depending on how long the text is. E.g. 30s, 10m, 2.5h, 2d, etc. But that would require a bigger change on the functionality of the estimated time feature.

@davidlday
Copy link
Collaborator

@MasterOfTheTiger - I assigned you, if you still have time to work on it. Let me know if you need any help or guidance.

@MasterOfTheTiger
Copy link
Contributor

@davidlday I will work on this, if you are willing to be a bit patient. I may be able to get it written within a week realistically.

@MasterOfTheTiger
Copy link
Contributor

This is as far as I have gotten. It doesn't work, but I am too tired to figure it out at the moment.

  charactersToHMS: (words) ->
    # 1- calculate minutes and seconds for reading
    wpm = atom.config.get('wordcount.wordsPerMinute')
    minutes = words / wpm
    hours = minutes / 60
    # 2- recalculate minutes based on hours
    minutes = parseInt(hours * 60)
    # 60 minutes in 1 hour
    # 3- Calculate remainder of minutes without hours and vice versa
    hours = Math.round(hours % 60)
    minutes = Math.round(minutes % 60)
    # 4- Return time
    minutes = ('0' + minutes).slice(-2)
    hours + ':' + minutes

@mwermelinger
Copy link
Author

mwermelinger commented Nov 26, 2019

Thanks for working on this. I don't know which language Atom is written in, but in Python one could work just with integers and then convert to a string in the end:

words = 4137     # values from my original post
wpm = 35
minutes = round(words / wpm)  # could also be floor division to ignore the seconds
hours = minutes // 60        # floor division
minutes = minutes % 60
return str(hours) + ':' + ('0' if minutes < 10 else '') + str(minutes) 

There are other ways of formatting strings in Python but this is probably the simplest to adapt to your language.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants