Skip to content

Conversation

@HanNayeoniee
Copy link
Collaborator

@HanNayeoniee HanNayeoniee commented Dec 18, 2025

📝 PR 타입

  • 버그 수정 (fix)
  • 신규 기능 (feat)
  • 문서 업데이트 (docs)
  • 코드 스타일 / 포맷팅 (style)
  • 리팩토링 (refactor)
  • 테스트 (test)
  • 기타 (chore, ci 등)

📜 설명

엮인 이슈

  • Closes #

🔨 작업 내용

  • user_challenge_status 스키마 변경하면서 발생하던 오류 해결
  • 문제 assign 시 문제 제출자(user_id)만 반환하고, 문제 푸는 사람은 삭제해 리턴 수정
  • 정답 판별 로직 수정: 공백을 기준으로 정답 중 가장 긴 단어가 사용자가 제출한 답에 포함되어 있으면 true
answer_keyword = max(question.answer.lower().split(), key=len)
submitted = submitted_answer.strip().lower()
is_correct = answer_keyword in submitted
  • 문제 할당 로직 간단하게 수정
    팀 멤버가 [2, 3, 4, 5]로 구성되었을 때 본인(2)이 만든 문제 제외하고 [3, 4, 5]가 만든 문제 중 랜덤하게 1개를 할당받도록 수정했습니다.
# 팀원들이 만든 문제 조회
team_questions = db.query(ChallengeQuestion).filter(ChallengeQuestion.user_id.in_(members)).all()
if not team_questions:
    raise ValueError("배정할 문제가 없습니다.")

# 셔플 후 1개 선택
selected_question = random.choice(team_questions)

📸 스크린샷


🧑‍💻 테스트 결과


📅 체크리스트

  • 이해하기 어려운 부분에 주석을 추가했습니다.
  • 관련된 문서를 업데이트했습니다.

available_ids = members.copy()
random.shuffle(available_ids)

members = list(set(members))
Copy link
Collaborator

@daclouds daclouds Dec 19, 2025

Choose a reason for hiding this comment

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

중복이 있는 상태에서 set 에 넣어 중복을 제거하는 것 보단 중복을 만들지 않는 게 어떨까요? 😉 #267

Copy link
Collaborator Author

@HanNayeoniee HanNayeoniee Dec 29, 2025

Choose a reason for hiding this comment

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

본인 id는 제외하고 멤버 id만 받도록 수정해주셔서 중복이 발생하지 않게 되었습니다!

Copy link
Collaborator

Choose a reason for hiding this comment

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

본인 id는 제외하고 멤버 id만 받도록 수정해주셔서 중복이 발생하지 않게 되었습니다!

이게 어디는 members 에 본인 id 포함이고 어디는 포함 안되어 있어서 통일되면 좋을 것 같습니다. 🙄

Comment on lines 40 to 48
for user_id in members:
possible_ids = [uid for uid in available_ids if uid != user_id]
if not possible_ids:
raise ValueError(f"{user_id}에게 할당할 문제 부족")

assigned_user_id = random.choice(possible_ids)
assigned_question = random.choice([q for q in team_questions if q.user_id == assigned_user_id])

available_ids.remove(assigned_user_id)
Copy link
Collaborator

Choose a reason for hiding this comment

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

이거 에러날 수도 있겠는데요?
members = [2, 3, 4, 5]
available_ids = [3, 2, 5, 4]

user_id = 2
possible_ids = [3, 5, 4]
assigned_user_id = 3
available_ids = [2, 5, 4]

user_id = 3
possible_ids = [2, 5, 4]
assigned_user_id = 4
available_ids = [2, 5]

user_id = 4
possible_ids = [2, 5]
assigned_user_id = 2
available_ids = [5]

user_id = 5
possible_ids = []

이렇게 되면 ValueError(f"{user_id}에게 할당할 문제 부족")가 나올 것 같아요

Copy link
Collaborator

@daclouds daclouds Dec 22, 2025

Choose a reason for hiding this comment

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

유저는 중복 허용하고 문제만 중복되지 않게 하는 건 어떨까요? 👀
category 가 3개라면 len(mebmers) * category 가 되어서 문제는 충분 할 것 같거든요.

2번 유저의 문제를 푸는 사람이 4, 5 일 수 있게?!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

팀 멤버가 [2, 3, 4, 5]로 구성되었을 때 본인(2)이 만든 문제 제외하고 [3, 4, 5]가 만든 문제 중 랜덤하게 1개를 할당받도록 수정했습니다.

@daclouds daclouds marked this pull request as draft December 27, 2025 02:57
@HanNayeoniee HanNayeoniee marked this pull request as ready for review December 29, 2025 14:17
@HanNayeoniee HanNayeoniee changed the title [WIP] UserChallengeStatus 오류 수정 UserChallengeStatus 오류 수정 Dec 29, 2025
@daclouds
Copy link
Collaborator

daclouds commented Dec 29, 2025

commit messages 형식이 Commit Convention 과 맞지 않는 것 같아요.
https://github.com/Pseudo-Lab/DevFactory/blob/main/CONTRIBUTING.md

<type>(<scope>): <short summary>

@daclouds
Copy link
Collaborator

main 을 merge 하지 말고 rebase 하는 건 어떨까요? 👀

@daclouds daclouds removed the changes-requested 수정 요청 label Dec 30, 2025
@HanNayeoniee
Copy link
Collaborator Author

main 을 merge 하지 말고 rebase 하는 건 어떨까요? 👀

main merge한 커밋 위에 개발 코드 수정사항을 커밋해서... 이번엔 그대로 진행해도 괜찮을까요?

@HanNayeoniee HanNayeoniee merged commit 7a08f67 into main Jan 4, 2026
@github-actions github-actions bot added merged and removed approved labels Jan 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants