Improve formatting of main index.ts file

This commit is contained in:
Rene Saarsoo 2020-09-20 15:58:35 +03:00
parent 2871dae0ff
commit 6959537d9e
1 changed files with 12 additions and 23 deletions

View File

@ -13,31 +13,20 @@ console.log(`Parsing: ${filename}`);
const file = fs.readFileSync(filename, "utf8"); const file = fs.readFileSync(filename, "utf8");
const workout = parse(tokenize(file)); const { intervals } = parse(tokenize(file));
console.log(workout.intervals); const duration = totalDuration(intervals);
const avgIntensity = averageIntensity(intervals);
const normIntensity = normalizedIntensity(intervals);
console.log(); console.log(intervals);
console.log("Total TSS: " + tss(workout.intervals).toFixed());
console.log(); console.log(`
console.log( Total duration: ${(duration / 60).toFixed()} minutes
`Total duration: ${(totalDuration(workout.intervals) / 60).toFixed()} minutes`
);
console.log(); Average intensity: ${(avgIntensity * 100).toFixed()}%
console.log( Normalized intensity: ${(normIntensity * 100).toFixed()}%
`Average intensity: ${(averageIntensity(workout.intervals) * 100).toFixed()}%`
);
console.log(
`Normalized intensity: ${(
normalizedIntensity(workout.intervals) * 100
).toFixed()}%`
);
console.log( TSS #1: ${tss(intervals).toFixed()}
`TSS: ${tss2( TSS #2: ${tss2(duration, normIntensity).toFixed()}
totalDuration(workout.intervals), `);
normalizedIntensity(workout.intervals)
)}`
);