IFRCGo / go-web-app

GO Web application! GO is a Red Cross Red Crescent platform to connect information on emergency needs with the right response.
https://go.ifrc.org
MIT License
6 stars 1 forks source link

[PROD] Situation report list order #1395

Open szabozoltan69 opened 3 days ago

szabozoltan69 commented 3 days ago

Issue

Recently it is not possible to set a situation report order, situation reports show randomly on emergency pages. We should use an &ordering=created_at part in the request.

Details:

From backend side it would be possible to order by _createdat and name: https://github.com/IFRCGo/go-api/blob/develop/api/drf_views.py#L782-L784 But the client does not send any of them. E.g. https://go.ifrc.org/emergencies/6700/reports : https://goadmin.ifrc.org/api/v2/situation_report/?event=6700&limit=9999 gives this order: Middle East Complex Emergency - SITREP N.2 Middle East Complex Emergency - SITREP N.10 Middle East Complex Emergency - SITREP N.13 Middle East Complex Emergency - SITREP N.1 Middle East Complex Emergency - SITREP N.4 This is not date neither name order.

If we insert an &ordering=created_at

If a more sophisticated version is needed, we can insert a "position" or "order" integer to expicitely being able to define ordering.

Also on backend side Admin it would be nice to – at least – see created_at, because recently it can not be seen anywhere, just in the database.

szabozoltan69 commented 1 day ago

Could be solved on backend side via https://github.com/IFRCGo/go-api/pull/2275

szabozoltan69 commented 1 day ago

You can test it on Staging, e.g. on https://go-stage.ifrc.org/emergencies/6700/reports