Skip to content

Commit

Permalink
Statistics Plugin: Skip adding never opened marked as finished books (k…
Browse files Browse the repository at this point in the history
…oreader#11991)

Closes koreader#11201
Thank you very much @hius07 !
  • Loading branch information
mergen3107 committed Jun 10, 2024
1 parent 786a7e1 commit 0a021d5
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions plugins/statistics.koplugin/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ function ReaderStatistics:initData()
-- Update these numbers to what's actually stored in the settings
self.data.highlights, self.data.notes = self.ui.annotation:getNumberOfHighlightsAndNotes()
self.id_curr_book = self:getIdBookDB()
if not self.id_curr_book then return end
self.book_read_pages, self.book_read_time = self:getPageTimeTotalStats(self.id_curr_book)
if self.book_read_pages > 0 then
self.avg_time = self.book_read_time / self.book_read_pages
Expand Down Expand Up @@ -759,6 +760,7 @@ function ReaderStatistics:getIdBookDB()
local result = stmt:reset():bind(self.data.title, self.data.authors, self.doc_md5):step()
local nr_id = tonumber(result[1])
if nr_id == 0 then
if not self.is_doc_not_frozen then return end
-- Not in the DB yet, initialize it
stmt = conn:prepare("INSERT INTO book VALUES(NULL, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);")
stmt:reset():bind(self.data.title, self.data.authors, self.data.notes,
Expand Down

0 comments on commit 0a021d5

Please sign in to comment.