Show the right flag for every country on profiles and the leaderboard
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 72/100
Research direction
Start with Profile.flag and the _FLAGS dict in core/models.py, then read core/signals.py around line 37 where the country is taken from the GitHub location. Add a country data file (for example core/data/countries.json) and compute regional indicator flags from ISO alpha-2 codes, keeping the globe fallback. Done when the listed examples (Nigeria, Lagos, Nigeria, France, Cameroun) return the right flag, unknown values return the globe, and pytest covers these cases.
Written by the indexing model from the issue text.
Description
Context
Profile.flag in core/models.py uses a hand-written _FLAGS dict that only covers some African countries; everyone else gets a globe. The country comes from the free-text GitHub location (core/signals.py, line 37), so values like "Lagos, Nigeria" or "Paris" don't match either.
What to do
- Add a small data file (e.g.
core/data/countries.json) mapping country names in English and French to ISO 3166-1 alpha-2 codes. - Compute the flag from the code with regional indicator symbols (each letter becomes
chr(0x1F1E6 + ord(letter) - ord("A"))), so every country works. - Match the last part of a location like "Lagos, Nigeria" too.
- Keep the globe fallback when nothing matches.
Acceptance criteria
- "Nigeria", "nigeria", "Lagos, Nigeria", "France" and "Cameroun" give the right flag
- Unknown values still return the globe
- Unit tests for these cases
Run it locally
git clone https://github.com/<your-username>/opentoall.git && cd opentoall
python -m venv venv && source venv/bin/activate
pip install -r requirements.txt
cp .env.example .env
python manage.py migrate
python manage.py seed_demo # demo data for the UI
python manage.py runserver # http://localhost:8000
pytest # must pass before you open the PR
See CONTRIBUTING.md for conventions (Conventional Commits, one PR per issue, link the PR with "Closes #").
Questions are welcome. Comment here to get assigned before you start, so two people don't work on the same thing.
— Max
- Dominant language
- Python
- Stars
- 5
- Forks
- 3
- Avg merge
- 2d 50m
- Merged PRs (30d)
- 31
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Ymax27/opentoall
-
enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 2 days
-
enhancement good first issue
Difficulty 2/5 Half a day Newbie friendliness 82/100
Maintainers usually reply within 2 days
-
enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 2 days
-
enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 2 days
-
enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 2 days
All issues in Ymax27/opentoall
Similar issues
-
pydanty:is-working
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
pydantic/pydantic-ai#14187 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
[Bug]: legacy_json_to_doc crashes on persisted docs with "relationships": nullPossibly taken @Harsh23Kashyap claimed this today. Open
Difficulty 1/5 Under an hour Newbie friendliness 88/100
run-llama/llama_index#24392 ·
Maintainers usually reply within 2 days
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
pathintegral-institute/mcpm.sh#568 ·
Maintainers usually reply within 21 days