This repository was archived by the owner on Sep 19, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 33
Added scoreboard that ranks countries based on number of events #343
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
population = Country.objects.get(iso=country_code).population | ||
country_score = 0 | ||
if number_of_events > 0: | ||
country_score = 1. * number_of_events / population |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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!
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? |
@gandalfar Yep, working on the tests as well! |
@gandalfar Done, should be better nao :) |
jurecuhalev
added a commit
that referenced
this pull request
Sep 24, 2014
Added scoreboard that ranks countries based on number of events
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 😁