Include xp data to stats() output
This commit is contained in:
parent
410edccf66
commit
b269a77219
|
|
@ -1,10 +1,12 @@
|
||||||
import { Workout } from "../ast";
|
import { Workout } from "../ast";
|
||||||
|
import { detectRepeats } from "../detectRepeats";
|
||||||
import { Duration } from "../Duration";
|
import { Duration } from "../Duration";
|
||||||
import { Intensity } from "../Intensity";
|
import { Intensity } from "../Intensity";
|
||||||
import { averageIntensity } from "./averageIntensity";
|
import { averageIntensity } from "./averageIntensity";
|
||||||
import { normalizedIntensity } from "./normalizedIntensity";
|
import { normalizedIntensity } from "./normalizedIntensity";
|
||||||
import { totalDuration } from "./totalDuration";
|
import { totalDuration } from "./totalDuration";
|
||||||
import { tss } from "./tss";
|
import { tss } from "./tss";
|
||||||
|
import { xp } from "./xp";
|
||||||
import { zoneDistribution, ZoneDuration } from "./zoneDistribution";
|
import { zoneDistribution, ZoneDuration } from "./zoneDistribution";
|
||||||
|
|
||||||
export type Stats = {
|
export type Stats = {
|
||||||
|
|
@ -12,6 +14,7 @@ export type Stats = {
|
||||||
averageIntensity: Intensity;
|
averageIntensity: Intensity;
|
||||||
normalizedIntensity: Intensity;
|
normalizedIntensity: Intensity;
|
||||||
tss: number;
|
tss: number;
|
||||||
|
xp: number;
|
||||||
zones: ZoneDuration[];
|
zones: ZoneDuration[];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -24,11 +27,12 @@ export const stats = ({ intervals }: Workout): Stats => {
|
||||||
averageIntensity: averageIntensity(intervals),
|
averageIntensity: averageIntensity(intervals),
|
||||||
normalizedIntensity: normalizedIntensity(intervals),
|
normalizedIntensity: normalizedIntensity(intervals),
|
||||||
tss: tss(duration, normIntensity),
|
tss: tss(duration, normIntensity),
|
||||||
|
xp: xp(detectRepeats(intervals)),
|
||||||
zones: zoneDistribution(intervals),
|
zones: zoneDistribution(intervals),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export const formatStats = ({ totalDuration, averageIntensity, normalizedIntensity, tss, zones }: Stats) => {
|
export const formatStats = ({ totalDuration, averageIntensity, normalizedIntensity, tss, xp, zones }: Stats) => {
|
||||||
return `
|
return `
|
||||||
Total duration: ${(totalDuration.seconds / 60).toFixed()} minutes
|
Total duration: ${(totalDuration.seconds / 60).toFixed()} minutes
|
||||||
|
|
||||||
|
|
@ -36,6 +40,7 @@ Average intensity: ${(averageIntensity.value * 100).toFixed()}%
|
||||||
Normalized intensity: ${(normalizedIntensity.value * 100).toFixed()}%
|
Normalized intensity: ${(normalizedIntensity.value * 100).toFixed()}%
|
||||||
|
|
||||||
TSS: ${tss.toFixed()}
|
TSS: ${tss.toFixed()}
|
||||||
|
XP: ${xp}
|
||||||
|
|
||||||
Zone Distribution:
|
Zone Distribution:
|
||||||
${zones.map(({ name, duration }) => `${(duration.seconds / 60).toFixed().padStart(3)} min - ${name}`).join("\n")}
|
${zones.map(({ name, duration }) => `${(duration.seconds / 60).toFixed().padStart(3)} min - ${name}`).join("\n")}
|
||||||
|
|
|
||||||
|
|
@ -262,6 +262,7 @@ Average intensity: 60%
|
||||||
Normalized intensity: 74%
|
Normalized intensity: 74%
|
||||||
|
|
||||||
TSS: 22
|
TSS: 22
|
||||||
|
XP: 173
|
||||||
|
|
||||||
Zone Distribution:
|
Zone Distribution:
|
||||||
15 min - Z1: Recovery
|
15 min - Z1: Recovery
|
||||||
|
|
@ -282,6 +283,7 @@ Average intensity: 79%
|
||||||
Normalized intensity: 84%
|
Normalized intensity: 84%
|
||||||
|
|
||||||
TSS: 51
|
TSS: 51
|
||||||
|
XP: 502
|
||||||
|
|
||||||
Zone Distribution:
|
Zone Distribution:
|
||||||
10 min - Z1: Recovery
|
10 min - Z1: Recovery
|
||||||
|
|
@ -302,6 +304,7 @@ Average intensity: 36%
|
||||||
Normalized intensity: 71%
|
Normalized intensity: 71%
|
||||||
|
|
||||||
TSS: 37
|
TSS: 37
|
||||||
|
XP: 336
|
||||||
|
|
||||||
Zone Distribution:
|
Zone Distribution:
|
||||||
15 min - Z1: Recovery
|
15 min - Z1: Recovery
|
||||||
|
|
@ -322,6 +325,7 @@ Average intensity: 74%
|
||||||
Normalized intensity: 81%
|
Normalized intensity: 81%
|
||||||
|
|
||||||
TSS: 68
|
TSS: 68
|
||||||
|
XP: 628
|
||||||
|
|
||||||
Zone Distribution:
|
Zone Distribution:
|
||||||
22 min - Z1: Recovery
|
22 min - Z1: Recovery
|
||||||
|
|
@ -342,6 +346,7 @@ Average intensity: 69%
|
||||||
Normalized intensity: 78%
|
Normalized intensity: 78%
|
||||||
|
|
||||||
TSS: 81
|
TSS: 81
|
||||||
|
XP: 755
|
||||||
|
|
||||||
Zone Distribution:
|
Zone Distribution:
|
||||||
42 min - Z1: Recovery
|
42 min - Z1: Recovery
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue