{subjectEntries.map(([subject, items]) => {
// 单次遍历分桶,避免重复 filter(PERF-05)
const answered: StudentHomeworkAssignmentListItem[] = []
const unanswered: StudentHomeworkAssignmentListItem[] = []
for (const a of items) {
if (isAnswered(a.progressStatus)) {
answered.push(a)
} else {
unanswered.push(a)
}
}
return (
{subject}
{unanswered.length > 0 && (
Pending
{unanswered.map((a) => (
))}
)}
{answered.length > 0 && (
Completed
{answered.map((a) => (
))}
)}
)
})}
)}
>
)
}