Skip to content

Commit

Permalink
Add help text for unknown students (#6382)
Browse files Browse the repository at this point in the history
  • Loading branch information
acelaya authored Jun 21, 2024
1 parent 2ffe597 commit f0f0c22
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,29 @@ export default function AssignmentActivity() {
]}
defaultOrderField="display_name"
renderItem={(stats, field) => {
if (['annotations', 'replies'].includes(field)) {
return <div className="text-right">{stats[field]}</div>;
} else if (field === 'last_activity') {
return stats.last_activity
? formatDateTime(new Date(stats.last_activity))
: '';
switch (field) {
case 'annotations':
case 'replies':
return <div className="text-right">{stats[field]}</div>;
case 'last_activity':
return stats.last_activity
? formatDateTime(new Date(stats.last_activity))
: '';
case 'display_name':
return (
stats.display_name ?? (
<span className="flex flex-col gap-1.5">
<span className="italic">Unknown</span>
<span className="text-xs text-grey-7">
This student launched the assignment but didn{"'"}t
annotate yet
</span>
</span>
)
);
default:
return '';
}

return stats[field] ?? `Student ${stats.id.substring(0, 10)}`;
}}
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ describe('AssignmentActivity', () => {
fieldName: 'last_activity',
expectedValue: formatDateTime(new Date('2024-01-01T10:35:18')),
},
// Render "unknown" field name
{ fieldName: 'id', expectedValue: '' },
// Render last_activity when it's null
{
fieldName: 'last_activity',
Expand All @@ -137,7 +139,8 @@ describe('AssignmentActivity', () => {
// Render display_name when it's null
{
fieldName: 'display_name',
expectedValue: 'Student e4ca30ee27',
expectedValue:
"UnknownThis student launched the assignment but didn't annotate yet",
studentStats: {
id: 'e4ca30ee27eda1169d00b83f2a86e3494ffd9b12',
display_name: null,
Expand Down

0 comments on commit f0f0c22

Please sign in to comment.