Skip to content
This repository was archived by the owner on Sep 19, 2018. It is now read-only.

Added scoreboard that ranks countries based on number of events #343

Merged
merged 16 commits into from
Sep 24, 2014

Conversation

ialja
Copy link
Contributor

@ialja ialja commented Sep 22, 2014

Created a new /scoreboard page that has a list of countries and the number of events in each country (#251). The list also takes into account the population of each country, so that smaller countries with more events per citizen stand a chance of climbing to the top.

To get population data, I added django-countries-plus. The page could use some design love and to be linked from elsewhere, although we can secretly deploy it first and see how people react to it 😁

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.9%) when pulling eff7cc7 on ialja:scoreboard into 7dec0a0 on codeeu:master.

population = Country.objects.get(iso=country_code).population
country_score = 0
if number_of_events > 0:
country_score = 1. * number_of_events / population
Copy link
Contributor

Choose a reason for hiding this comment

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

Population can be zero or null & might break the code (division by zero).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, added an extra check!

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.9%) when pulling baf99ad on ialja:scoreboard into 7dec0a0 on codeeu:master.

@jurecuhalev
Copy link
Contributor

Code looks good, I'll review it a bit later and run in locally. Is there any chance that you can add a new test file for this and add a few simple tests - just ensuring that it works and that it's going to be easier to write additional tests in the future?

@ialja
Copy link
Contributor Author

ialja commented Sep 23, 2014

@gandalfar Yep, working on the tests as well!

@coveralls
Copy link

Coverage Status

Coverage increased (+0.2%) when pulling 425363d on ialja:scoreboard into 7dec0a0 on codeeu:master.

@ialja
Copy link
Contributor Author

ialja commented Sep 24, 2014

@gandalfar Done, should be better nao :)

@coveralls
Copy link

Coverage Status

Coverage increased (+0.2%) when pulling e3f6013 on ialja:scoreboard into 81676f3 on codeeu:master.

jurecuhalev added a commit that referenced this pull request Sep 24, 2014
Added scoreboard that ranks countries based on number of events
@jurecuhalev jurecuhalev merged commit ebf7ee8 into codeeu:master Sep 24, 2014
@ialja ialja deleted the scoreboard branch October 2, 2014 09:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants