Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle soft deleted workflow in supp. billing #213

Merged
merged 5 commits into from
May 5, 2023

Conversation

Cruikshanks
Copy link
Member

@Cruikshanks Cruikshanks commented May 5, 2023

https://eaflood.atlassian.net/browse/WATER-3999

In Licences in Workflow should not be considered we changed our FetchChargeVersionsService to exclude any charge version that was in the charge_version_workflows table. It was identified as a requirement that anything in 'workflow' should not be considered for billing.

When we tested we saw that when adding a charge version, for example, a charge_version_workflow record is created. Once the charge version gets approved the workflow record gets deleted. This is the same behaviour we have noted elsewhere.

But, during UAT it was noted there were licences (charge versions) not being picked up for supplementary billing which when checking the workflow screen were not displayed. Some digging found the reason.

Workflow records have a 'status'; to_setup or review (there is also changes_requested but we've not seen evidence of its use). We don't understand how the to_set_up records get added (probably during the import process). But review appears when you add a new charge version.

After some testing, we've found that if you click the 'Set up' link on the entry in a licence's charge versions, it changes the workflow's status from to_setup to review. When your charge version gets approved the workflow record gets deleted.

But, this is where our work has come undone! If you click the 'Remove' link all the service does is update the workflow's date_deleted column. It doesn't delete the record 😮😩

We don't know why they are handled differently. But we must account for these 'soft-deleted' workflow records in FetchChargeVersionsService.

Screenshot of setup entry

Screenshot 2023-05-05 at 11 50 37

https://eaflood.atlassian.net/browse/WATER-3999

In [Licences in Workflow should not be considered](#176) we made a change to our `FetchChargeVersionsService` to exclude any charge version that was in the `charge_version_workflows` table. It was identified as a requirement that anything in 'workflow' should not be considered for billing.

When we tested we saw that when adding a charge version, for example, a `charge_version_workflow` record is created. Once the charge version gets approved the workflow record gets deleted. This is the same behaviour we have noted elsewhere.

But, during UAT it was noted there were licences (charge versions) not being picked up for supplementary billing which when checking the workflow screen were not displayed. Some digging found the reason.

Workflow records have a 'status'; `to_setup` or `review` (there is also `changes_requested` but we've not seen evidence of its use). We don't understand _how_ the `to_set_up` records get added (probably during the import process). But `review` appears when you add a new charge version.

After some testing we've found that if you click the 'Set up' link on the entry in a licence's charge versions, it changes the workflow's status from `to_setup` to `review`. When you charge version gets approved the workflow record gets deleted.

But, and this is where our work has come undone! If you click the 'Remove' link all the service does is update the workflow's `date_deleted` column. It doesn't delete the record 😮😩

We don't know why they are handled differently. But we need to account for these 'soft-deleted' workflow records in `FetchChargeVersionsService`.
@Cruikshanks Cruikshanks added the enhancement New feature or request label May 5, 2023
@Cruikshanks Cruikshanks self-assigned this May 5, 2023
@Cruikshanks Cruikshanks marked this pull request as ready for review May 5, 2023 13:56
Copy link
Contributor

@StuAA78 StuAA78 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me other than one place in the unit tests where we could destructure licenceId (as we did prior to the test changes)

Co-authored-by: Stuart Adair <[email protected]>
@Cruikshanks Cruikshanks requested a review from StuAA78 May 5, 2023 14:07
Copy link
Contributor

@Jozzey Jozzey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Cruikshanks Cruikshanks merged commit f9f3eb3 into main May 5, 2023
@Cruikshanks Cruikshanks deleted the handle-soft-deleted-workflow-records branch May 5, 2023 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants