Skeudenn / main/db/stats-repository / StatsRepository
Class: StatsRepository ​
Defined in: src/main/db/stats-repository.ts:18
Records the time the active user spent reading and reads their history back.
Constructors ​
Constructor ​
new StatsRepository(
db,userId?):StatsRepository
Defined in: src/main/db/stats-repository.ts:19
Parameters ​
db ​
DatabaseSync
userId? ​
() => string
Returns ​
StatsRepository
Methods ​
addReadingTime() ​
addReadingTime(
libraryId,seconds,now?):void
Defined in: src/main/db/stats-repository.ts:25
Adds seconds of reading on libraryId to the day of now.
Parameters ​
libraryId ​
string
seconds ​
number
now? ​
Date = ...
Returns ​
void
clearHistory() ​
clearHistory():
void
Defined in: src/main/db/stats-repository.ts:50
Deletes the active user's reading sessions; books, progress, ratings and completion dates are kept.
Returns ​
void
get() ​
get():
ReadingStats
Defined in: src/main/db/stats-repository.ts:55
The history: completion dates and reading time per day, oldest first.
Returns ​
history() ​
history(
limit?):ReadingHistoryEntry[]
Defined in: src/main/db/stats-repository.ts:35
The active user's reading history, most recent first: one line per day and book, at most limit. The title is null for a book removed from the library since.
Parameters ​
limit? ​
number = READING_HISTORY_LIMIT