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

Update view return version to include mod log info #1261

Merged
merged 18 commits into from
Aug 21, 2024

Conversation

rvsiyad
Copy link
Contributor

@rvsiyad rvsiyad commented Aug 16, 2024

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

With the information around modLog in WRLS, we intend to display it on the new licence history page. The information being shown on the history page is the same as what is being displayed on the return version page. So we should update it to use mod log information to make the page more accurate.

This PR will incorporate the modLog information into the return version page.

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

With the information around modLog in WRLS, we intend to display it in the
new [licence history page](https://eaflood.atlassian.net/browse/WATER-4566). This
information being showed on the history page is the same as what is being displayed
on the return version page. So we should update it to use mod log info to make
the page more accurate.

This PR will incorporate the modLog information into the return version page.
@rvsiyad rvsiyad added the housekeeping Refactoring, tidying up or other work which supports the project label Aug 16, 2024
@rvsiyad rvsiyad self-assigned this Aug 16, 2024
@rvsiyad rvsiyad marked this pull request as ready for review August 16, 2024 13:18
@rvsiyad rvsiyad requested review from Cruikshanks and removed request for Cruikshanks August 16, 2024 13:19
@rvsiyad rvsiyad marked this pull request as draft August 16, 2024 13:28
Cruikshanks added a commit that referenced this pull request Aug 18, 2024
https://eaflood.atlassian.net/browse/WATER-4563
https://eaflood.atlassian.net/browse/WATER-4564
https://eaflood.atlassian.net/browse/WATER-4565

> Part of the work to display a licence's history to users (mod log)

Now we have a table to hold the imported NALD mod log records we need a model to access it, and relationships to access the mod logs from charge, licence, and return versions.

Once added and linked we can then complete our work to expose this information, for example.

- [Build new licence history page](#1182)
- [Update view return version to include mod log info](#1261)
@Cruikshanks Cruikshanks mentioned this pull request Aug 18, 2024
Cruikshanks added a commit that referenced this pull request Aug 18, 2024
https://eaflood.atlassian.net/browse/WATER-4563
https://eaflood.atlassian.net/browse/WATER-4564
https://eaflood.atlassian.net/browse/WATER-4565

> Part of the work to display a licence's history to users (mod log)

Now that we have a table to hold the imported NALD mod log records, we need a model to access it and relationships to access the mod logs from charge, licence, and return versions.

Once added and linked, we can complete our work to expose this information, for example.

- [Build new licence history page](#1182)
- [Update view return version to include mod log info](#1261)
Cruikshanks added a commit that referenced this pull request Aug 19, 2024
https://eaflood.atlassian.net/browse/WATER-4560

> Part of the work to display NALD mod log records as history in WRLS

So, we are now importing mod logs from NALD and have added a model linked to charge, licence and return version models to allow us to retrieve them from the database.

We are in the process of building [a new licence history page](#1182) and [Updating view return version to include mod log info](#1261). These are 2 places that will need to display the same 'history' attributes, for example, when the record was created and who by, in two different places.

Because of this we believe there is value in adding a modifier and instance method to the `ReturnVersionModel` that will handle fetching the mod logs and determining this information.

This change updates the `ReturnVersionModel` with these properties. This will also form a pattern we'll apply to `LicenceVersionModel` and `ChargeVersionModel` in later changes.
Cruikshanks added a commit that referenced this pull request Aug 19, 2024
https://eaflood.atlassian.net/browse/WATER-4560

> Part of the work to display NALD mod log records as history in WRLS

So, we are now importing mod logs from NALD and have added a model linked to charge, licence and return version models to allow us to retrieve them from the database.

We are in the process of building [a new licence history page](#1182) and [Updating view return version to include mod log info](#1261). These two places will need to display the same 'history' attributes, for example, when the record was created and who created it.

Because of this, we believe adding a modifier and instance methods to the `ReturnVersionModel` that will handle fetching the mod logs and determining this information is valuable.

This change updates the `ReturnVersionModel` with these properties. In later changes, this will also form a pattern we'll apply to `LicenceVersionModel` and `ChargeVersionModel`.
Cruikshanks added a commit that referenced this pull request Aug 20, 2024
https://eaflood.atlassian.net/browse/WATER-4634

In this instance we felt it was more constructive to provide the feedback for the original [Update view return version to include mod log info](#1261) proposed PR as a series of commits from where the code has been left.

This can be used to guide suggested changes, hopefully with better context than just PR comments.
Cruikshanks and others added 2 commits August 21, 2024 11:03
Alan's suggested updates

* Reverting presenter test with tweaks

I think because of the churn that has gone on with mod logs whilst trying to pull together this PR, changes have been made to the presenter tests that are not really needed.

Plus, we can create model instances from an Object, avoiding the need to create 'fake' versions of methods. So, we revert this test file pretty much back to its original state, before then fixing and expanding the tests.

* Housekeeping - remove redundant describe

Made me keep putting the `only()` in the wrong place.

* Fix the tests I broke switching to a model

I'd overlooked switching to using an actual model instance rather than just an object would mean ensuring we have model instances all the way down!

* Properly handle all reason scenarios

The notes explain what the scenarios are we need to cover.

* Expand reason tests

We are not looking to retest what is already covered by the model. But we do want to test every scenario our presenter may face. Plus this serves as a handy way to document all the possible outcomes we may get from the presenter.

* Move createdBy to a function

IMHO I think this cleans up what is happening in the go(). It also avoids doing the same 'work' twice. `$createdBy` gives us a result which it is then on the presenter to determine what to do with it.

* Remove new date wrapper

I don't think we need this any more. Did some testing and all seemed fine.

* Remove escape

Calling a macro appears to be different to a function or filter. Nunjucks interprets the value differently so we don't need to pass it to the `escape` filter.

* Revert change to seeder

It was fine as a one liner!

* Tweak to the helper function

We can revert the beforeEach back to what it was now we have a better idea of how the helper function can work.

* Revert changes to view service test then tweak

We can apply the same tweaks we did to view presenter test to get this passing again with the minimum of changes.
@rvsiyad rvsiyad marked this pull request as ready for review August 21, 2024 10:05
@rvsiyad rvsiyad requested a review from Cruikshanks August 21, 2024 10:05
@rvsiyad rvsiyad merged commit f4f78f2 into main Aug 21, 2024
6 checks passed
@rvsiyad rvsiyad deleted the update-view-return-version-to-use-modLog branch August 21, 2024 10:22
Cruikshanks added a commit that referenced this pull request Aug 21, 2024
https://eaflood.atlassian.net/browse/WATER-4639

> Part of the work to display a licence's history to users (mod log)

In [Update view return version to include mod log info](#1261) we update the view return version page to include details taken from a return version's mod log history.

But you access that from the table 'Requirements for returns' on the view licence page's setup tab. We've not incorporated pulling missing details from the return version history there which means they are now out of sync.

This change updates how we generate the page data to include the same information we show when you click through to the view return version page.
Cruikshanks added a commit that referenced this pull request Aug 21, 2024
https://eaflood.atlassian.net/browse/WATER-4639

> Part of the work to display a licence's history to users (mod log)

In [Update view return version to include mod log info](#1261), we update the view return version page to include details taken from a return version's mod log history.

You access that from the table 'Requirements for returns' on the view licence page's setup tab. We haven't incorporated pulling missing details from the return version history there, which means they are now out of sync.

This change updates how we generate the page data to include the same information we show when you click through to the view return version page.
Cruikshanks added a commit that referenced this pull request Aug 21, 2024
https://eaflood.atlassian.net/browse/WATER-4640

> Part of the work to display a licence's history to users (mod log)

In [Update view return version to include mod log info](#1261), we updated the view return version page to include details taken from a return version's mod log history.

Then in [Update return versions table with reasons in view](#1281) we updated the table of return requirements in the view licence setup tab to display the mod log reason for return versions without a mapping.

The final place we display return version reasons is the 'Use previous requirements for returns' page in the return version set up journey.

This change updates the logic so for return versions without a reason but that have a mod log with a reason, we use its description.
Cruikshanks added a commit that referenced this pull request Aug 21, 2024
https://eaflood.atlassian.net/browse/WATER-4640

> Part of the work to display a licence's history to users (mod log)

In [Update view return version to include mod log info](#1261), we updated the view return version page to include details taken from a return version's mod log history.

Then, in [Update return versions table with reasons in view](#1281), we updated the table of return requirements in the view licence setup tab to display the mod log reason for return versions without a mapping.

The final place we display return version reasons is the 'Use previous requirements for returns' page in the return version set-up journey.

This change updates the logic for return versions without a reason but that have a mod log with a reason: we use its description.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
housekeeping Refactoring, tidying up or other work which supports the project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants