Closed afabiani closed 6 years ago
From call with @kappu72 and @ciasio:
Regarding point 3. The list of events showed to the Emergency manager must be ordered by COP promotion time: hazard alert with most recent COP promoted first! While the Impact Assessor will continue to get the list of Hazard alerts ordered by "promoted_at" attribute, from the newest to the oldest (as it is at the moment).
Front end needs: We already have an endoint that is /decat/api/impact_assessments, This end point already implements hazard__id and other filters. 1) Client needs to add the promoted filter to impact_assessments endpoint. 2) Clients need the possibility to request hazard alert ordered by impact_assessment promoted_at but this should requested with a param in the url this request are releted to issue#175
Ah, ok. So, correct me if i'm wrong here: EM should see Hazard Alerts which have at least one Impact Assessments promoted to COP, right?
Right! and they have to be ordered according to the Impact Assessment promoted_at timestamp, with newer first
As for creating IA, you should be able to POST to /decat/api/impact_assessments/
with fields:
title
(string),geometry
(geojson or wkt)hazard
(id of hazard alert)map
(id of map)Also, promoting IA is a simple PUT with (or PATCH with partial payload) promoted
set to True
.
> PATCH /decat/api/impact_assessments/1/
>
> {"promoted": true}
< HTTP/1.1 200 OK
< ..
You can also get list of hazard alerts with IAs promoted to COPs with endpoint /decat/api/cops/
. Filtering should work in the same way as alerts
endpoint.
You can filter promoted assessments with promoted=true|false
filter, and yes, by using hazard__id
, you should be able to get IAs for specific Hazard Alert.
So cops endpoint works exactly as alerts endpoint (same filtering capabilities) but return the results ordered by impact_assessment promoted at value. The impact_assessment api was already implemented by Alessio, was missing only the possibility to filter impact assessment by promote property. i.e. http://decat-dev.geo-solutions.it/decat/api/impact_assessments/?promoted=true
yes, but it also had several small bugs i've fixed. also, test cases were added for both endpoints.
We need to change permission to the assessment map to allow the emergency-manager to load the map
this should work now. Code that was supposed to update permissions (which was looking good for first glimpse), was throwing an exception, which was swallowed by unconfigured logging.
Promotion of Impact Assessments to COP. Permissions should be correct managed.