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

Idle time over 100% in writing statistics #1149

Closed
TannersAndRodents opened this issue Oct 10, 2022 · 5 comments · Fixed by #1153
Closed

Idle time over 100% in writing statistics #1149

TannersAndRodents opened this issue Oct 10, 2022 · 5 comments · Fixed by #1153
Assignees
Labels
bug Issue: Something isn't working
Milestone

Comments

@TannersAndRodents
Copy link

The idle time of a project's session statistics can reach more than 100%. The idle time in a .csv export will be greater than the total time:

"Date","Length (sec)","Words Changed","Novel Words","Note Words","Idle Time (sec)"
"2022-10-10 11:23:29",480,15,15,0,500

To reproduce, create new project, write a few words, loose focus of novelWriter, wait some time, close novelWriter, open again and examine statistics.

This occurred in all my project's first sessions and in some other it was rounded to 100%, but the idle time was greater than the session length.
I'm not sure if this is a feature I don't understand or an issue related to time measuring during project creation. However, for me this has low priority, it just looks weird.

@TannersAndRodents TannersAndRodents added the bug Issue: Something isn't working label Oct 10, 2022
@vkbo
Copy link
Owner

vkbo commented Oct 10, 2022

Hmm, that should technically not be possible. The session time is calculated from the time you closed the project minus the time you opened it, so it should not be possible for the idle time to be larger than this interval.

So. this only happens in the first session, but not after that? If so, it could just be some initialisation issue. Perhaps the idle time value is inherited from the previous project when you create a new one. It is not intended behaviour anyway.

@vkbo vkbo self-assigned this Oct 10, 2022
@vkbo vkbo added this to Triage in Bug Tracker 1.x via automation Oct 10, 2022
@vkbo
Copy link
Owner

vkbo commented Oct 10, 2022

Woop. Managed to reproduce it. When you create a new project from the open dialog immediately when you open novelWriter, the idle time is not zeroed. It includes the time you took to create the project itself it seems. There is clearly a zeroing out of idle time missing somewhere.

This is a bit of a corner case, but it should be easy enough to track down.

@vkbo vkbo added this to the Release 2.0 RC 1 milestone Oct 10, 2022
@vkbo vkbo moved this from Triage to Needs Fixing in Bug Tracker 1.x Oct 10, 2022
@vkbo
Copy link
Owner

vkbo commented Oct 10, 2022

Note to self. These two lines need to be added to the newProject method in GuiMain:

self.idleRefTime = time()
self.idleTime = 0.0

It is indeed including the time you spent creating the project in the idle time calculation, but the session itself doesn't start until the project is created. Hence you'll get a few tens of seconds additional idle time.

@TannersAndRodents
Copy link
Author

TannersAndRodents commented Oct 10, 2022

This occurred in all my project's first sessions and in some other it was rounded to 100%, but the idle time was greater than the session length.

I looked at my 100% idle sessions again, and it seems I and confused idle time with length. So the issue indeed only occurs when creating a new project like you described.

@vkbo
Copy link
Owner

vkbo commented Oct 10, 2022

Yeah, the values are properly reset when you open a project, and when you close one. Creating a new project is neither of those, and instead a weird in-between state. I'm considering rewriting the new project feature to just generate it on disk and then do a normal open project process. That way, these corner cases cannot happen. Opening and closing projects is well tested in the test suite, creating new ones during runtime isn't. This is not the first such issue.

Bug Tracker 1.x automation moved this from Needs Fixing to Closed Oct 11, 2022
@vkbo vkbo modified the milestones: Release 2.0 RC 1, Release 1.6.5 Oct 13, 2022
vkbo added a commit that referenced this issue Oct 13, 2022
@vkbo vkbo mentioned this issue Oct 13, 2022
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue: Something isn't working
Projects
No open projects
Bug Tracker 1.x
  
Closed
Development

Successfully merging a pull request may close this issue.

2 participants