Skip to content

Commit

Permalink
Bug fix EYB lead audit log is_high_value null to boolean (#7571)
Browse files Browse the repository at this point in the history
  • Loading branch information
stuart-mindt authored Feb 20, 2025
1 parent 3e4cc60 commit 022d047
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/client/modules/Investments/EYBLeads/transformers.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ export const transformLeadToListItem = ({
}

const getLatestIsHighValueChange = (auditLog) => {
const highValueChanges = getLowHighValueAuditLog(auditLog)
const highValueChanges = getLowHighValueAuditLog(auditLog).filter(
(entry) =>
entry.changes.is_high_value[0] !== null &&
entry.changes.is_high_value[1] !== null
) // Exclude null values
if (highValueChanges.length === 0) return null

const latestChange = highValueChanges.reduce((latest, entry) =>
Expand Down
9 changes: 8 additions & 1 deletion test/functional/cypress/specs/investments/eyb-leads-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ const EYB_LEAD_LIST = Array(
triage_created: DATE_TIME_STRING,
is_high_value: false,
audit_log: [
{
id: 356,
timestamp: '2025-02-18T09:00:20.773368Z',
changes: {
is_high_value: [null, false],
},
},
{
id: 777,
timestamp: '2025-02-17T09:00:20.773368Z',
Expand Down Expand Up @@ -284,7 +291,7 @@ describe('EYB leads collection page', () => {
.eq(3)
.should(
'contain',
`Value modified on ${formatDate(eybLeadWithAuditDataHighToLowValue.audit_log[0].timestamp, DATE_FORMAT_COMPACT)}`
`Value modified on ${formatDate(eybLeadWithAuditDataHighToLowValue.audit_log[1].timestamp, DATE_FORMAT_COMPACT)}`
)
.should('contain', `Value change High to Low`)

Expand Down

0 comments on commit 022d047

Please sign in to comment.