Skip to content

Commit

Permalink
feat: temp deploy version
Browse files Browse the repository at this point in the history
  • Loading branch information
ohksj77 committed Oct 21, 2024
1 parent ce20d83 commit c55ae6c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,6 @@ public class Member implements Auditable {
@Formula("(SELECT COALESCE(sum(cr.amount), 0) FROM code_review cr WHERE cr.member_id = id)")
private Integer sumOfCodeReviews;

@Formula(
"(SELECT COALESCE(sum(h.amount), 0) FROM member m left join blockchain b on b.member_id = m.id left join history h on h.blockchain_id = b.id where m.id = id)")
private Long sumOfTokens;

@Builder
public Member(
final String name,
Expand All @@ -141,6 +137,11 @@ public Member(
addRoleIfAdmin(role);
}

public Long getSumOfTokens() {
return Integer.valueOf(sumOfCommits + sumOfIssues + sumOfPullRequests + sumOfCodeReviews)
.longValue();
}

private void addRoleIfAdmin(final Role role) {
if (role != null && role.equals(Role.ROLE_ADMIN)) {
this.role.add(role);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package com.dragonguard.backend.domain.member.repository;

import static com.dragonguard.backend.domain.member.entity.QMember.member;

import com.dragonguard.backend.domain.member.dto.response.QMemberRankResponse;

import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

import static com.dragonguard.backend.domain.member.entity.QMember.member;

/**
* @author ๊น€์Šน์ง„
* @description ๋ฉค๋ฒ„ ํ”„๋กœ์ ์…˜ ์ ์šฉ์„ ์œ„ํ•œ ํด๋ž˜์Šค
Expand All @@ -19,7 +20,11 @@ public QMemberRankResponse qMemberRankResponse() {
member.id,
member.name,
member.githubId,
member.sumOfTokens,
member.sumOfCommits
.add(member.sumOfCodeReviews)
.add(member.sumOfIssues)
.add(member.sumOfPullRequests)
.longValue(),
member.tier,
member.profileImage);
}
Expand Down

0 comments on commit c55ae6c

Please sign in to comment.