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.
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
Checkout this branch and
bundle --debug
Go to :8000/ and log in
Create a project and ensure the scenario values are saved
Run the migration
Check the values of these scenarios in the database to ensure they've been cleared:
Load the project again in the UI. Ensure it loads correctly and recalculates the results, for all scenarios.
Inspect the values in the database again and ensure they've been recalculated:
Create a new project and allow its scenarios to save. Refresh the page. Ensure they are loaded correctly.