This commit is contained in:
Horis
2025-02-16 20:06:44 +08:00
parent d447ef69ff
commit 74143ddd06
2 changed files with 6 additions and 2 deletions
@@ -40,4 +40,7 @@ interface BookChapterDao {
@Query("delete from chapters where bookUrl = :bookUrl")
fun delByBook(bookUrl: String)
@Query("update chapters set wordCount = :wordCount where bookUrl = :bookUrl and url = :url")
fun upWordCount(bookUrl: String, url: String, wordCount: String)
}
@@ -185,8 +185,9 @@ object BookHelp {
bookChapter.getFileName(),
).writeText(content)
if (book.isOnLineTxt && AppConfig.tocCountWords) {
bookChapter.wordCount = StringUtils.wordCountFormat(content.length)
appDb.bookChapterDao.update(bookChapter)
val wordCount = StringUtils.wordCountFormat(content.length)
bookChapter.wordCount = wordCount
appDb.bookChapterDao.upWordCount(bookChapter.bookUrl, bookChapter.url, wordCount)
}
}