feat(stats): add 5 new user statistics charts (#2703)
* feat(stats): add 5 new user statistics charts * fix(stats): use COALESCE for dateFinished in heartbeat and page turner queries * refactor(stats): remove heartbeat, genre flow, reading seasons, and abandonment autopsy charts * feat(stats): add 5 new user statistics charts * feat(stats): add info tooltips to all 5 new charts * perf(stats): limit completion race chart to 15 most recent books server-side * fix(stats): limit completion race to 10 books and cap progress at 100% * refactor(stats): replace streak bars with GitHub-style activity heatmap calendar * fix(stats): widen chart info tooltips to prevent tall narrow box * feat(stats): add info tooltip to Page Turner Score chart * feat(stats): add info tooltips to 7 existing charts * refactor(stats): deduplicate chart-info-icon style into global styles.scss * refactor(stats): fix scoring bugs and improve Reading DNA and Reading Habits charts * refactor(stats): rebalance Series Progress Tracker layout and unify heatmap footer pills * feat(stats): add info tooltips to 4 remaining charts * fix(stats): fix session duration and overlap bugs in Reading Session Timeline
This commit is contained in:
@@ -49,6 +49,27 @@ export interface PeakHoursResponse {
|
||||
totalDurationSeconds: number;
|
||||
}
|
||||
|
||||
export interface PageTurnerScoreResponse {
|
||||
bookId: number;
|
||||
bookTitle: string;
|
||||
categories: string[];
|
||||
pageCount: number;
|
||||
personalRating: number;
|
||||
gripScore: number;
|
||||
totalSessions: number;
|
||||
avgSessionDurationSeconds: number;
|
||||
sessionAcceleration: number;
|
||||
gapReduction: number;
|
||||
finishBurst: boolean;
|
||||
}
|
||||
|
||||
export interface CompletionRaceResponse {
|
||||
bookId: number;
|
||||
bookTitle: string;
|
||||
sessionDate: string;
|
||||
endProgress: number;
|
||||
}
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
@@ -112,4 +133,23 @@ export class UserStatsService {
|
||||
{params}
|
||||
);
|
||||
}
|
||||
|
||||
getPageTurnerScores(): Observable<PageTurnerScoreResponse[]> {
|
||||
return this.http.get<PageTurnerScoreResponse[]>(
|
||||
`${this.readingSessionsUrl}/page-turner-scores`
|
||||
);
|
||||
}
|
||||
|
||||
getCompletionRace(year: number): Observable<CompletionRaceResponse[]> {
|
||||
return this.http.get<CompletionRaceResponse[]>(
|
||||
`${this.readingSessionsUrl}/completion-race`,
|
||||
{params: {year: year.toString()}}
|
||||
);
|
||||
}
|
||||
|
||||
getReadingDates(): Observable<ReadingSessionHeatmapResponse[]> {
|
||||
return this.http.get<ReadingSessionHeatmapResponse[]>(
|
||||
`${this.readingSessionsUrl}/reading-dates`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user