Skip to content
This repository has been archived by the owner on Jul 31, 2024. It is now read-only.

Commit

Permalink
fix: bug where the calculated typing speed was lower than the actual …
Browse files Browse the repository at this point in the history
…typing speed
  • Loading branch information
vycdev committed Apr 25, 2020
1 parent 0c9db68 commit 082e348
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/web/src/components/common/typingBox/typingBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ export const TypingBox = (props: typingBoxProps) => {
): number => {
const charTyped = array
.map((value: typedArrayInterface) => {
return value.state === "correct" ? value.word.length : 0;
return value.state === "correct" ? value.word.length + 1 : 0;
})
.reduce((prev: number, currentValue: number) => {
return prev + currentValue;
});
.reduce((previous: number, current: number) => {
return previous + current;
}, 0);

return Math.floor(charTyped / ((60 - time === 0 ? 1 : 60 - time) / 60));
};
Expand Down

0 comments on commit 082e348

Please sign in to comment.