feat: 35명 7팀 배정 + 이름 기반 자동 팀 매핑

- assign_teams.py: 부서 다양성 제약(같은 부서 ≤2명) 시드 고정 배정
- participants.json: 이름→팀 매핑 산출물
- app.py: 이름 선택 → 본인 팀 자동 표시 (수동 입력 부정 차단)
- 어드민 참여율 메트릭 + 미투표자 목록

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
th-kim0823
2026-04-25 19:02:27 +09:00
parent 5fe8842e88
commit e661372f84
4 changed files with 215 additions and 34 deletions

View File

@@ -2,18 +2,28 @@
35명 / 7팀 / 3분야 (재미·완성도·실용성) 투표 앱. 본인 팀 제외 투표.
## 흐름
1. `assign_teams.py` 실행 → `participants.json` 생성 (이름→팀 매핑)
2. `app.py` 실행 → 참가자가 본인 이름 선택 → 자동 본인 팀 매핑 → 다른 6팀에 3분야 투표
3. 어드민 페이지에서 분야별 1위와 2위 차이만 공개 (하위 표수는 expander 내부)
## 실행
```bash
# 1. 의존성 설치
pip install -r requirements.txt
# 2. 환경변수 (선택)
export TEAMS="팀1,팀2,팀3,팀4,팀5,팀6,팀7" # 콤마 구분
export ADMIN_TOKEN="강한-토큰-아무거나"
export VOTE_DB="votes.db" # sqlite 파일 경로
# 2. 팀 배정 (시드 고정 = 재현 가능)
python3 assign_teams.py
# → participants.json 저장됨
# 3. 실행 (홈서버, 외부 접속 허용)
# 3. 환경변수 (선택)
export ADMIN_TOKEN="강한-토큰-아무거나"
export VOTE_DB="votes.db"
export PARTICIPANTS="participants.json"
# 4. 홈서버 실행 (외부 접속 허용)
streamlit run app.py --server.address 0.0.0.0 --server.port 8501
```
@@ -31,7 +41,8 @@ streamlit run app.py --server.address 0.0.0.0 --server.port 8501
## 데이터
`votes.db` (sqlite). 테이블: `votes(id, voter_name UNIQUE, voter_team, fun_team, polish_team, utility_team, created_at)`.
- `participants.json` — 이름→팀 매핑 (`assign_teams.py` 산출물)
- `votes.db` (sqlite) — 테이블: `votes(id, voter_name UNIQUE, voter_team, fun_team, polish_team, utility_team, created_at)`
## 운영 팁