Skip to content

Commit

Permalink
fix: vote select algorithm error
Browse files Browse the repository at this point in the history
  • Loading branch information
SeungJL committed Jun 3, 2024
1 parent a981744 commit 7f8903a
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pageTemplates/home/HomeStudySection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export default function HomeStudySection() {

if (myStudy?.status !== "dismissed") setMyStudy(myStudy);
else {
if (studyOpenCheck !== dayjsToStr(dayjs()) && dayjs().hour() > STUDY_DATE_START_HOUR) {
if (studyOpenCheck !== dayjsToStr(dayjs()) && dayjs().hour() <= STUDY_DATE_START_HOUR) {
setDismissedStudy(myStudy);
localStorage.setItem(STUDY_CHECK_POP_UP, dayjsToStr(dayjs()));
}
Expand Down
2 changes: 1 addition & 1 deletion pageTemplates/study/StudyNavigation.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Button } from "@chakra-ui/react";
import dayjs from "dayjs";
import { useSession } from "next-auth/react";
import { useParams, useSearchParams } from "next/navigation";
import { useSession } from "next-auth/react";
import { useEffect, useState } from "react";
import { useQueryClient } from "react-query";
import { useRecoilValue } from "recoil";
Expand Down
2 changes: 1 addition & 1 deletion pageTemplates/vote/VoteDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ function VoteDrawer({ studyVoteData, myVote, setMyVote, setActionType }: VoteDra
useEffect(() => {
if (!myVote?.place) {
const items = getSortedMainPlace(studyVoteData, savedPrefer);
console.log(4, items);
setPlaceItems(items);
return;
}

const placeId = myVote.place._id;
const subPlaceIds = new Set(myVote.subPlace?.map((obj) => obj._id));

Expand Down
1 change: 1 addition & 0 deletions pageTemplates/vote/voteDrawer/VoteDrawerItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ function VoteDrawerItem({

//장소 선택
const onClickItem = (item: ItemProps) => {

//메인 장소 선택
if (!myVote?.place) setMyVote({ place: item.place, subPlace: [], start: null, end: null });
//서브 장소 선택
Expand Down
1 change: 1 addition & 0 deletions pageTemplates/vote/voteDrawer/VoteDrawerQuickVoteItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ interface VoteDrawerQuickVoteItemProps {
function VoteDrawerQuickVoteItem({ savedPreferPlace, setMyVote }: VoteDrawerQuickVoteItemProps) {
const toast = useToast();
const favoritesCnt = (savedPreferPlace?.place ? 1 : 0) + savedPreferPlace?.subPlace?.length || 0;

return (
<Flex
py="8px"
Expand Down
2 changes: 1 addition & 1 deletion pages/vote.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default function StudyVoteMap() {

//메인 스터디 장소가 선택되면 3km 거리 이하의 장소들이 2지망으로 자동 선택
useEffect(() => {
if (!studyVoteData || !myVote?.place) return;
if (!studyVoteData || !myVote?.place || myVote?.subPlace) return;
const subPlace = [];

studyVoteData?.forEach((item) => {
Expand Down

0 comments on commit 7f8903a

Please sign in to comment.