Skip to content

Commit

Permalink
feat: track 속성 옵셔널 체이닝
Browse files Browse the repository at this point in the history
  • Loading branch information
cjy3458 committed May 5, 2024
1 parent 827e484 commit d0d8a7b
Show file tree
Hide file tree
Showing 3 changed files with 169 additions and 174 deletions.
3 changes: 0 additions & 3 deletions src/components/mypage/MyScoreSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ const MyScoreSection = ({ userProfile }: { userProfile: UserProfile }) => {
);

useEffect(() => {
console.log('과제 데이터:', userAssignment);
if (userAttendance && userAssignment) {
console.log(userAttendance);
console.log(userAssignment);
const score = getTotalScore({
absence: userAttendance.absence,
truancy: userAttendance.truancy,
Expand Down
4 changes: 2 additions & 2 deletions src/components/mypage/TotalScoreSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const TotalScoreSection = ({ myName }: { myName: string }) => {
totalAttendance.forEach((userAttendance: UserAttendance, i: number) => {
const target = tmpObject[userAttendance.name];

if (target.track === userAttendance.track) {
if (target?.track === userAttendance?.track) {
target.user_id = userAttendance.user_id;
target.tardiness = userAttendance.tardiness;
target.truancy = userAttendance.truancy;
Expand Down Expand Up @@ -76,7 +76,7 @@ const TotalScoreSection = ({ myName }: { myName: string }) => {
{userScore.name}
<EditButton onClick={() => handleScoreEditModal(userScore)} />
</Score>
<Score>{TRACK_NAME[userScore.track]}</Score>
<Score>{TRACK_NAME[userScore?.track]}</Score>
<Score>{userScore.absence}</Score>
<Score>{userScore.truancy}</Score>
<Score>{userScore.tardiness}</Score>
Expand Down
Loading

0 comments on commit d0d8a7b

Please sign in to comment.