[level] 레벨을 0부터 시작 (currentLevel=완료 미션 수)#271
Conversation
- UserLevel 기본값 0, 프로필 기본 레벨 0 - 현재 미션 = findByLevel(currentLevel+1), 미션 정의(Lv.1~10)는 유지 - awardNextLevel: 다음 미션레벨=currentLevel+1, Lv.10 완료 시 종료 - 운영 통계 레벨 분포 0~10, 행 없는 유저=Lv.0 - V43: 기존 user_levels 1-base→0-base 보정 + 기본값 0 - 배지/스트릭은 변경 없음 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 233a1887c3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| -- 기존 1-base(시작=1) 데이터를 0-base로 한 칸 내리고, 기본값을 0으로 변경한다. | ||
| ALTER TABLE user_levels MODIFY current_level INT NOT NULL DEFAULT 0; | ||
|
|
||
| UPDATE user_levels SET current_level = current_level - 1 WHERE current_level > 0; |
There was a problem hiding this comment.
Preserve users who already completed Lv10
For production data where a user has already completed the level-10 mission, the old code left user_levels.current_level at 10 because awardNextLevel() returned when currentLevel >= 10; this migration unconditionally rewrites that row to 9. Since the new meaning is “completed mission count,” those maxed-out users should remain at 10, otherwise profiles/admin stats permanently demote them until some separate repair runs. Consider special-casing rows with a completed user_missions entry joined to missions.level = 10 before applying the blanket - 1 conversion.
Useful? React with 👍 / 👎.
변경
"신규 유저 = Lv.0, 미션 깨면 +1" 모델로 전환.
currentLevel= 완료한 미션 수(0~10).UserLevel기본값 0, 프로필 기본 레벨 0findByLevel(currentLevel + 1)— 미션 정의(Lv.1~Lv.10 시드)는 그대로current_level - 1) + 컬럼 기본값 0의존
/home에 mission을 포함하므로 이 PR과 함께/이후 머지 시 0-base 레벨이 일관되게 노출됨.🤖 Generated with Claude Code