Skip to content

Commit 10ff936

Browse files
Merge pull request #94 from trophyso/leaderboard-eligibility
leaderboard eligibility
2 parents 1092f26 + 816be35 commit 10ff936

10 files changed

Lines changed: 585 additions & 124 deletions

File tree

‎.claude/settings.json‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"permissions": {
3+
"deny": ["Read(./.env)", "Read(./.env.local)", "Read(./.env.*.local)"]
4+
}
5+
}

‎CLAUDE.md‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Trophy Docs
2+
3+
Mintlify documentation site for Trophy. Repo-root paths are the canonical English source; `es/**` is generated by the translation workflow. See `README.md` for Lingo and MCP setup (Cursor-specific steps there).
4+
5+
## Writing style
6+
7+
- Never abbreviate "leaderboard" to "board" in docs copy, comments or commit messages. Always write "leaderboard".
8+
9+
## Localization Workflow
10+
11+
- Treat repo-root docs paths as the canonical English source and keep identical relative file paths/filenames across all locales.
12+
- For planned doc changes, default scope to English source files only. Do not plan or execute manual edits to non-English locale content (for example `es/**`) unless the user explicitly asks for localized updates; rely on the existing translation workflow to propagate English changes.
13+
- Keep all locale navigation in `docs.json` under `navigation.languages`; do not reintroduce `navigation.global` or top-level `navbar`.
14+
- Keep SEO metatags in English unless explicitly requested otherwise.
15+
- Do not translate code snippets, inline code, URLs, route slugs, or API identifiers.
16+
- Shared media lives under repo-root `assets/`. Default-language pages are at repo-root section paths (for example `<section>/<page>.mdx`) and targets are under locale directories (for example `es/<section>/<page>.mdx`), so relative `src` paths need one more `../` under each locale segment than in English. `scripts/localize-internal-links.mjs` rewrites markdown `](/...)` and JSX `href="/..."` only (absolute navigation paths). Relative repo-root `assets/` `src` and MDX `import` paths are normalized by `scripts/localize-mdx-paths.mjs` after Lingo.
17+
- `scripts/localize-mdx-paths.mjs` rewrites: `<locale>/components/*.jsx` for the active locale; `from ".../snippets/..."`; and JSX `src=".../assets/..."` so `../` depth matches the file’s path. Run after Lingo in `translate:generate` and translate-on-main; CI checks via `translate:localize-mdx-paths:check`.
18+
- Shared MDX snippets live under repo-root `snippets/` (not per-locale). Import with relative paths from each page; do not add shared MDX snippets to Lingo `i18n.json` buckets unless you intend to translate them.
19+
- Locale-aware React components that can contain text live under `components/*.jsx` for default language and `<locale>/components/*.jsx` for targets, and are manually maintained per locale (do not add them to Lingo `i18n.json` buckets; do not keep these in shared `snippets/`).
20+
- Endpoint and webhook MDX must pin a **repo-local** OpenAPI file in frontmatter (do **not** put remote OpenAPI URLs in frontmatter, and do **not** set tab/group-level `openapi` in `docs.json` navigation—tab `openapi` auto-populates endpoints and duplicates MDX nav entries; remote URLs in frontmatter are not reliably resolved by Mintlify). Specs live under `openapi/application.json` (Application API + webhooks) and `openapi/admin.json` (Admin API), also listed under `api.openapi` in `docs.json`. Forms: `openapi: "/openapi/application.json GET /path"`, `openapi: "/openapi/application.json webhook <eventKey>"`, `openapi: "/openapi/admin.json METHOD /path"`. Keep those lines identical across locales; Lingo must not alter them.
21+
- English **nav titles** for those pages come from OpenAPI **`summary`** via `scripts/sync-openapi-titles.mjs` (`npm run translate:sync-openapi-titles`). It runs at the start of `translate:generate` and on the translate-on-main workflow. Lingo translates the `title` field for target locales; the script only fills a missing target `title` with English (bootstrap)—it does not overwrite existing translations.
22+
- Mintlify custom heading IDs use markdown `## Title {#slug}` (see Mintlify docs). Slugs are aligned from English source root files via `scripts/sync-heading-anchors.mjs`. Never translate or alter `{#…}`; sync runs after Lingo in PIT/CI. Do not merge heading-count drift between source root and target locales without fixing structure first.
23+
- For Mintlify `<Accordion>` components that may be deep-linked, always set explicit `id` values (do not rely on title-derived hashes) and keep those `id`s identical across locales.
24+
- Do not use fragile OpenAPI parameter hash links like `#parameter-*` in docs links; link to the endpoint page and reference parameter names inline in prose/code.
25+
- Treat `lingo/brand-voice.md` as the source of truth for **brand voice** (tone and style) only. Do not add structural or tooling rules there (for example Mintlify `{#slug}` handling); those stay in this rule, README, and optionally in the Lingo engine **Instructions** field—not brand voice.
26+
- Do not add script-based brand voice sync; sync brand voice on demand via Lingo MCP tools from chat.
27+
- Treat `lingo/glossary.csv` as the glossary source of truth; use MCP sync with canonical key `sourceLocale|targetLocale|type|sourceText`.
28+
- For glossary sync, always do dry-run first, show create/update/delete counts, then apply on confirmation.
29+
- When adding locales, update both `docs.json` language blocks and `i18n.json` `locale.targets`.
56.2 KB
Loading

‎es/features/leaderboards.mdx‎

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,46 @@ Para obtener las clasificaciones de un grupo particular de usuarios con una comb
134134
para que un usuario se incluya en las clasificaciones devueltas.
135135
</Note>
136136

137+
## Elegibilidad {#eligibility}
138+
139+
La elegibilidad controla qué usuarios pueden participar en una clasificación. Úsala cuando una clasificación deba estar abierta solo a un grupo específico de usuarios, por ejemplo, clientes de pago, una región concreta o una cohorte beta.
140+
141+
La elegibilidad se basa en [atributos de usuario personalizados](/es/features/users#custom-user-attributes). Un usuario solo puede participar en una clasificación, y aparecer en su ranking, si sus atributos cumplen todas las reglas de elegibilidad que definas. Las clasificaciones sin reglas de elegibilidad están abiertas a todos los usuarios.
142+
143+
Para definir reglas de elegibilidad, ve a la página de configuración de la clasificación y añade uno o más atributos de usuario, junto con los valores que deben tener los usuarios, en el campo **Atributos de usuario** de la sección **Elegibilidad**.
144+
145+
<Frame>
146+
<img
147+
height="200"
148+
width="100%"
149+
noZoom
150+
src="../../assets/features/leaderboards/eligibility.png"
151+
/>
152+
</Frame>
153+
154+
<Note>
155+
Cuando defines varias reglas de elegibilidad, un usuario debe cumplirlas todas
156+
para ser elegible.
157+
</Note>
158+
159+
Los usuarios que no son elegibles no reciben puntuación y no aparecen en los rankings. Las posiciones se calculan solo entre los usuarios elegibles, por lo que no quedan huecos donde habría estado un usuario no elegible. Si los atributos de un usuario cambian y ya no cumplen las reglas, Trophy lo elimina de la ejecución actual de la clasificación.
160+
161+
Las ejecuciones históricas nunca se modifican. Una vez que una ejecución ha finalizado, sus rankings quedan fijados, independientemente de cómo cambien después los atributos de los usuarios.
162+
163+
<Note>
164+
Las reglas de elegibilidad solo se pueden cambiar mientras una clasificación está `Inactive`. Consulta
165+
[estados de la clasificación](#leaderboard-statuses).
166+
</Note>
167+
168+
### Elegibilidad frente a desgloses {#eligibility-vs-breakdowns}
169+
170+
Los [desgloses](#ranking-breakdowns) y la elegibilidad usan atributos de usuario, pero cumplen funciones distintas:
171+
172+
- **Los desgloses** dividen a los participantes en grupos más pequeños. Todos los usuarios siguen clasificados, pero dentro de su propio grupo.
173+
- **La elegibilidad** decide quién puede participar. Los usuarios que no cumplen las reglas quedan excluidos por completo.
174+
175+
Puedes usar ambas opciones en la misma clasificación, por ejemplo, para limitar una clasificación a los usuarios de pago y luego agruparlos por país.
176+
137177
## Fechas de Inicio y Fin {#start-end-dates}
138178

139179
Usa fechas de inicio y fin para controlar la ventana dentro de la cual las clasificaciones están clasificando activamente a los usuarios.
@@ -211,6 +251,8 @@ Si una clasificación ya tiene un número de participantes que coincide con su m
211251

212252
La única excepción a esto es cuando se utilizan [atributos de desglose](#ranking-breakdowns) para agrupar a los participantes en cohortes más pequeñas. Al usar atributos de desglose, el límite de participantes se aplica a cada grupo, no de manera general.
213253

254+
Si una clasificación tiene reglas de [elegibilidad](#eligibility), el límite de participantes solo cuenta a los usuarios elegibles.
255+
214256
<Tip>
215257
Si necesitas un límite de participantes mayor, considera usar [atributos de desglose](#ranking-breakdowns) para agrupar a los participantes en cohortes más pequeñas. O contáctanos en [support@trophy.so](mailto:support@trophy.so) y estaremos encantados de aumentar tus valores predeterminados.
216258
</Tip>
@@ -255,7 +297,7 @@ Para crear una clasificación, dirígete a la [página de clasificaciones](https
255297
</Step>
256298

257299
<Step title="Guarda los cambios">
258-
Guarda los cambios y dirígete a la página de configuración para establecer [fechas de inicio y fin](#start-end-dates), [programaciones de clasificaciones recurrentes](#repeating-leaderboards) y más.
300+
Guarda los cambios y ve a la página de configuración para definir la [elegibilidad](#eligibility), las [fechas de inicio y fin](#start-end-dates), las [programaciones de clasificaciones recurrentes](#repeating-leaderboards) y más.
259301
</Step>
260302

261303
</Steps>
@@ -365,6 +407,14 @@ Este gráfico es un histograma de las puntuaciones de los usuarios en una clasif
365407

366408
{" "}
367409

410+
<Accordion id="leaderboard-eligibility-faq" title="¿Puedo limitar una clasificación a determinados usuarios?">
411+
Sí. Añade reglas de [elegibilidad](#eligibility) a la clasificación mediante atributos
412+
de usuario personalizados, y solo los usuarios con los valores de atributo correspondientes podrán
413+
participar y aparecer en la clasificación.
414+
</Accordion>
415+
416+
{" "}
417+
368418
<Accordion id="leaderboard-weekly-faq" title="No veo una opción de clasificación semanal, ¿cómo puedo configurar una?">
369419
Trophy admite la ejecución de clasificaciones repetitivas en cualquier número
370420
arbitrario de días. Así que una clasificación semanal sería simplemente una clasificación que se repite cada 7

‎es/features/users.mdx‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,13 @@ Los atributos personalizados de usuario pueden utilizarse para personalizar logr
187187
>
188188
Controla qué usuarios reciben correos electrónicos gamificados.
189189
</Card>
190+
<Card
191+
title="Elegibilidad para clasificaciones"
192+
icon="ranking-star"
193+
href="/es/features/leaderboards#eligibility"
194+
>
195+
Limita las clasificaciones a grupos específicos de usuarios.
196+
</Card>
190197
<Card
191198
title="Personalización de Correos Electrónicos"
192199
icon="trophy"

‎features/leaderboards.mdx‎

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,46 @@ To fetch rankings for a particular group of users with a specific combination of
134134
for a user to be included in the returned rankings.
135135
</Note>
136136

137+
## Eligibility {#eligibility}
138+
139+
Eligibility controls which users are allowed to take part in a leaderboard at all. Use it when a leaderboard should only be open to a specific group of users, for example paying customers, a particular region or a beta cohort.
140+
141+
Eligibility is based on [custom user attributes](/features/users#custom-user-attributes). A user can only take part in, and appear in the rankings of, a leaderboard if their attributes match every eligibility rule you set. Leaderboards with no eligibility rules are open to all users.
142+
143+
To set eligibility rules, head to the leaderboard configuration page and add one or more user attributes and the values users must have in the **User attributes** field of the **Eligibility** section.
144+
145+
<Frame>
146+
<img
147+
height="200"
148+
width="100%"
149+
noZoom
150+
src="../assets/features/leaderboards/eligibility.png"
151+
/>
152+
</Frame>
153+
154+
<Note>
155+
When you set multiple eligibility rules, a user must match all of them to be
156+
eligible.
157+
</Note>
158+
159+
Users who aren't eligible are not scored and don't appear in rankings. Ranks are calculated across eligible users only, so there are no gaps where ineligible users would have been. If a user's attributes change and they no longer match, Trophy removes them from the current run of the leaderboard.
160+
161+
Historical runs are never changed. Once a run has finished its rankings are fixed, regardless of how users' attributes change afterwards.
162+
163+
<Note>
164+
Eligibility rules can only be changed while a leaderboard is `Inactive`. See
165+
[leaderboard statuses](#leaderboard-statuses).
166+
</Note>
167+
168+
### Eligibility vs Breakdowns {#eligibility-vs-breakdowns}
169+
170+
[Breakdowns](#ranking-breakdowns) and eligibility both use user attributes but do different jobs:
171+
172+
- **Breakdowns** split participants into smaller groups. Every user is still ranked, just within their own group.
173+
- **Eligibility** decides who can participate. Users who don't match are excluded entirely.
174+
175+
You can use both on the same leaderboard, for example to limit a leaderboard to paying users and then group them by country.
176+
137177
## Start & End Dates {#start-end-dates}
138178

139179
Use start and end dates to control the window within which leaderboards are actively ranking users.
@@ -213,6 +253,8 @@ If a leaderboard already has a number of participants that matches its configure
213253

214254
The only exception to this is when using [breakdown attributes](#ranking-breakdowns) to group participants into smaller cohorts. When using breakdown attributes the participant limit applies to each group, not overall.
215255

256+
If a leaderboard has [eligibility](#eligibility) rules, the participant limit only counts eligible users.
257+
216258
<Tip>
217259
If you require a larger participant limit, considering using [breakdown attributes](#ranking-breakdowns) to group participants into smaller cohorts. Or please contact us at [support@trophy.so](mailto:support@trophy.so) and we'll be happy to increase your defaults.
218260
</Tip>
@@ -257,7 +299,7 @@ To create a leaderboard, head to the [leaderboards page](https://app.trophy.so/l
257299
</Step>
258300

259301
<Step title="Hit save">
260-
Hit save and head to the configure page to set up [start & end dates](#start-end-dates), [repeating leaderboard schedules](#repeating-leaderboards) and more.
302+
Hit save and head to the configure page to set up [eligibility](#eligibility), [start & end dates](#start-end-dates), [repeating leaderboard schedules](#repeating-leaderboards) and more.
261303
</Step>
262304

263305
</Steps>
@@ -367,6 +409,14 @@ This chart is a histogram of users' scores in a particular leaderboard. This is
367409

368410
{" "}
369411

412+
<Accordion id="leaderboard-eligibility-faq" title="Can I limit a leaderboard to certain users?">
413+
Yes. Add [eligibility](#eligibility) rules to the leaderboard using custom
414+
user attributes, and only users with matching attribute values will be able
415+
to take part and appear in the rankings.
416+
</Accordion>
417+
418+
{" "}
419+
370420
<Accordion id="leaderboard-weekly-faq" title="I don't see a weekly leaderboard option, how can I set one up?">
371421
Trophy supports running repeating leaderboards on any arbitrary number of
372422
days. So a weekly leaderboard would just be a leaderboard that repeats every 7

‎features/users.mdx‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,18 @@ Custom user attributes can be used to personalize achievements, customize the wa
185185
</Card>
186186
<Card
187187
title="Email Personalization"
188-
icon="trophy"
188+
icon="braces"
189189
href="/features/emails#email-variables"
190190
>
191191
Personalize email copy and subject lines with custom user attributes.
192192
</Card>
193+
<Card
194+
title="Leaderboard Eligibility"
195+
icon="users"
196+
href="/features/leaderboards#eligibility"
197+
>
198+
Limit leaderboards to specific groups of users.
199+
</Card>
193200
</CardGroup>
194201

195202
#### Data Aggregation and Filtering {#data-aggregation-and-filtering}

0 commit comments

Comments
 (0)