Christine noticed that we're reporting 2X results on all the Rank cards vs other views. This seems conistent across the board:
I see why: downstream of the SQL we're adding up everything inside an entity to calc the totals:
entity.totalKilled = d3.sum(entity.values, d => d.totalKilled);
entity.totalInjured = d3.sum(entity.values, d => d.totalInjured);
When we added Vehicle Type allocations, the SQL includes a set of totals per mode (which add up correctly) and then a second set of allocations per mode per vehicle type, which separately add up to exactly the totals. Hence 2X.
There's probably a better way to solve this by handpicking what we want to sum, but these will be 2X 100% of the time, so we're just gonna divide those by 2.
Christine noticed that we're reporting 2X results on all the Rank cards vs other views. This seems conistent across the board:
I see why: downstream of the SQL we're adding up everything inside an entity to calc the totals:
When we added Vehicle Type allocations, the SQL includes a set of totals per mode (which add up correctly) and then a second set of allocations per mode per vehicle type, which separately add up to exactly the totals. Hence 2X.
There's probably a better way to solve this by handpicking what we want to sum, but these will be 2X 100% of the time, so we're just gonna divide those by 2.