project-icp / bee-pollinator-app

The web application front end for the ICP Pollinator Decision Support Tool 🐝
Apache License 2.0
6 stars 1 forks source link

Show Monthly Survey Colonies in Correct Order #499

Closed rajadain closed 5 years ago

rajadain commented 5 years ago

Overview

Even though the front-end sends the apiaries to the back-end in the correct order, and they are saved in the correct order, for some reason when they are queried for again, the serializer sends them back in reverse order:

https://github.com/project-icp/bee-pollinator-app/blob/3ab3582d60da4eb8e4845ab15139e98b6a01ce90/src/icp/apps/beekeepers/serializers.py#L56-L64

https://github.com/project-icp/bee-pollinator-app/blob/3ab3582d60da4eb8e4845ab15139e98b6a01ce90/src/icp/apps/beekeepers/views.py#L161-L170

It was unclear how this can be remedied on the DRF side, as the documentation did not provide any hints, nor could this question be found on Stack Overflow.

In the interest of expediency, I've decided to sort the results in the front-end when the Monthly Survey details modal is loaded. This ensures they are shown in the correct order, regardless of what order they are sent down from the API in.

Also adds a missing link.

Connects #459 Connects #497

Demo

First survey is for the colony "A":

image

Participate in Study link:

image

Testing Instructions

mmcfarland commented 5 years ago

@azavea-bot rebuild

hectcastro commented 5 years ago

@azavea-bot rebuild

hectcastro commented 5 years ago

Please target release/1.0.0 prior to merge.

rajadain commented 5 years ago

Thanks for taking a look and fixing the CI issues! I've retargeted this to release/1.0.0. I'm not going to wait for CI again, since that branch is even with develop which has already succeeded in CI. Merging now.