Skip to content

feat(rankings): add Top Contributors ranking for open source contributions#29

Merged
FreekBes merged 3 commits into
codam-coding-college:mainfrom
CheapFuck:feat/top-contributors-ranking
Jun 25, 2026
Merged

feat(rankings): add Top Contributors ranking for open source contributions#29
FreekBes merged 3 commits into
codam-coding-college:mainfrom
CheapFuck:feat/top-contributors-ranking

Conversation

@CheapFuck

Copy link
Copy Markdown
Contributor

Summary

Adds a first-class Top Contributors ranking, on par with the existing rankings (Top Performers, Guiding Stars, etc.), for points earned by contributing to Codam's open source projects.

Previously there was no structured way to recognise students who contribute to the coalition system and other Codam repositories. This routes those contributions through the same ranking machinery as everything else, so they automatically get season-end snapshots and the Top Contributor %login title award.

Changes

  • New contribution fixed point type — variable amount, decided per contribution by staff.
  • New Top Contributors ranking (slug top_contributors, title Top Contributor %login) fed by the contribution fixed type.
  • Home page card — a "Top Contributors" card below the "Contribute to the coalition system" card, driven by the standard ranking system. The ranking is excluded from the main rankings list since it has its own card. The generic /rankings/:ranking_type route serves /rankings/top_contributors.
  • Admin award form — a dedicated form (and assign route) for staff to award contribution points, tagged with the contribution fixed type so they count towards the ranking.
  • Dev scripts:
    • create_contributors_ranking.ts — idempotently creates just this ranking, without recreating the others (unlike create_rankings.ts).
    • migrate_contribution_scores.ts — tags pre-existing manually-awarded contribution scores (custom scores whose reason contains "contributed") with the new fixed type so they count.

Deploy notes

  1. Start the app once so the contribution fixed point type is created.
  2. Run node build/dev/create_contributors_ranking.js to register the ranking (non-destructive).
  3. Optionally run node build/dev/migrate_contribution_scores.js to fold in pre-existing contribution scores.

bonus_points is set to 0 (no automatic hourly bonus); staff can adjust it via the admin rankings UI if desired.

Testing

  • tsc builds cleanly.
  • Verified locally: home card, /rankings/top_contributors, and the admin contribution form all render (HTTP 200).

…tions

Add a first-class "Top Contributors" ranking, on par with the existing
rankings (Top Performers, Guiding Stars, etc.), for points earned by
contributing to Codam's open source projects.

- Add a dedicated `contribution` fixed point type (variable amount,
  decided per contribution by staff).
- Add the `Top Contributors` ranking definition (slug `top_contributors`,
  title `Top Contributor %login`) fed by the `contribution` fixed type, so
  it automatically gets season-end snapshots and title awards like the others.
- Show a Top Contributors card on the home page below the "Contribute to the
  coalition system" card, driven by the standard ranking system. Exclude it
  from the main rankings list (it has its own card). The generic
  /rankings/:ranking_type route serves /rankings/top_contributors.
- Add an admin form (and assign route) to award contribution points, tagging
  them with the `contribution` fixed type so they count towards the ranking.
- Add dev scripts: create_contributors_ranking.ts (idempotently create just
  this ranking without recreating the others) and migrate_contribution_scores.ts
  (tag pre-existing custom contribution scores with the new fixed type).
@FreekBes

Copy link
Copy Markdown
Member

Thank you for the PR! I will have a look at it likely by the end of next week. At first glance it looks good though, but I want to make absolutely sure before making such a drastic change to the points system.

Then for next season (starting in 2 weeks) we can also add a ranking bonus for this type.

@FreekBes FreekBes added the enhancement New feature or request label Jun 18, 2026
@FreekBes FreekBes self-requested a review June 18, 2026 09:26

@FreekBes FreekBes left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost there, can be merged after the requested changes have been made. Could make those changes myself, but maybe there was a reason for some of them that I failed to see so I will wait for your input.

Comment thread src/routes/home.ts
Comment thread templates/home.njk
Comment thread src/dev/create_contributors_ranking.ts Outdated
FreekBes and others added 2 commits June 24, 2026 14:01
Address review feedback:
- Render the top_contributors ranking through the standard rankings
  loop on the home page instead of a separate bespoke card
- Remove create_contributors_ranking.ts dev script; the ranking can be
  created via the web interface
@CheapFuck

Copy link
Copy Markdown
Contributor Author

Thanks for the review @FreekBes! I've pushed the requested changes in 9ecab3d:

  • The top_contributors ranking now renders through the standard rankings loop on the home page — no more separate bespoke card. It also no longer gets excluded from the main rankings query in home.ts.
  • Removed the create_contributors_ranking.ts dev script. The ranking can be created via the web interface; create_rankings.ts still seeds it for empty dev databases.

Also merged in the latest main. tsc builds cleanly. Ready for another look whenever you have time!

@FreekBes FreekBes merged commit 4c85ad8 into codam-coding-college:main Jun 25, 2026
1 check passed
@Codam-IT

Copy link
Copy Markdown

🎉 This PR is included in version 1.60.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants