Skip to content

Commit

Permalink
client: fix alignment of long score feedback (#656)
Browse files Browse the repository at this point in the history
  • Loading branch information
fushar authored Aug 25, 2024
1 parent 9494620 commit 5c6caff
Showing 1 changed file with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,27 @@ export function SubmissionDetails({
};

const renderScore = score => {
let formattedScore = score;

if (score.startsWith('*')) {
return '✓' + score.substring(1);
formattedScore = '✓' + score.substring(1);
} else if (score.startsWith('X')) {
return score.substring(1);
formattedScore = score.substring(1);
}

if (formattedScore.includes(' [')) {
const [points, feedback] = formattedScore.split(' [', 2);
return (
<>
{points}{' '}
<span style="display: inline-block">
{'['}
{feedback}
</span>
</>
);
}

return score;
};

Expand Down

0 comments on commit 5c6caff

Please sign in to comment.