Skip to content

Commit

Permalink
fix: 変数名の誤字修正
Browse files Browse the repository at this point in the history
  • Loading branch information
i2rin committed Mar 27, 2024
1 parent 09853e5 commit b511d19
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 28 deletions.
12 changes: 6 additions & 6 deletions typing-app/src/components/templates/GameResult.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,28 +53,28 @@ const GameResult: React.FC<GameResultProps> = ({ nextPage, resultScore }) => {
</GridItem>
<GridItem colSpan={3} colStart={6} rowStart={3} className={styles.centerText}>
<Text fontSize="2xl" as="b">
{resultScore.Keystrokes}
{resultScore.keystrokes}
</Text>
</GridItem>
<GridItem colSpan={3} colStart={6} rowStart={4} className={styles.centerText}>
<Text fontSize="2xl" as="b">
{resultScore.Miss}
{resultScore.miss}
</Text>
</GridItem>
<GridItem colSpan={3} colStart={6} rowStart={5} className={styles.centerText}>
<Text fontSize="2xl" as="b">
{resultScore.Time.getMinutes()}{resultScore.Time.getSeconds()}
{Math.floor(resultScore.Time.getMilliseconds() / 100)}
{resultScore.time.getMinutes()}{resultScore.time.getSeconds()}
{Math.floor(resultScore.time.getMilliseconds() / 100)}
</Text>
</GridItem>
<GridItem colSpan={3} colStart={6} rowStart={6} className={styles.centerText}>
<Text fontSize="2xl" as="b">
{Math.floor(resultScore.WPM)}字/分
{Math.floor(resultScore.wpm)}字/分
</Text>
</GridItem>
<GridItem colSpan={3} colStart={6} rowStart={7} className={styles.centerText}>
<Text fontSize="2xl" as="b">
{resultScore.Accuracy.toFixed(1)}%
{resultScore.accuracy.toFixed(1)}%
</Text>
</GridItem>
<GridItem colSpan={4} rowSpan={2} colStart={4} rowStart={8} className={styles.centerText}>
Expand Down
23 changes: 11 additions & 12 deletions typing-app/src/components/templates/GameTyping.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import RegisterScore, { ResultScore } from "@/types/RegisterScore";
import { Box } from "@chakra-ui/react";
import axios from "axios";
import Image from "next/image";
import React, { useEffect, useState } from "react";
import ProgressBar from "../atoms/ProgressBar";
Expand Down Expand Up @@ -33,11 +32,11 @@ const GameTyping: React.FC<GameTypingProps> = ({ nextPage, filenames, setResultS
const totalSeconds = 250;
const [count, setCount] = useState(totalSeconds);
const damyScoreData = {
Keystrokes: 123,
Accuracy: 456.7,
Score: 890.1,
StartedAt: new Date(),
EndedAt: new Date(),
keystrokes: 123,
accuracy: 456.7,
score: 890.1,
startedAt: new Date(),
endedAt: new Date(),
} as RegisterScore;
const damyUserId = "damyId";

Expand Down Expand Up @@ -67,11 +66,11 @@ const GameTyping: React.FC<GameTypingProps> = ({ nextPage, filenames, setResultS
const sendResultDat = () => {
const typeTimeSeconds = totalSeconds - count;
setResultScore({
Keystrokes: correctType + incorrectType,
Miss: incorrectType,
Time: new Date(typeTimeSeconds * 1000),
WPM: (correctType / typeTimeSeconds) * 60,
Accuracy: (correctType / (correctType + incorrectType)) * 100,
keystrokes: correctType + incorrectType,
miss: incorrectType,
time: new Date(typeTimeSeconds * 1000),
wpm: (correctType / typeTimeSeconds) * 60,
accuracy: (correctType / (correctType + incorrectType)) * 100,
});
fetch(`http://localhost:8080/users/${userId}/scores`,{
method: `POST`,
Expand All @@ -83,11 +82,11 @@ const GameTyping: React.FC<GameTypingProps> = ({ nextPage, filenames, setResultS
.then((res) => res.json())
.then((data) => {
console.log(data);
nextPage();
})
.catch((error) => {
console.error(error);
});
nextPage();
};

const typingQueueListSize = 5; // ここで瞬間タイピング速度計算の粒度を決める 増やすほど変化が穏やかになる
Expand Down
20 changes: 10 additions & 10 deletions typing-app/src/types/RegisterScore.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
interface RegisterScore {
Keystrokes: number;
Accuracy: number;
Score: number;
StartedAt: Date;
EndedAt: Date;
keystrokes: number;
accuracy: number;
score: number;
startedAt: Date;
endedAt: Date;
}

export interface ResultScore {
Keystrokes: number;
Miss: number;
Time: Date;
WPM: number;
Accuracy: number;
keystrokes: number;
miss: number;
time: Date;
wpm: number;
accuracy: number;
}

export default RegisterScore;

0 comments on commit b511d19

Please sign in to comment.