Statistics Plugin: Skip adding never opened marked as finished books (#11991)

Closes #11201
Thank you very much @hius07 !
This commit is contained in:
mergen3107
2024-06-10 08:22:54 -04:00
committed by GitHub
parent 786a7e1a4e
commit 0a021d5e5e

View File

@@ -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
@@ -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,