Did a staff really write this?
Let's look at the amount of loops, we can get passed / failed students in one reduce method, this reduce method could also process the student details instead of mapping them then mapping them again.... this is just.... a lot of loops
```
// Filter passed and failed students and process them
const { passedStudents, failedStudents, allDetails } = students.reduce<Record<string, ProcessedStudentDetails[]>>((acc, student) => {
acc = {
...acc,
allDetails: [...acc.allDetails, processStudentDetail(student)]
}
if (student.results.some(result => passingGrade(result.grade))) {
acc = {
...acc,
passedStudents: [...acc.passedStudents, processStudentDetail(student)]
}
}
if (student.results.every(result => !passingGrade(result.grade))) {
acc = {
...acc,
failedStudents: [...acc.failedStudents, processStudentDetail(student)]
}
}
return acc;
}, { passedStudents: [], failedStudents:[], allDetails: []})
```
Testing this in the console the one reduce method has a run time of 0.111 ms and the original code runs for 0.302