Skip to content

Statistics: actions to enable/disable#13387

Merged
hius07 merged 3 commits into
koreader:masterfrom
hius07:statistics-on-off
Mar 11, 2025
Merged

Statistics: actions to enable/disable#13387
hius07 merged 3 commits into
koreader:masterfrom
hius07:statistics-on-off

Conversation

@hius07
Copy link
Copy Markdown
Member

@hius07 hius07 commented Mar 9, 2025

In addition to toggle.


This change is Reviewable

@hius07
Copy link
Copy Markdown
Member Author

hius07 commented Mar 9, 2025

Also minor fix to Profiles plugin, to address @mergen3107 's #12547 (comment).

Comment on lines +2843 to +2851
UIManager:nextTick(function()
if self.settings.is_enabled then
self.data = config:readSetting("stats", { performance_in_pages = {} })
self.doc_md5 = config:readSetting("partial_md5_checksum")
-- we have correct page count now, do the actual initialization work
self:initData()
self.view.footer:maybeUpdateFooter()
end
end)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hard (and no time from me) to check for any side effects, but be ultra sure there's no issue delaying all of this until nextTick (including accounting the opening page for statistics).
There may be lots of stuff happening between ReaderReady and its next tick (ie. all the postReaderReadyCallback stuff).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

all the postReaderReadyCallback stuff

3 calls only, and it looks more correct to begin the staistics after them:

-- And check if we can migrate to a newest DOM version after
-- the book is loaded (unless the user told us not to).
if config:nilOrFalse("cre_keep_old_dom_version") then
self.ui:registerPostReaderReadyCallback(function()
self:checkXPointersAndProposeDOMVersionUpgrade()
end)
end

-- Add location at book opening to stack
self.ui:registerPostReaderReadyCallback(function()
self:addCurrentLocationToStack()
end)

if needs_update or needs_sort then
self.ui:registerPostReaderReadyCallback(function()
self:updateAnnotations(needs_update, needs_sort)
end)
config:delSetting("annotations_externally_modified")
end

@hius07
Copy link
Copy Markdown
Member Author

hius07 commented Mar 10, 2025

@mergen3107 you can test it, the Statistics can be disabled on book opening.

@mergen3107
Copy link
Copy Markdown
Contributor

Thanks, @hius07
I will test it later this evening

@mergen3107
Copy link
Copy Markdown
Contributor

@hius07
Hooray!
Thank you very much!
Everything works great now:

  1. Auto exec profile with zotero in the path works!
  2. I created two profiles (zotero file opened - statistics OFF, and vice versa)
  3. That 00:00:00 empty entry doesn't show up anymore! The whole book is just skipped by Statistics plugin.

This is exactly how I imagined it to be :)

@hius07 hius07 merged commit 1bdf0dd into koreader:master Mar 11, 2025
@hius07 hius07 deleted the statistics-on-off branch March 11, 2025 07:07
@hius07 hius07 added this to the 2025.02 milestone Mar 11, 2025
0xstillb pushed a commit to 0xstillb/koreader-thai that referenced this pull request May 9, 2026
Statistics: actions to enable/disable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants