Skip to content
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

[FIX] 브리핑 보드 알람 타임라인 정렬 에러 해결 #168

Merged
merged 6 commits into from
Sep 18, 2024

Conversation

05AM
Copy link
Member

@05AM 05AM commented Sep 12, 2024

☀️ 작업 사항

저번 알람 타임라인 중복 에러를 해결할 때 중복으로 보이는 것을 막기 위해 보여지는 알람 시간을 미션을 수행한 시간으로 수정했습니다.
하지만 여전히 정렬이 alarm time 기준으로 되어 있어 타임라인의 순서가 섞이는 에러가 있었습니다.

따라서 현재 시간 이전의 타임라인에 대해서는 미션 수행 시간으로 정렬하여 해당 에러를 해결했습니다.

또한 프레임워크 숙련도 이슈로 mission object 테이블이 cross join되고 있는 것을 발견했습니다.
부모 엔티티에서 필드를 가져오는 것과 조인한 결과에서 가져오는 두 가지 방식을 혼용하고 있었기 때문에 cross join이 발생했습니다.

명시적으로 조인한 결과에서 가져오는 방식으로 통일하여 같은 테이블이지만 다른 2개의 테이블을 cross join하는 것을 방지했습니다.

☀️ 참고 사항

[이전 쿼리]

    select
        alarm0_.id as col_0_0_,
        missionobj2_.icon as col_1_0_,
        alarm0_.alarm_time as col_2_0_,
        alarm0_.name as col_3_0_,
        missionobj1_.kr as col_4_0_,
        alarm0_.room_id as col_5_0_ 
    from
        alarm alarm0_ 
    inner join
        mission_object missionobj1_ 
            on (
                alarm0_.mission_object_id=missionobj1_.id
            ) cross 
    join
        mission_object missionobj2_ 
    where
        (
            alarm0_.is_deleted = 0
        ) 
        and alarm0_.mission_object_id=missionobj2_.id 
        and alarm0_.user_id=? 
        and (
            alarm0_.thursday=? 
            or alarm0_.monday=? 
            and alarm0_.tuesday=? 
            and alarm0_.wednesday=? 
            and alarm0_.thursday=? 
            and alarm0_.friday=? 
            and alarm0_.saturday=? 
            and alarm0_.sunday=?
        ) 
        and alarm0_.is_activated=? 
        and alarm0_.is_deleted=? 
        and alarm0_.alarm_time>=? 
    order by
        alarm0_.alarm_time asc,
        alarm0_.id asc

[이후 쿼리]

    select
        alarm0_.id as col_0_0_,
        missionobj1_.icon as col_1_0_,
        alarm0_.alarm_time as col_2_0_,
        alarm0_.name as col_3_0_,
        missionobj1_.kr as col_4_0_,
        alarm0_.room_id as col_5_0_ 
    from
        alarm alarm0_ 
    inner join
        mission_object missionobj1_ 
            on alarm0_.mission_object_id=missionobj1_.id 
    where
        (
            alarm0_.is_deleted = 0
        ) 
        and alarm0_.user_id=? 
        and alarm0_.is_deleted=? 
        and alarm0_.is_activated=? 
        and alarm0_.alarm_time>=? 
        and (
            alarm0_.thursday=? 
            or alarm0_.monday=? 
            and alarm0_.tuesday=? 
            and alarm0_.wednesday=? 
            and alarm0_.thursday=? 
            and alarm0_.friday=? 
            and alarm0_.saturday=? 
            and alarm0_.sunday=?
        ) 
    order by
        alarm0_.alarm_time asc,
        alarm0_.id asc

@05AM 05AM added BUG Something isn't working FIX 수정 labels Sep 12, 2024
@05AM 05AM requested a review from hye-on September 12, 2024 07:08
@05AM 05AM self-assigned this Sep 12, 2024
hye-on
hye-on previously approved these changes Sep 14, 2024
Copy link
Contributor

@hye-on hye-on left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저도 cross join되고 있는지 찾아봐야겠네요!
고생하셨습니다 👍

@05AM
Copy link
Member Author

05AM commented Sep 15, 2024

@hye-on

알람 목록 불러오기 서비스 메서드에 대한 리팩터링을 진행하였습니다! 한번 더 확인 요청드립니다!

Copy link
Contributor

@hye-on hye-on left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

리팩터링 확인했습니다 고생하셨습니다! 👍

@05AM 05AM merged commit 73a08b6 into main Sep 18, 2024
1 check passed
hye-on pushed a commit that referenced this pull request Sep 18, 2024
* [FIX] 쿼리 조건 간단화 및 cross join 방지

* [FIX] cross join 방지 및 미션 기록 생성일자로 정렬 순서 변경

* #133 [refactor, feat] 개인/그룹 알람 목록 가져오기 쿼리를 동적으로 생성 및 활성화 알람을 상단으로 표시하기

* #133 [feat] 알람 목록 쿼리 조건 메서드 분리 및 alarm type 에러 처리 세분화

* #133 [refactor] 필요없는 주석 제거

* #133 [FIX] 알람 활성화 여부에 따른 정렬 삭제
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BUG Something isn't working FIX 수정
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants