Skip to content

Commit

Permalink
fix/use average wpm for stats report
Browse files Browse the repository at this point in the history
  • Loading branch information
MUYANGGUO committed Jul 20, 2024
1 parent d9c0cc3 commit e0bc63c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/components/features/TypeBox/Stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React, { useEffect, useState } from "react";
import { Tooltip } from "@mui/material";
import { CHAR_TOOLTIP_TITLE } from "../../../constants/Constants";
import {
LineChart,
Line,
XAxis,
YAxis,
Expand Down Expand Up @@ -213,7 +212,7 @@ const Stats = ({
const renderAccuracy = () => (
<div style={{ marginTop: "16px" }}>
<h2 style={primaryStatsTitleStyles}>ACC</h2>
<h1 style={primaryStatsValueStyles}>{accuracy} %</h1>
<h1 style={primaryStatsValueStyles}>{accuracy}%</h1>
</div>
);

Expand Down Expand Up @@ -245,7 +244,11 @@ const Stats = ({
const renderWpm = () => (
<div>
<h2 style={primaryStatsTitleStyles}>WPM</h2>
<h1 style={primaryStatsValueStyles}>{Math.round(wpm)}</h1>
<h1 style={primaryStatsValueStyles}>
{Math.round(
data.map((e) => e.wpm).reduce((a, b) => a + b, 0) / (data.length - 1)
)}
</h1>
</div>
);

Expand Down

0 comments on commit e0bc63c

Please sign in to comment.