Skip to content

Commit

Permalink
Merge pull request #195 from softeerbootcamp4th/fix/rush-event-date
Browse files Browse the repository at this point in the history
[Fix] 이벤트 날짜 비교 삭제
  • Loading branch information
jhj2713 authored Aug 23, 2024
2 parents 138a0ab + 33ea0d4 commit f267a42
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { GetTotalRushEventsResponse } from "@/types/rushApi.ts";
import { RUSH_ACTION } from "@/types/rushGame.ts";
import { formatTime } from "@/utils/formatTime.ts";
import { getMsTime } from "@/utils/getMsTime.ts";
import parseIsoDateTime from "@/utils/parseIsoDateTime.ts";

function TimeDisplay({ label, value }: { label: string; value: string }) {
return (
Expand Down Expand Up @@ -38,11 +37,8 @@ export default function RushCountdown() {

useEffect(() => {
if (isSuccessRush && rushData) {
const serverDate = parseIsoDateTime(rushData.serverTime);

const currentEvent = rushData.events.find((event) => {
const eventDate = parseIsoDateTime(event.startDateTime);
return eventDate === serverDate && event.rushEventId === rushData.todayEventId;
return event.rushEventId === rushData.todayEventId;
});

if (currentEvent) {
Expand Down
6 changes: 1 addition & 5 deletions client/src/features/RushGame/RushGameSections/Countdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { GetTotalRushEventsResponse } from "@/types/rushApi.ts";
import { RUSH_ACTION } from "@/types/rushGame.ts";
import { formatTime } from "@/utils/formatTime.ts";
import { getMsTime } from "@/utils/getMsTime.ts";
import parseIsoDateTime from "@/utils/parseIsoDateTime.ts";

interface CountdownTimerProps {
initialPreCountdown: number | null;
Expand Down Expand Up @@ -81,11 +80,8 @@ export default function Countdown() {

useEffect(() => {
if (isSuccessRush && rushData) {
const serverDate = parseIsoDateTime(rushData.serverTime);

const currentEvent = rushData.events.find((event) => {
const eventDate = parseIsoDateTime(event.startDateTime);
return eventDate === serverDate && event.rushEventId === rushData.todayEventId;
return event.rushEventId === rushData.todayEventId;
});

if (currentEvent) {
Expand Down
6 changes: 1 addition & 5 deletions client/src/hooks/RushGame/useSetGamePhase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,14 @@ import useRushGameDispatchContext from "@/hooks/Contexts/useRushGameDispatchCont
import { GetTotalRushEventsResponse } from "@/types/rushApi.ts";
import { RUSH_ACTION } from "@/types/rushGame.ts";
import { getMsTime } from "@/utils/getMsTime.ts";
import parseIsoDateTime from "@/utils/parseIsoDateTime.ts";

export default function useSetGamePhase(rushData: GetTotalRushEventsResponse) {
const dispatch = useRushGameDispatchContext();

useEffect(() => {
if (rushData) {
const serverDate = parseIsoDateTime(rushData.serverTime);

const currentEvent = rushData.events.find((event) => {
const eventDate = parseIsoDateTime(event.startDateTime);
return eventDate === serverDate && event.rushEventId === rushData.todayEventId;
return event.rushEventId === rushData.todayEventId;
});

if (currentEvent) {
Expand Down

0 comments on commit f267a42

Please sign in to comment.