Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,4 @@ out/
.DS_Store
**/.DS_Store
/keys/
/docs/
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import KUSITMS.WITHUS.domain.evaluation.evaluationCriteria.enumerate.EvaluationType;
import KUSITMS.WITHUS.domain.interview.interviewQuestion.dto.InterviewQuestionResponseDTO;
import KUSITMS.WITHUS.domain.interview.timeslot.entity.TimeSlot;
import KUSITMS.WITHUS.domain.organization.organizationRole.entity.OrganizationRole;
import KUSITMS.WITHUS.domain.recruitment.availableTimeRange.entity.AvailableTimeRange;
import KUSITMS.WITHUS.domain.recruitment.recruitment.entity.Recruitment;
import KUSITMS.WITHUS.domain.user.user.dto.UserResponseDTO;
Expand Down Expand Up @@ -289,17 +290,20 @@ public record SummaryForUser(
) {
public static SummaryForUser from(Application application, Long currentUserId) {
Recruitment recruitment = application.getRecruitment();
OrganizationRole appRole = application.getOrganizationRole();

int documentCriteriaCount = (int) recruitment
.getEvaluationCriteriaList()
.stream()
.filter(c -> c.getEvaluationType() == EvaluationType.DOCUMENT)
.filter(c -> matchesOrganizationRole(c, appRole))
.count();
int documentMaxScore = documentCriteriaCount * 10;

List<Evaluation> userDocsEvaluations = application.getEvaluations().stream()
.filter(e -> e.getUser().getId().equals(currentUserId))
.filter(e -> e.getCriteria().getEvaluationType() == EvaluationType.DOCUMENT)
.filter(e -> matchesOrganizationRole(e.getCriteria(), appRole))
.toList();
Comment on lines +293 to 307
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Find Application.java file
APP_FILES=$(find . -type f -name "Application.java" 2>/dev/null | grep -E 'domain|entity' | head -5)

if [ -z "$APP_FILES" ]; then
  echo "Searching for Application.java more broadly..."
  APP_FILES=$(find . -type f -name "Application.java" 2>/dev/null | head -5)
fi

if [ -z "$APP_FILES" ]; then
  echo "Application.java not found"
  exit 0
fi

echo "$APP_FILES" | while read -r f; do
  echo "=== Found: $f ==="
  # Show file size to determine read strategy
  wc -l "$f"
done

Repository: WITHUS-K/WITHUS-BE

Length of output: 252


🏁 Script executed:

#!/bin/bash
# Once we know the file, let's examine the organizationRole field definition
find . -type f -name "Application.java" 2>/dev/null | grep -E 'domain|entity' | head -1 | xargs -I {} bash -c 'cat -n {} | grep -A 10 -B 2 "organizationRole"'

Repository: WITHUS-K/WITHUS-BE

Length of output: 2429


🏁 Script executed:

#!/bin/bash
# Search for `@NotNull`, `@NonNull`, or other nullability annotations on organizationRole
rg -n '@(NotNull|NonNull|Nullable|Column|JoinColumn).*organizationRole|organizationRole.*@(NotNull|NonNull|Nullable)' -A 2 -B 2 src/main/java

Repository: WITHUS-K/WITHUS-BE

Length of output: 44


🏁 Script executed:

#!/bin/bash
# Check matchesOrganizationRole method implementation
rg -n 'matchesOrganizationRole' -A 10 src/main/java

Repository: WITHUS-K/WITHUS-BE

Length of output: 4146


organizationRole이 null일 때 역할 기반 기준이 완전히 제외되는 문제 확인됨.

Application.organizationRole 필드에는 @NotNull 또는 @NonNull 제약이 없어 null이 될 수 있습니다. matchesOrganizationRole() 메서드를 보면 appRole == null일 때 false를 반환하므로, 역할이 지정된 모든 기준이 필터링되어 documentCriteriaCount가 0이 될 수 있습니다. 이는 documentMaxScore와 평가 완료 여부 판단 로직에 직접 영향을 미칩니다. 다음 중 하나를 고려해주세요:

  • organizationRole 필드에 @NotNull 제약 추가
  • appRole이 null일 때 필터 로직 조정
  • null 상황에 대한 명시적 처리 추가
🤖 Prompt for AI Agents
In
`@src/main/java/KUSITMS/WITHUS/domain/application/application/dto/ApplicationResponseDTO.java`
around lines 293 - 307, application.getOrganizationRole() may be null which
causes matchesOrganizationRole(...) to exclude all role-scoped criteria; update
the filtering to treat a null appRole as "no role filter" so role-scoped
criteria are not accidentally dropped: when computing documentCriteriaCount and
when building userDocsEvaluations, change the role checks to short-circuit
accept when appRole == null (e.g. replace filter(... matchesOrganizationRole(c,
appRole)) with a condition like appRole == null ||
matchesOrganizationRole(...)), ensuring documentMaxScore and evaluation filters
use this adjusted logic; reference Application.getOrganizationRole(), appRole,
matchesOrganizationRole(...), documentCriteriaCount, userDocsEvaluations, and
documentMaxScore.


boolean evaluated = !(documentCriteriaCount > userDocsEvaluations.size() || userDocsEvaluations.isEmpty());
Expand Down Expand Up @@ -336,6 +340,17 @@ public static SummaryForUser from(Application application, Long currentUserId) {
interviewSchedule
);
}

private static boolean matchesOrganizationRole(EvaluationCriteria criteria, OrganizationRole appRole) {
OrganizationRole criteriaRole = criteria.getOrganizationRole();
if (criteriaRole == null) {
return true;
}
if (appRole == null) {
return false;
}
return criteriaRole.getId().equals(appRole.getId());
}
}

@Schema(description = "단계별 count 포함 관리자용 지원서 리스트 요약 응답 DTO")
Expand Down
Loading