Skip to content

Commit

Permalink
Do not display draft return versions in set up
Browse files Browse the repository at this point in the history
https://eaflood.atlassian.net/browse/WATER-4407

> Part of the work to replace NALD for handling return requirements

When we [started displaying return versions](#1054) in the view licence set up tab we should have excluded those with a 'draft' status.

These have been imported from NALD, but found to have no return requirements which isn't valid in NALD.

A decision will be made on what to do with them once we return requirements has gone live in WRLS. Till then, we just need to ensure they don't appear in this table.
  • Loading branch information
Cruikshanks committed Aug 30, 2024
1 parent aebcfb5 commit 4921d3f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/services/licences/fetch-return-versions.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ async function _fetch (licenceId) {
'reason'
])
.where('licenceId', licenceId)
.whereNot('status', 'draft')
.orderBy([
{ column: 'startDate', order: 'desc' },
{ column: 'version', order: 'desc' }
Expand Down
7 changes: 6 additions & 1 deletion test/services/licences/fetch-return-versions.service.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,19 @@ describe('Fetch Return Versions service', () => {

describe('when the licence has return versions data', () => {
beforeEach(async () => {
// NOTE: We add 2, both with the same start date to ensure the order that they are returned is as expected
// NOTE: We add these 2, both with the same start date to ensure the order that they are returned as expected
supersededReturnVersion = await ReturnVersionHelper.add({
startDate, status: 'superseded', version: 100
})
currentReturnVersion = await ReturnVersionHelper.add({
licenceId: supersededReturnVersion.licenceId, startDate, status: 'current', version: 101
})

// We add this 3rd one with a status of draft to ensure it is not included
await ReturnVersionHelper.add({
licenceId: supersededReturnVersion.licenceId, startDate: new Date('2022-05-01'), status: 'draft', version: 102
})

currentReturnVersionModLog = await ModLogHelper.add({
reasonDescription: 'Record Loaded During Migration', returnVersionId: currentReturnVersion.id
})
Expand Down

0 comments on commit 4921d3f

Please sign in to comment.