Skip to content

Conversation

@natoinet
Copy link
Contributor

@natoinet natoinet commented Nov 22, 2025

This PR implements the Leaderboard feature requested by the mentor. It introduces a "Cowrie" based scoring system to encourage user engagement and track learning progress.

Key Features

  • Data Layer: Added score field to CustomUser model with a helper method add_points(amount) for easy integration with future learning modules. When a user hit a goal, just call the function to add points.
  • Presentation: Created a responsive, Dark Mode-compatible Leaderboard page (/leaderboard/) styled with Bulma gradients to match the existing UI (Languages/About pages).
  • Theming: Used "Cowries" (🐚) as the point currency to align with African heritage.
  • Admin: Updated UserAdmin to allow sorting and editing scores directly in the Django Admin.

About Migrations

In the previous PR (Auth), the original 0001_initial.py was removed to keep the history clean.

Since the score field requires a database column, I have regenerated 0001_initial.py in this PR. It now serves as the consolidated migration file that defines both the Custom User and the Score Field.

How to Test

Apply Migrations:

Bash

python manage.py migrate

Generate Fake Data (Python Shell): Run this snippet in the Django Python shell to populate the leaderboard with test users:

from django.contrib.auth import get_user_model
import random
User = get_user_model()
for name in ["Amara", "Kofi", "Zainab", "Abeba", "Abidemi", "Ada", "Chidinma", "Aadan", "Abanda", "Abena", "Aberash", "Dakarai"]:
    u, _ = User.objects.get_or_create(username=name, email=f"{name}@test.com")
    u.add_points(random.randint(100, 5000))

View Leaderboard: Navigate to /leaderboard/ and verify the ranking order and styling.

Screenshot

Screenshot 2025-11-23 at 00 41 55

Antoine Brunel and others added 3 commits November 22, 2025 18:04
Added score field and add_points function to CustomUser model. Created Leaderboard view and template. Updated Navbar to include Leaderboard link.
@pythonbrad pythonbrad added the fsf-hackathon Any issue related to the Free Software Foundation Hackathon. label Nov 23, 2025
@pythonbrad
Copy link
Member

@natoinet, the leaderboard at #35 has been merged.
Feel free to contribute to the current leaderboard UI.

@pythonbrad
Copy link
Member

pythonbrad commented Nov 23, 2025

@natoinet, can you solve the conflict?

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

Labels

fsf-hackathon Any issue related to the Free Software Foundation Hackathon.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants