API+App: podsumowanie po ukonczeniu sesji - POST /sessions/:id/complete zwraca summary (czas/serie/powt./tonaz, killstreak + centyl passy, tonaz vs srednie 30 dni; niekrytyczne = null), celebracyjne okno w DayExecution i helpery format (swagger, unit, e2e)
This commit is contained in:
@@ -6,6 +6,7 @@ import type {
|
||||
AnnouncementDetail,
|
||||
Availability,
|
||||
CalendarDay,
|
||||
CompletionSummary,
|
||||
Conversation,
|
||||
ConversationThread,
|
||||
Dashboard,
|
||||
@@ -848,7 +849,9 @@ export function deleteSessionSet(setId: string) {
|
||||
}
|
||||
|
||||
export function completeSession(sessionId: string) {
|
||||
return api(`/sessions/${sessionId}/complete`, { method: 'POST' });
|
||||
return api<{ ok: true; summary: CompletionSummary | null }>(`/sessions/${sessionId}/complete`, {
|
||||
method: 'POST',
|
||||
});
|
||||
}
|
||||
|
||||
export function abandonSession(sessionId: string) {
|
||||
|
||||
@@ -591,6 +591,35 @@ export interface ActiveSession {
|
||||
startedAt: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Podsumowanie z POST /sessions/{id}/complete — dane celebracyjnego okna po
|
||||
* treningu (liczby sesji + killstreak z centylem + tonaż wobec średnich 30 dni).
|
||||
* null = serwer nie zbudował podsumowania (niekrytyczne) — front pokaże toast.
|
||||
*/
|
||||
export interface CompletionSummary {
|
||||
durationSec: number;
|
||||
exercises: number;
|
||||
sets: number;
|
||||
bonusSets: number;
|
||||
reps: number;
|
||||
tonnageKg: number | null;
|
||||
killstreak: {
|
||||
current: number;
|
||||
best: number;
|
||||
newRecord: boolean;
|
||||
/** Ilu innych trenujących ma już historia (przez front próg min. 10). */
|
||||
sampleSize: number;
|
||||
/** Ilu z próbki ma krótszą passę niż aktualna. */
|
||||
beatCount: number;
|
||||
};
|
||||
volume: {
|
||||
ownAvgKg: number | null;
|
||||
ownAvgSessions: number;
|
||||
globalAvgKg: number | null;
|
||||
globalSample: number;
|
||||
};
|
||||
}
|
||||
|
||||
export interface Dashboard {
|
||||
killstreak: number;
|
||||
/** Najlepsza passa z całej historii (planów ACTIVE/SUSPENDED/COMPLETED). */
|
||||
|
||||
Reference in New Issue
Block a user