Open Sandro-Meireles opened 3 years ago
@Sandro-Meireles for sites with multiple countries we show the country level only as we use the World data from https://github.com/rapidpro/ureport/blob/c8ffb886236d4396bc14c6fca78ba21090c8f338/ureport/public/views.py#L466 and use limit_states
config to only display those countries also you need to make that common.is_global = True
Normally in a RapidPro Org, it has a map with a single country as level 0, so the states are with level 1 and cities with level 2. In our infrastructure we have some customers who have the need to contain several countries in one Rapidpro Org, in this case, the union of all countries on the map would be level 0, a specific country would be level 1, and then level 2 would be for states or districts.
Several of our U-Report instances can use a single API-Token from a RapidPro Org. So for each country where the map in Rapidpro represents level 1, can make the selection of the map using the "Limit States" filter, however, when using this limit, the query returns only the information that is at the level 1 (countries in this case), without state details (in this case, level 2). We need to list the states contained in the country limited (level 1), that is, list all those that have level 2 and that are children of the country specified by the "Limit States".
To solve this, we can add a new field for Org in
settings_common.py
, it would berequired=False
after that, to query the data in therender_to_response
method, inureport.public.views.BoundaryView
, making 1 a value default, it would be used on line 488, representing the level value to be filtered, example:ureport.public.views.BoundaryView.render_to_response
line 488