File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ class Country(pydantic.BaseModel):
5151
5252
5353class AllLocations (pydantic .BaseModel ):
54- latest : Totals = None # FIXME
54+ latest : Totals
5555 locations : List [Country ]
5656
5757
@@ -139,11 +139,14 @@ def get_all_locations(
139139 locations ,
140140 )
141141 )
142- response_dict = {
143- "locations" : [location .serialize (timelines ) for location in locations ]
142+ return {
143+ "latest" : {
144+ "confirmed" : sum (map (lambda location : location .confirmed , locations )),
145+ "deaths" : sum (map (lambda location : location .deaths , locations )),
146+ "recovered" : sum (map (lambda location : location .recovered , locations )),
147+ },
148+ "locations" : [location .serialize (timelines ) for location in locations ],
144149 }
145- LOGGER .info (f"response: { reprlib .repr (response_dict )} " )
146- return response_dict
147150
148151
149152@APP .get ("/locations/{id}" , response_model = Location )
You can’t perform that action at this time.
0 commit comments