Skip to content

feat(imc): add BMI recording and leaderboard module - #205

Open
RedsTom wants to merge 2 commits into
masterfrom
feat/imc-module
Open

RedsTom wants to merge 2 commits into
masterfrom
feat/imc-module

Conversation

@RedsTom

@RedsTom RedsTom commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

What

New self-contained imc module (auto-discovered, no registration needed outside its directory):

  • /imc record <weight> <height> — stores weight/height, computes BMI, replies ephemerally with BMI (1 decimal) + WHO category
  • /imc view [target] — shows a member's BMI (self by default), ephemeral
  • /imc leaderboard [limit] — server ranking by BMI descending (default 10, max 25), public reply

Supporting pieces: ImcEntry Prisma model (one entry per member/guild via @@unique([guildId, userId])), ImcService (upsert / lookup / ordered query), FR + EN translations (displayed as "IMC" / "BMI"), 12 unit tests, and a docs/functional.md section.

Why

Requested feature: let users record their BMI and generate a leaderboard sorted by descending BMI.

Privacy design: record/view are ephemeral (health data visible only to the requester); only leaderboard is public — members opt in by recording their BMI. Command/subcommand names stay in English with French localized descriptions, per the repo's command convention.

Verification

  • pnpm build (tsc) passes, full unit suite 116/116 green, oxlint clean
  • Pre-commit hooks (oxfmt/oxlint/commitlint) pass

Reviewer notes / follow-up

  • Migration not included: no PostgreSQL was reachable in this environment (P1001 on localhost:5432), so run docker compose up -d && pnpm prisma:migrate -- --name add_imc_entry with the DB up before merging/using.
  • After deploy, enable the module via /modules.

🤖 Generated with Claude Code

RedsTom and others added 2 commits September 15, 2026 21:59
Adds a self-contained imc module: /imc record stores weight/height and
computes BMI (ephemeral reply), /imc view shows a member's BMI
(ephemeral), /imc leaderboard lists server members by descending BMI
(public). Includes ImcEntry Prisma model, French/English translations,
unit tests, and functional documentation.

Co-Authored-By: Claude Code <noreply@anthropic.com>
The leaderboard no longer sorts by raw BMI descending: entries are
ranked by deviation from the healthy range (18.5-25, WHO normal),
with ties broken by BMI in the sort direction. A new order option
selects worst-first (default) or best-first, and each row shows the
deviation. Pure ranking logic (distanceToIdeal, rankEntries) is unit
tested.

Co-Authored-By: Claude Code <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant