bcgov / bcparks-ar-admin

BCParks Attendance and Revenue Admin
Apache License 2.0
4 stars 11 forks source link

[L] Preexisting variance records are missing fields for variance warnings #322

Open cameronpettit opened 3 months ago

cameronpettit commented 3 months ago

The new variance warning visuals (red border and (!) icon with avarages popup) is not working correctly when navigating to a record with a variance that was created before this feature was added.

This is because the new changes require fields that do not exist on preexisting variance records.

We need to update the front-end logic to show variances appropriately when they exist, even on these preexisting records. This may be achieved one of or both of the following ways:

Specifically, a variance record has a fields property that has a list of fields that have triggered a variance. Within one of these fields objects, there are subproperties historicalAverage and yearlyAverages that are missing from preexisting variance objects.

Acceptance Criteria:

Given a variance record existed for an activity before the recent variance warning changes were implemented When an admin navigates to the edit page of that activity Then the variances should show appropriately

Development Checklist:

Wireframe(s):

Workflows:

Definition of Ready (Note: If any of these points are not applicable, mark N/A)

Definition of Done (Note: If any of these points are not applicable, mark N/A)

Notes:

This issue can be temporarily fixed by resaving the record.

Dependencies

cameronpettit commented 3 months ago

@JLWade If you recall, we only calculate variance for records for years 2022 and onward since 2021 and prior data was deemed unusable. Therefore, my migration will only fix variance objects from 2022 and onward.

There may be variance objects in the system for <2022 because they will get created when new data is entered in the admin portal - so if someone were to go back in time and make a change, a variance record would get created. If any variances prior to 2022 existed before we made these variance warning changes, I won't be touching them. I dont foresee that being a huge issue. Any data entry, net-new, will be created with the correct fields, I'm just documenting my decision here for future Cam when he questions present Cam's methods @Dianadec

cameronpettit commented 3 months ago

Migration performed on PROD - unfortunately I don't know which records were affected by this issue beforehand so its difficult to say with certainty that the issue is 100% fixed. I seeded some bad records in DEV and the migration worked successfully there. I've asked Nicole Bottoms (whose GH ID eludes me) to let us know if theres any records that continue to exhibit this weird behaviour.

manuji commented 3 months ago

Tested on TEST: Passed

Image Image

JLWade commented 3 months ago

moving to done