No description
- Python 53.6%
- HTML 40.7%
- JavaScript 5.4%
- Mako 0.2%
- Dockerfile 0.1%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
Team page roster now shows computed rolling averages (math.ceil) instead of raw starting_avg, matching what player detail pages display. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> |
||
| .claude | ||
| anti-slop | ||
| docs | ||
| migrations | ||
| static | ||
| templates | ||
| .dockerignore | ||
| .env.example | ||
| .gitignore | ||
| admin_roster.py | ||
| admin_scores.py | ||
| admin_season.py | ||
| admin_users.py | ||
| app.py | ||
| auth.py | ||
| backup.py | ||
| CLAUDE.md | ||
| docker-compose.yml | ||
| docker-entrypoint.sh | ||
| Dockerfile | ||
| export_to_json.gs | ||
| helpers.py | ||
| import_2025.py | ||
| import_from_sheets.py | ||
| models.py | ||
| README.md | ||
| requirements.txt | ||
| seed_data.py | ||
| views.py | ||
Dart League
A web app for managing a recreational dart league: seasons, teams, rosters, weekly match scores, standings, and player statistics.
Features
Scheduling and scoring
- Round-robin schedule generator with multi-week tiling and bye-week display
- Per-game score entry with absent handling and handicaps
- OCR score scanning: photograph a paper score sheet, fill the form via Anthropic Claude Sonnet or Google Gemini Flash
- Match completion flag: incomplete matches are excluded from standings and stats
- Absence adjustment: percentage of average or fixed deduction, per season
- Per-game score overrides
- Board number tracking
Standings and stats
- Standings with half-season tabs (1st half / 2nd half / overall)
- Player averages, high games, and handicaps
- Team average trend chart on the team detail page
- Print view with QR code
Roster and data
- Mid-season player moves with score reassignment
- Player merge with undo
- Season player pool and bulk CSV upload (players, scores, matches)
- Season import/export (
dart-league-v1JSON format)
Platform
- Google OAuth login with role-based access
- PWA support (Add to Home Screen)
- Mobile-first responsive UI with dark mode
Tech Stack
- Backend: Flask, SQLAlchemy, Flask-Migrate (Alembic), Flask-Login
- Auth: Google OAuth via Authlib
- Frontend: Jinja2, Tailwind CSS (CDN), HTMX
- Database: SQLite (default), PostgreSQL, or MariaDB/MySQL via
DATABASE_URL
Quick Start
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
cp .env.example .env
# Edit .env: set SECRET_KEY and Google OAuth credentials
python app.py
App runs at http://localhost:5555. Run flask db upgrade first if the database is new.
Docker
cp .env.example .env # edit SECRET_KEY and Google OAuth credentials
docker compose up -d
| Profile | Command | Stack |
|---|---|---|
| Default | docker compose up -d |
App + SQLite. Database persists in the db-data volume. |
| Production | docker compose --profile production up -d |
App on gunicorn (4 workers) + Postgres 16. |
- Migrations run automatically on container start. If a migration fails, the container does not start.
- Image:
sithadmin/dart-leagueon DockerHub. - Additional volumes:
backupsandlogs.
Environment Variables
| Variable | Default | Description |
|---|---|---|
SECRET_KEY |
dev-secret-change-me |
Flask session secret. Required in production. |
GOOGLE_CLIENT_ID |
— | Google OAuth client ID |
GOOGLE_CLIENT_SECRET |
— | Google OAuth client secret |
DATABASE_URL |
sqlite:///dartleague.db |
Database connection string |
PORT |
5555 |
Host port |
FLASK_ENV |
development |
development or production |
ANTHROPIC_API_KEY |
— | Enables OCR via Claude Sonnet (preferred if both keys are set) |
GEMINI_API_KEY |
— | Enables OCR via Gemini Flash |
LOG_FILE |
— | Log file path (omit for console only) |
BACKUP_DIR |
backups |
Backup output directory |
MAX_BACKUPS |
10 |
Backups to keep |
Database
# PostgreSQL
DATABASE_URL=postgresql://user:pass@localhost:5432/dartleague
# MariaDB / MySQL (via pymysql)
DATABASE_URL=mysql+pymysql://user:pass@localhost:3306/dartleague
flask db migrate -m "description" # generate a migration
flask db upgrade # apply migrations
python backup.py # back up (SQLite copy, pg_dump, or mysqldump)
Scoring Rules
- Team average: sum of each player's average, each rounded up (
math.ceil) separately. - Handicap: when team averages differ by more than 2, the lower team gets
round(0.75 × difference)added to each game. - Standings: sorted by wins, then total points.
- Maximum: 81 points per player per game.
Auth and Roles
- Google OAuth only. No local passwords.
- Roles:
pending,member,admin. New users start aspending. - The first user to sign in becomes admin.
/dev-loginsigns in as the first admin whenFLASK_ENV=development.
Project Structure
app.py — Flask app wiring, config, OAuth, error handlers
admin_season.py — Dashboard, season CRUD, import/export
admin_roster.py — Teams, players, bulk uploads, merge
admin_scores.py — Weeks, matches, schedule generator, OCR, score entry
admin_users.py — Weeks list, user management
helpers.py — Averages, handicaps, standings, match scores
auth.py — Access control decorators
views.py — Public routes
models.py — SQLAlchemy models
backup.py — Database backup utility
seed_data.py — Development seed data generator
import_from_sheets.py — Google Sheets markdown export importer
export_to_json.gs — Google Apps Script sheet exporter
templates/ — Jinja2 templates (admin/ for admin pages)
static/ — SVG favicon and PWA manifest
migrations/ — Alembic migration scripts
docs/ — Design docs
Dockerfile, docker-compose.yml, docker-entrypoint.sh
Docs
- ARCHITECTURE.md: system design and routes
- DECISIONS.md: design rationale
- STATUS.md: what is done and not done
- SCHEDULE_GENERATOR.md: schedule generator design
Testing
There is no test suite. Verify changes on the dev server.