Skip to content

Commit

Permalink
Merge pull request #285 from MOONSHOT-Team/feature/#284
Browse files Browse the repository at this point in the history
[Fix] #284 - 소셜 API 버그 수정
  • Loading branch information
0lynny authored Jun 1, 2024
2 parents 5db61dd + 4c3b22d commit 363f17a
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@
import java.util.List;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.hibernate.Hibernate;
import org.moonshot.keyresult.model.QKeyResult;
import org.moonshot.objective.model.Category;
import org.moonshot.objective.model.Criteria;
import org.moonshot.objective.model.Objective;
import org.moonshot.task.model.QTask;
import org.moonshot.user.model.QUser;

@Slf4j
@RequiredArgsConstructor
Expand Down Expand Up @@ -70,10 +74,10 @@ private OrderSpecifier<?> order(Criteria criteria) {
public List<Objective> findSocialObjectives() {
return queryFactory.selectFrom(objective).distinct()
.join(objective.user).fetchJoin()
.join(objective.keyResultList, keyResult).fetchJoin()
.join(keyResult.taskList, task)
.leftJoin(objective.keyResultList, keyResult).fetchJoin()
.leftJoin(keyResult.taskList, task)
.where(objective.isPublic.eq(true))
.orderBy(objective.heartCount.desc(), objective.id.desc())
.orderBy(objective.heartCount.desc(), objective.id.desc(), keyResult.idx.asc(), task.id.asc())
.limit(10)
.fetch();
}
Expand Down

0 comments on commit 363f17a

Please sign in to comment.