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

Clear old Pollination Mapper results #492

Closed rajadain closed 5 years ago

rajadain commented 5 years ago

Overview

Since we upgraded to the 2017 CDL in #410 and 598ed284, the current stored results in the database are out of date. By clearing them out, we ensure they will be recalculated when those scenarios are revisited.

Also fix issue with loading projects with their results cleared. In 1ddff11, as part of #165, the result fetching was refactored to be a little more eager. This works well for most cases, but when the results are artificially cleared, it would make existing projects crash, because the results would try to fetch before the project would finish loading (triggered by the project's fetch method), causing the front-end to request the yield without specifying an area of interest.

By adding a test to not fetch results until a project has loaded, we ensure that the eager call for project's with reset results do not fire. The results are fetched again when the result view is loaded, by which time the project has loaded correctly, so the project can reinitialize correctly.

Connects #411

Notes

Since this is a destructive operation, we should ensure we take a database backup before running this migration.

Testing Instructions

rajadain commented 5 years ago

Thanks for taking a look! Merging this now.