diff --git a/src/helpers/session.ts b/src/helpers/session.ts index 438a9052..2ac0e25e 100644 --- a/src/helpers/session.ts +++ b/src/helpers/session.ts @@ -37,6 +37,7 @@ export const addExtrapolatedSessions = ( end: historyEnd, extrapolated: true, consecutive: statsConsecutive(historyStart, historyEnd), + ongoing: false, }, ]; } @@ -52,6 +53,7 @@ export const addExtrapolatedSessions = ( end: firstSessionStart, extrapolated: true, consecutive: statsConsecutive(historyStart, firstSessionStart), + ongoing: false, }, ] : []; @@ -63,6 +65,7 @@ export const addExtrapolatedSessions = ( end: historyEnd, extrapolated: true, consecutive: statsConsecutive(lastSessionEnd, historyEnd), + ongoing: false, }, ] : []; @@ -79,6 +82,7 @@ export const addExtrapolatedSessions = ( end: nextSession.start, extrapolated: true, consecutive: statsConsecutive(previousSession.end, nextSession.start), + ongoing: false, }); } } diff --git a/src/helpers/session.unit.test.ts b/src/helpers/session.unit.test.ts index 4966dcd9..d4651c97 100644 --- a/src/helpers/session.unit.test.ts +++ b/src/helpers/session.unit.test.ts @@ -47,6 +47,7 @@ describe(addExtrapolatedSessions, () => { end: makePlayerDataPIT(11, 12_000), extrapolated: false, consecutive: true, + ongoing: false, }, ], history: undefined, @@ -56,6 +57,7 @@ describe(addExtrapolatedSessions, () => { end: makePlayerDataPIT(11, 12_000), extrapolated: false, consecutive: true, + ongoing: false, }, ], }, @@ -67,6 +69,7 @@ describe(addExtrapolatedSessions, () => { end: makePlayerDataPIT(13, 12_000), extrapolated: false, consecutive: false, + ongoing: false, }, ], history: [], @@ -76,6 +79,7 @@ describe(addExtrapolatedSessions, () => { end: makePlayerDataPIT(13, 12_000), extrapolated: false, consecutive: false, + ongoing: false, }, ], }, @@ -87,6 +91,7 @@ describe(addExtrapolatedSessions, () => { end: makePlayerDataPIT(11, 12_000), extrapolated: false, consecutive: true, + ongoing: false, }, ], history: [makePlayerDataPIT(0, 0)], @@ -97,6 +102,7 @@ describe(addExtrapolatedSessions, () => { end: makePlayerDataPIT(11, 12_000), extrapolated: false, consecutive: true, + ongoing: false, }, ], }, @@ -110,6 +116,7 @@ describe(addExtrapolatedSessions, () => { end: makePlayerDataPIT(12, 12_000), extrapolated: true, consecutive: false, + ongoing: false, }, ], }, @@ -121,6 +128,7 @@ describe(addExtrapolatedSessions, () => { end: makePlayerDataPIT(12, 12_000), extrapolated: false, consecutive: false, + ongoing: false, }, ], history: [makePlayerDataPIT(10, 11_000), makePlayerDataPIT(12, 12_000)], @@ -130,6 +138,7 @@ describe(addExtrapolatedSessions, () => { end: makePlayerDataPIT(12, 12_000), extrapolated: false, consecutive: false, + ongoing: false, }, ], }, @@ -141,6 +150,7 @@ describe(addExtrapolatedSessions, () => { end: makePlayerDataPIT(11, 12_000), extrapolated: false, consecutive: true, + ongoing: false, }, ], history: [makePlayerDataPIT(8, 9000), makePlayerDataPIT(11, 12_000)], @@ -150,12 +160,14 @@ describe(addExtrapolatedSessions, () => { end: makePlayerDataPIT(10, 11_000), extrapolated: true, consecutive: false, + ongoing: false, }, { start: makePlayerDataPIT(10, 11_000), end: makePlayerDataPIT(11, 12_000), extrapolated: false, consecutive: true, + ongoing: false, }, ], }, @@ -167,6 +179,7 @@ describe(addExtrapolatedSessions, () => { end: makePlayerDataPIT(11, 12_000), extrapolated: false, consecutive: true, + ongoing: false, }, ], history: [makePlayerDataPIT(10, 11_000), makePlayerDataPIT(16, 21_000)], @@ -176,12 +189,14 @@ describe(addExtrapolatedSessions, () => { end: makePlayerDataPIT(11, 12_000), extrapolated: false, consecutive: true, + ongoing: false, }, { start: makePlayerDataPIT(11, 12_000), end: makePlayerDataPIT(16, 21_000), extrapolated: true, consecutive: false, + ongoing: false, }, ], }, @@ -193,6 +208,7 @@ describe(addExtrapolatedSessions, () => { end: makePlayerDataPIT(11, 12_000), extrapolated: false, consecutive: true, + ongoing: false, }, ], history: [makePlayerDataPIT(8, 9000), makePlayerDataPIT(16, 21_000)], @@ -202,18 +218,21 @@ describe(addExtrapolatedSessions, () => { end: makePlayerDataPIT(10, 11_000), extrapolated: true, consecutive: false, + ongoing: false, }, { start: makePlayerDataPIT(10, 11_000), end: makePlayerDataPIT(11, 12_000), extrapolated: false, consecutive: true, + ongoing: false, }, { start: makePlayerDataPIT(11, 12_000), end: makePlayerDataPIT(16, 21_000), extrapolated: true, consecutive: false, + ongoing: false, }, ], }, @@ -225,18 +244,21 @@ describe(addExtrapolatedSessions, () => { end: makePlayerDataPIT(11, 12_000), extrapolated: false, consecutive: true, + ongoing: false, }, { start: makePlayerDataPIT(12, 14_000), end: makePlayerDataPIT(13, 16_000), extrapolated: false, consecutive: true, + ongoing: false, }, { start: makePlayerDataPIT(14, 17_000), end: makePlayerDataPIT(15, 18_000), extrapolated: false, consecutive: true, + ongoing: false, }, ], history: [makePlayerDataPIT(8, 9000), makePlayerDataPIT(16, 21_000)], @@ -246,42 +268,49 @@ describe(addExtrapolatedSessions, () => { end: makePlayerDataPIT(10, 11_000), extrapolated: true, consecutive: false, + ongoing: false, }, { start: makePlayerDataPIT(10, 11_000), end: makePlayerDataPIT(11, 12_000), extrapolated: false, consecutive: true, + ongoing: false, }, { start: makePlayerDataPIT(11, 12_000), end: makePlayerDataPIT(12, 14_000), extrapolated: true, consecutive: true, + ongoing: false, }, { start: makePlayerDataPIT(12, 14_000), end: makePlayerDataPIT(13, 16_000), extrapolated: false, consecutive: true, + ongoing: false, }, { start: makePlayerDataPIT(13, 16_000), end: makePlayerDataPIT(14, 17_000), extrapolated: true, consecutive: true, + ongoing: false, }, { start: makePlayerDataPIT(14, 17_000), end: makePlayerDataPIT(15, 18_000), extrapolated: false, consecutive: true, + ongoing: false, }, { start: makePlayerDataPIT(15, 18_000), end: makePlayerDataPIT(16, 21_000), extrapolated: true, consecutive: true, + ongoing: false, }, ], }, diff --git a/src/mocks/data.ts b/src/mocks/data.ts index 0af996dd..25f27ecb 100644 --- a/src/mocks/data.ts +++ b/src/mocks/data.ts @@ -105,6 +105,7 @@ export const makeSession = ( start: makePlayerDataPIT(uuid, startTime, 1), end: makePlayerDataPIT(uuid, endTime, 2), consecutive: true, + ongoing: false, }); export const makeWrappedResponse = (uuid: string, year: number) => { diff --git a/src/queries/sessions.ts b/src/queries/sessions.ts index c8554c17..a9ed41dc 100644 --- a/src/queries/sessions.ts +++ b/src/queries/sessions.ts @@ -12,6 +12,7 @@ export interface APISession { readonly start: APIPlayerDataPIT; readonly end: APIPlayerDataPIT; readonly consecutive: boolean; + readonly ongoing: boolean; } type APISessions = readonly APISession[]; @@ -21,6 +22,7 @@ export interface Session { readonly end: PlayerDataPIT; readonly extrapolated: boolean; readonly consecutive: boolean; + readonly ongoing: boolean; } export type Sessions = readonly Session[]; @@ -31,6 +33,7 @@ export const apiToSession = ( start: apiToPlayerDataPIT(apiSession.start), end: apiToPlayerDataPIT(apiSession.end), consecutive: apiSession.consecutive, + ongoing: apiSession.ongoing, extrapolated, });