Skip to content

Commit

Permalink
Merge pull request #1051 from US-Trustee-Program/CAMS-488-change-hist…
Browse files Browse the repository at this point in the history
…ory-bug

CAMS-488 corrected the value operator for assignmentHistory
  • Loading branch information
amorrow-flexion authored Nov 29, 2024
2 parents d56bcf2 + e479d10 commit b11f930
Showing 1 changed file with 26 additions and 12 deletions.
38 changes: 26 additions & 12 deletions user-interface/src/case-detail/panels/CaseDetailAuditHistory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
} from '@common/cams/history';
import { useEffect, useState } from 'react';
import Api2 from '@/lib/models/api2';
import { CaseAssignment } from '@common/cams/assignments';

export interface CaseDetailAuditHistoryProps {
caseId: string;
Expand Down Expand Up @@ -42,20 +43,26 @@ export default function CaseDetailAuditHistory(props: CaseDetailAuditHistoryProp
<tr key={idx}>
<td>Staff</td>
<td data-testid={`previous-assignment-${idx}`}>
{history.before.length === 0 && <>(none)</>}
{history.before
.map((assignment) => {
return assignment.name;
})
.join(', ')}
{assignmentHistoryHasValue(history.before) ? (
history.before
.map((assignment) => {
return assignment.name;
})
.join(', ')
) : (
<>(none)</>
)}
</td>
<td data-testid={`new-assignment-${idx}`}>
{history.after.length === 0 && <>(none)</>}
{history.after
.map((assignment) => {
return assignment.name;
})
.join(', ')}
{assignmentHistoryHasValue(history.after) ? (
history.after
.map((assignment) => {
return assignment.name;
})
.join(', ')
) : (
<>(none)</>
)}
</td>
<td data-testid={`changed-by-${idx}`}>
{history.updatedBy && <>{history.updatedBy.name}</>}
Expand Down Expand Up @@ -90,6 +97,13 @@ export default function CaseDetailAuditHistory(props: CaseDetailAuditHistoryProp
</tr>
);
}
function assignmentHistoryHasValue(assignmentHistory: CaseAssignment[] | null): boolean {
let noValue = true;
if (assignmentHistory === null || assignmentHistory.length === 0) {
noValue = false;
}
return noValue;
}

function renderCaseHistory() {
return caseHistory.map((history, idx: number) => {
Expand Down

0 comments on commit b11f930

Please sign in to comment.