-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug/#394] CSV 버그 수정 #395
[Bug/#394] CSV 버그 수정 #395
Conversation
PR 작성하느라 고생 많았어요!! 라벨 잘 지정되었는지 확인 한 번 해 주기 🫶 |
Quality Gate passedIssues Measures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
어푸푸합니당! 버그 수정 쏘이지하게 하셨네용 대단해용
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생했어! 코멘트 확인해줘 ~~~!!!!
const tempCSVDataArr: CSVDataType[] = []; | ||
|
||
data.bookingList.map((item) => { | ||
const date = item.createdAt.split("T")[0]; | ||
const time = item.createdAt.split("T")[1].slice(0, 5); | ||
const formattedDate = date?.replace(/-/g, "."); | ||
const formattedCreateTime = `${formattedDate} ${time}`; | ||
|
||
CSVDataArr.push({ | ||
tempCSVDataArr.push({ | ||
createdAt: formattedCreateTime, | ||
scheduleNumber: `${convertingNumber(item.scheduleNumber)}회차`, | ||
bookerName: item.bookerName, | ||
purchaseTicketCount: `${item.purchaseTicketCount}매`, | ||
bookerPhoneNumber: item.bookerPhoneNumber, | ||
bookingStatus: convertingBookingStatus(item.bookingStatus), | ||
}); | ||
|
||
setCSVDataArr(tempCSVDataArr); | ||
}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
p1
지금 코드 보면 tempCSVDataArr에 데이터를 추가하고, 반복문 안에서 계속 불필요하게 setCSVDataArr를 호출하고 있어!
tempCSVDataArr에 데이터를 모두 넣고, 반복문이 끝난 후에 한 번만 호출해도 될 것 같아!
이렇게 상태를 한 번에 업데이트하면 불필요한 상태 변경이 없어도 되서 무결성도 유지하면서, 성능도 더 괜찮을 것 같아!
아래 코드를 실행시켜 본 건 아닌데! 이런 식으로 하면 좋을 듯!
const tempCSVDataArr: CSVDataType[] = data.bookingList.map((item) => {
const date = item.createdAt.split("T")[0];
const time = item.createdAt.split("T")[1].slice(0, 5);
const formattedDate = date?.replace(/-/g, ".");
const formattedCreateTime = `${formattedDate} ${time}`;
return {
createdAt: formattedCreateTime,
scheduleNumber: `${convertingNumber(item.scheduleNumber)}회차`,
bookerName: item.bookerName,
purchaseTicketCount: `${item.purchaseTicketCount}매`,
bookerPhoneNumber: item.bookerPhoneNumber,
bookingStatus: convertingBookingStatus(item.bookingStatus),
};
});
setCSVDataArr(tempCSVDataArr);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
와웅........ 좋은 방법인 것 같아요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오 코드를 졸면서 짰나.. 좋은 지적 고마워 !!
바로 반영할게 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
크게 문제 없어보여서 어푸하꼐요!!!!!!! 빠른 버그 수정 굿
const tempCSVDataArr: CSVDataType[] = []; | ||
|
||
data.bookingList.map((item) => { | ||
const date = item.createdAt.split("T")[0]; | ||
const time = item.createdAt.split("T")[1].slice(0, 5); | ||
const formattedDate = date?.replace(/-/g, "."); | ||
const formattedCreateTime = `${formattedDate} ${time}`; | ||
|
||
CSVDataArr.push({ | ||
tempCSVDataArr.push({ | ||
createdAt: formattedCreateTime, | ||
scheduleNumber: `${convertingNumber(item.scheduleNumber)}회차`, | ||
bookerName: item.bookerName, | ||
purchaseTicketCount: `${item.purchaseTicketCount}매`, | ||
bookerPhoneNumber: item.bookerPhoneNumber, | ||
bookingStatus: convertingBookingStatus(item.bookingStatus), | ||
}); | ||
|
||
setCSVDataArr(tempCSVDataArr); | ||
}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
와웅........ 좋은 방법인 것 같아요
📌 관련 이슈번호
🎟️ PR 유형
어떤 변경 사항이 있나요?
✅ Key Changes
📢 To Reviewers
📸 스크린샷
수정 전
수정 후
🔗 참고 자료