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

Do not display draft return versions in set up #1298

Merged
merged 2 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading