bcgov / NRPTI

Natural Resources Public Transparency Initiative
Apache License 2.0
5 stars 15 forks source link

[FIX] Implement a better fix for the issuingAgency check in the business-logic-manager #1258

Open acatchpole opened 1 month ago

acatchpole commented 1 month ago

Describe the task

1239 describes a bug where Administrative Penalty records were being improperly redacted. The check to see if the issuing agency was one that was allowed to publish non-redacted records was faulty. It was often comparing the actual agency name to a list of agency codes. A function to get the agencyCode from the name was created. As it needed to look up values from the db, it was created as an async function. This created its own complications as it required many of the upstream functions to also be converted to async. Ultimately, the original refactoring effort was unsuccessful. While the records were no longer being improperly redacted, an error was being generated that made it so the record could not be saved. This error was not able to be addressed in a timely manner, so a bandaid fix was implemented. A synchronous version of the function was created that used hardcoded values instead of db lookup.

Purpose The entire reason for agencyCodes is that sometimes agency names change or new agencies can be added. The bandaid function will eventually become out of date and some records will be improperly redacted.

Acceptance Criteria

Additional context