Skip to content

Commit

Permalink
Fix View Weekly Returns to use end date for filter (#1761)
Browse files Browse the repository at this point in the history
We mistakenly used the start date of a weekly return submission line to determine if they should be included in a month, instead of the end date. This PR fixes this.
  • Loading branch information
StuAA78 authored Feb 28, 2025
1 parent b1273a1 commit 6f11e96
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function go(returnSubmission, yearMonth) {

const [requestedYear, requestedMonth] = _determineRequestedYearAndMonth(yearMonth)
const requestedMonthLines = returnSubmissionLines.filter(
(line) => line.startDate.getFullYear() === requestedYear && line.startDate.getMonth() === requestedMonth
(line) => line.endDate.getFullYear() === requestedYear && line.endDate.getMonth() === requestedMonth
)

const method = returnSubmission.$method()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,12 +268,12 @@ describe('View Return Submissions presenter', () => {
expect(headers).to.include('Week ending')
})

it('includes the expected rows that start within the month', () => {
it('includes the expected rows that end within the month', () => {
const result = ViewReturnSubmissionPresenter.go(testReturnSubmission, '2025-3')

expect(result.tableData.rows.length).to.equal(4)
expect(result.tableData.rows[0]).to.include({ date: '12 April 2025' })
expect(result.tableData.rows[3]).to.include({ date: '3 May 2025' })
expect(result.tableData.rows[0]).to.include({ date: '5 April 2025' })
expect(result.tableData.rows).to.not.include({ date: '3 May 2025' })
})
})
})
Expand Down

0 comments on commit 6f11e96

Please sign in to comment.