Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bill history caused by edited licence in NALD
https://eaflood.atlassian.net/browse/WATER-4800 After spotting that WRLS is carrying a lot of data that no longer exists in NALD because it has been deleted, we have started a series of tasks to 'clean up' WRLS licence data. One of the scenarios we face is a licence deleted in NALD but linked to a 'sent' bill run in WRLS (see WATER-4734 for more details). Our queries highlighted `MD/0280003/012`` as one of two licences we found in this state. After some digging, we connected the dots and realised that `MD/0280003/012` and `MD/028/0003/012` were the same licence. Things have broken in WRLS because the licence number has been amended in NALD, resulting in two WRLS records. `MD/0280003/012` is seen by WRLS as a deleted licence because there is no NALD record with the same licence number. The problem is that it was only amended in NALD, so our import process has re-linked all its child records (versions, purposes, points, etc.) to the WRLS `MD/028/0003/012` record. This leaves `MD/0280003/012` as purely a 'header' record. For example, the licence summary has very little detail because it has no child records from which to extract the data it needs. Leaving the licence in this state puts the service at risk. When we code, we must make assumptions to avoid going our logic getting out of hand. One assumption is that every licence has at least one version with one purpose and point. The solution in this case is to link the existing bill and bill licence records to `MD/028/0003/012` and the billing account associated to it, because if this hadn't happened they would have been created against it in the first place. The business have also asked we record a note explaining what has happened (content provided by them).
- Loading branch information