From 0def3c7764d72829ca16b35282ce402366db1e3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chif=20Gerg=C5=91?= <chifgeri97@gmail.com> Date: Sun, 24 Feb 2019 20:49:19 +0100 Subject: [PATCH] Fix wrong method to select accepted homeworks --- src/components/forms/SolutionDetailsForm.js | 30 ++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/components/forms/SolutionDetailsForm.js b/src/components/forms/SolutionDetailsForm.js index f702c51..005cd93 100644 --- a/src/components/forms/SolutionDetailsForm.js +++ b/src/components/forms/SolutionDetailsForm.js @@ -25,22 +25,22 @@ class SolutionDetailsForm extends Component { const noAcceptStudents = []; const acceptedStudents = []; - for (let i = 0; i < this.props.homeworks.profiles.length; i += 1) { - const profileSolutions = taskSolutions.filter(solution => - solution.created_by === this.props.homeworks.profiles[i].id); + this.props.homeworks.profiles.forEach((profile) => { + const profileSolutions = taskSolutions.filter(solution => + solution.created_by === profile.id); - if (this.props.homeworks.profiles[i].role === 'Student') { - if (profileSolutions.length === 0) { - noSubmitStudents.push(this.props.homeworks.profiles[i]); - } else if (taskSolutions[taskSolutions.length - 1].corrected === false) { - waitForCorrectionStudents.push(this.props.homeworks.profiles[i]); - } else if (taskSolutions[taskSolutions.length - 1].accepted === false) { - noAcceptStudents.push(this.props.homeworks.profiles[i]); - } else { - acceptedStudents.push(this.props.homeworks.profiles[i]); - } - } - } + if (profile.role === 'Student') { + if (profileSolutions.length === 0) { + noSubmitStudents.push(profile); + } else if (profileSolutions[profileSolutions.length - 1].corrected === false) { + waitForCorrectionStudents.push(profile); + } else if (profileSolutions[profileSolutions.length - 1].accepted === false) { + noAcceptStudents.push(profile); + } else { + acceptedStudents.push(profile); + } + } + }); const emptyStudentText = 'Nincs ilyen kĂŠpzĹdĹ jelenleg.'; -- GitLab