From 10b697e41e5fa87ace327c03140388ab1704222e Mon Sep 17 00:00:00 2001 From: romsson Date: Wed, 24 Sep 2014 16:32:21 -0400 Subject: [PATCH] Fixing missing world trade data for PS --- media/js/explore/viz_general.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/media/js/explore/viz_general.js b/media/js/explore/viz_general.js index 474d27df..b060fe2a 100644 --- a/media/js/explore/viz_general.js +++ b/media/js/explore/viz_general.js @@ -1591,7 +1591,16 @@ var flat_data, } flat_data.map(function(d){ - d.world_trade = world_totals[d.year].filter(function(z){ return d.item_id==z.product_id })[0]['world_trade'] + if (typeof world_totals[d.year].filter(function(z){ return d.item_id==z.product_id })[0] != "undefined") + { + d.world_trade = world_totals[d.year].filter(function(z){ return d.item_id==z.product_id })[0]['world_trade'] + } + else // if not then assign value as 0 + { + d.world_trade = 0 + } + + // d.world_trade = world_totals[d.year].filter(function(z){ return d.item_id==z.product_id })[0]['world_trade'] }) data = []