icefoganalytics / elcc-data-management

Data Management application for Education's Early Learning Child Centre
Apache License 2.0
0 stars 0 forks source link

Refactor: Improve Readability of Month Worksheet Code #57

Closed klondikemarlen closed 11 months ago

klondikemarlen commented 11 months ago

Context

Current Child Care Center worksheets tab code is extremely hard to read. This PR should break the code out into several components and make each tab loadable via url params.

Implementation

Make worksheet tabs loadable from URL e.g. http://localhost:8080/child-care-centres/1/worksheets/june. Only load the specific worksheet for the given month instead of all worksheets for the center. Ensure consistent ordering or worksheets/FundingSubmissionLineJsons via back-end query order.

Did not add fiscal year to the url path as this was too large a change at this time. Did not optimize funding submission line json index fetch for the same reason. The index action should likely not return the json "values" column.

Screenshots

image

Zero worksheets image

Testing Instructions

  1. Boot the app via dev up
  2. Check that the app complies, and that you can log in at http://localhost:8080.
  3. Check that after login you can go directly to http://localhost:8080/child-care-centres/1/worksheets/april.
  4. Delete everything from the funding_submission_line_jsons table and refresh the page.
  5. You should see the no worksheets prompt.
  6. Add some worksheets.
  7. Once the worksheet resolves it will select "April"; the first month.
  8. Edit some content in section 1 of the sheet, and note that it propagates to sections 2 and 3.
  9. Save the sheet and check that the content persists after a refresh.
  10. Click the "replicate estimates" button and check that the "April" content propagates to the other months.
  11. Note that the the tabs load much more quickly than before. The current code isn't very well optimized, but at least its loading one sheet per page, and only rendering the current tab.
  12. Check that you can edit other sheets. e.g July.
  13. When you are on the July sheet, reload the page. Note that after a delay, it loads "July" after page refresh instead of going back to "April".
  14. Click on the "Worksheets" tab, and note that you are redirected to the first month, April, when a month is not specified.
  15. Switch the fiscal year and create some worksheets.
  16. Switch back to the previous fiscal year and notice that the page component refresh is very quick. This is because we are performing a fetch against a single worksheet, and only reloading the innermost tab content.