Files
hackerthon-vote/README.md
th-kim0823 067e25116a feat: admin URL 쉽게 접근 - show-urls.sh + admin 내부 링크
- show-urls.sh: localhost + LAN IP 포함 모든 URL 출력 (참가자/어드민/시상식)
- admin 페이지에 다른 페이지 URL expander 추가 (ceremony 링크 클릭 가능)
- README에 사용법 추가

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 18:35:15 +09:00

98 lines
2.9 KiB
Markdown

# 해커톤 투표
35명 (34명 참가 + 1명 진행요원) / 7팀 / 3분야 (재미·완성도·실용성) 투표 앱.
**DB 없이 단일 JSON 파일** (`hackathon.json`)에 모든 데이터.
## 흐름
1. `assign_teams.py` 실행 → `hackathon.json` 생성 (people 배정)
2. `app.py` 실행 → 본인 이름 + 사번 입력 → 다른 6팀에 3분야 투표
3. 어드민에서 마감 → 시상식 reveal
4. 결과 자동 archive (`results_<ts>.json`)
## 실행 — Docker
```bash
# 1. 팀 배정 (호스트에서 1회)
python3 assign_teams.py
# 2. .env (1회)
cp .env.example .env
# ADMIN_TOKEN을 강한 토큰으로 변경
# 빠르게: python3 -c "import secrets; print(secrets.token_urlsafe(16))"
# 3. 컨테이너
docker compose up -d --build
# 종료
docker compose down
```
## URL
```bash
./show-urls.sh # localhost + LAN IP 포함 모든 URL 출력
```
- 투표: `http://<서버>:8501/`
- 어드민: `http://<서버>:8501/?mode=admin&token=<TOKEN>`
- 시상식: `http://<서버>:8501/?mode=ceremony&token=<TOKEN>`
macOS 빠른 열기:
```bash
TOKEN=$(grep ADMIN_TOKEN .env | cut -d= -f2)
open "http://localhost:8501/?mode=admin&token=${TOKEN}"
```
## 데이터 파일 — `hackathon.json`
```json
{
"people": [
{"name": "홍길동", "team": "팀1", "dept": "MLOps Data", "senior": true, "notes": ""},
...
],
"settings": {"voting_open": true},
"titles": {"팀1": "Slack 자동 분류기"},
"tie_breaks": {
"utility_team": {"winner_team": "팀1", "method": "random", "decided_at": "..."}
},
"votes": [
{"voter_name": "...", "employee_id": "...", "voter_team": "...", "fun_team": "...",
"polish_team": "...", "utility_team": "...", "created_at": "..."}
]
}
```
- 호스트에서 직접 편집 가능 (jq, vi 등). 앱이 매 요청 reload — 핫리로드.
- 단일 파일 read-write mount. atomic write (tmp + rename).
- 행사 전 명단 변경: `people[*].team` 값만 바꾸면 즉시 반영.
- `assign_teams.py` 재실행 시 `people`만 갱신. votes/titles/tie_breaks 보존.
## 운영 흐름
1. 투표 시작 (기본 open)
2. 모두 투표 → 어드민 "🛑 투표 마감"
3. 동률 있으면 어드민에서 추첨/선택
4. "팀별 결과물 제목" 입력 (또는 발표 직후)
5. ceremony URL 띄움 → 시상 진행
## 테스트
```bash
docker cp tests/e2e.py hackathon-vote:/tmp/e2e.py
docker exec hackathon-vote python3 /tmp/e2e.py
```
12개 시나리오 검증 (로드, 마감 토글, winner, priority, 동률, 추첨, UNIQUE, 제목, archive, atomic, clear).
## 시상 매핑
| 상 | 상품 | 평가 |
|---|---|---|
| 🛠 실용성상 | 팜레스트 5개 (최고가) | 실제 쓸 만함 |
| 🏆 완성도상 | 양우산 5개 | 동작 / 시연 안정성 |
| 🎉 재미상 | 손선풍기 5개 | 발표장 임팩트 |
수상 우선순위: 실용성 > 완성도 > 재미. 발표 순서: 재미 → 완성도 → 실용성 (긴장감).