colesr commited on
Commit
a533f17
·
verified ·
1 Parent(s): 0956fc5

Fix World Bank fetch crash: type mismatch on year comparison

Browse files
Files changed (1) hide show
  1. main.py +2 -1
main.py CHANGED
@@ -528,7 +528,8 @@ def fetch_worldbank(
528
  records[country] = {"country": country}
529
  # Keep the latest year for each indicator
530
  current = records[country].get(ind_id)
531
- if current is None or (year and year > current.get("_year", "0")):
 
532
  records[country][ind_id] = round(float(value), 3)
533
  records[country]["_year_" + ind_id] = year
534
  time.sleep(0.15) # Rate limit
 
528
  records[country] = {"country": country}
529
  # Keep the latest year for each indicator
530
  current = records[country].get(ind_id)
531
+ current_year = records[country].get("_year_" + ind_id, "0")
532
+ if current is None or (year and year > current_year):
533
  records[country][ind_id] = round(float(value), 3)
534
  records[country]["_year_" + ind_id] = year
535
  time.sleep(0.15) # Rate limit