Commit 94ae2730edbff755b2c269cfb157c234cbd2d744

Authored by Antoine Goutenoir
1 parent e721cb31
Exists in master

Ignore duplicates in destinations.

Fix #4
Showing 1 changed file with 8 additions and 1 deletions   Show diff stats
flaskr/controllers/main_controller.py
... ... @@ -301,7 +301,8 @@ def compute(): # process the queue of estimation requests
301 301 'cities': cities_mean
302 302 }
303 303  
304   - _results['total'] = total
  304 + _results['total'] = total # DEPRECATED
  305 + _results['footprint'] = total
305 306  
306 307 return _results
307 308  
... ... @@ -333,10 +334,16 @@ def compute(): # process the queue of estimation requests
333 334 # Run Scenario A for each Destination, and expose optimum Destination.
334 335 #
335 336 else:
  337 + unique_city_keys = []
336 338 result_cities = []
337 339 for destination in destinations:
338 340 city_key = get_city_key(destination)
339 341  
  342 + if city_key in unique_city_keys:
  343 + continue
  344 + else:
  345 + unique_city_keys.append(city_key)
  346 +
340 347 city_results = compute_one_to_many(
341 348 _origin=destination,
342 349 _destinations=origins,
... ...