Skip to content

Commit 4de23fa

Browse files
authored
Allow for country_population to be added to all locations as long as county_code is specified.
1 parent a0f8169 commit 4de23fa

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

app/location/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,13 @@ def country_population(self):
2727
"""
2828
Gets the population of this location.
2929
"""
30+
country_code = self.country_code
3031

3132
# Population data is unavailable for provinces
32-
if self.province:
33+
if not self.country_code:
3334
return None
3435
else:
35-
return countrypopulation.get_population_dict()[self.country_code]
36+
return countrypopulation.get_population_dict()[country_code]
3637

3738
@property
3839
def country_code(self):
@@ -106,4 +107,4 @@ def serialize(self, timelines = False):
106107
}})
107108

108109
# Return the serialized location.
109-
return serialized
110+
return serialized

0 commit comments

Comments
 (0)