Skip to content

Commit

Permalink
fix: Removed parsing on database value for status. Added label
Browse files Browse the repository at this point in the history
  • Loading branch information
rijuma committed Sep 13, 2024
1 parent b917d40 commit 11b6bea
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
17 changes: 5 additions & 12 deletions src/users/VerifiedName.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,6 @@ const verifiedNameHistoryColumns = [
},
];

// Human readable formatter for the status. Possible status list on:
// https://github.com/edx/edx-solutions-edx-platform/blob/0ebc69f86548a44b7947decfe308032028721907/lms/djangoapps/verify_student/models.py#L104
const idvStatusFormat = status => {
// Capitalize first letter
const properStatus = `${status.at(0).toUpperCase()}${status?.slice(1)}`;

// Replace underscores with spaces
return properStatus.replace('_', ' ');
};

export default function VerifiedName({ username }) {
const [verifiedNameData, setVerifiedNameData] = useState(null);
const [verifiedNameHistoryData, setVerifiedNameHistoryData] = useState([]);
Expand Down Expand Up @@ -100,9 +90,12 @@ export default function VerifiedName({ username }) {
trigger="hover"
overlay={(
<Popover id={`${result.verificationAttemptId}-details-tooltip`} aria-hidden="true">
<Popover.Title data-testid="verificationAttemptTooltipTitle">
{result.verificationAttemptStatus ? idvStatusFormat(result.verificationAttemptStatus) : 'Missing data'}
<Popover.Title as="h3">
Status
</Popover.Title>
<Popover.Content data-testid="verificationAttemptTooltipTitle">
{result.verificationAttemptStatus ? result.verificationAttemptStatus : 'Error: Missing data'}
</Popover.Content>
</Popover>
)}
>
Expand Down
2 changes: 1 addition & 1 deletion src/users/VerifiedName.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,6 @@ describe('Verified Name', () => {

await screen.getByTestId('verificationAttemptTooltipTitle');

expect(screen.getByText('Must retry')).toBeTruthy();
expect(screen.getByText('must_retry')).toBeTruthy();
});
});

0 comments on commit 11b6bea

Please sign in to comment.