Team progress

Who's doing the work.

Weekly results for every team — workouts, weight change, check-ins and bonus points rolled into one score.

Loading…
Dashboard

Leaderboard

Score this week

Points, ranked

Weight lost vs baseline

Cumulative kg, team total, by week

All metrics

Week detail
What we track

Four metrics. One score.

Each team logs one row per week. Baseline (week 0) is weights only. Everything below is stored per team, not per person, so it's fast to enter and private enough to share.

Workouts completed

Total sessions logged by the whole team that week. Target is 5 per member.

Example: 5 members × 5 = 25+10 pts each

Weight change

Sum of member weights (kg) at the end of the week. The dashboard shows kg lost against the week-0 baseline.

Example: 462.0 → 453.2 kg = 8.8 kg lost+20 pts per kg

Check-in compliance

How many members submitted their weekly check-in (photo + numbers). Shown as a % of the team.

Example: 4 of 5 = 80%+1 pt per %

Bonus points

Weekly challenges, habit streaks, step goals — whatever the coaches set. Awarded per team.

Example: cold-plunge challenge done by all = +25

Score formula

score = workouts × 10  +  checkin_%  +  kg_lost × 20  +  bonus_points

Weights are deliberately simple so anyone can sanity-check the leaderboard by hand. Change them in one place — the v_team_week view in db/schema.sql — and every week recalculates.

How to add results

Log a week.

Coaches enter one row per team each week. Re-submitting the same team + week overwrites it, so fixes are painless.

Admin form

Needs the admin key. Posts to /api/results.

Other ways in

Add a new team

POST to /api/teams with the admin key:

curl -X POST https://YOUR-SITE.pages.dev/api/teams \
  -H "x-admin-key: $ADMIN_KEY" -H "content-type: application/json" \
  -d '{"name":"Iron Wolves","captain":"Mitch","member_count":5}'
Bulk import with SQL

Run against the D1 database from your laptop:

npx wrangler d1 execute ub-challenge-db --remote --command \
"INSERT INTO weekly_results (team_id, week, workouts, total_weight_kg, checkins, bonus_points)
 VALUES (1, 5, 23, 451.0, 5, 20)
 ON CONFLICT (team_id, week) DO UPDATE SET workouts=excluded.workouts,
   total_weight_kg=excluded.total_weight_kg, checkins=excluded.checkins,
   bonus_points=excluded.bonus_points;"
API from a script or spreadsheet
curl -X POST https://YOUR-SITE.pages.dev/api/results \
  -H "x-admin-key: $ADMIN_KEY" -H "content-type: application/json" \
  -d '{"team_id":1,"week":5,"workouts":23,"total_weight_kg":451.0,
       "checkins":5,"bonus_points":20}'
One-time setup (Josh)
  1. Cloudflare → Workers & Pages → this project → Settings → Bindings → add D1 binding DBub-challenge-db (or keep wrangler.toml).
  2. Settings → Variables and Secrets → add secret ADMIN_KEY (long random string). Share it only with coaches.
  3. Redeploy. The badge at the top of this page turns green when the API is live.