Skip to content

Commit

Permalink
BC-6423 - fix submissions after creator deletion (#3403)
Browse files Browse the repository at this point in the history
* fix submissions after deletion creatorId

* fix in homework

* remove consolelog

---------

Co-authored-by: Bartosz Nowicki <116367402+bn-pass@users.noreply.github.com>
  • Loading branch information
WojciechGrancow and bn-pass authored Feb 15, 2024
1 parent cea94d8 commit 5c55860
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions controllers/homework.js
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ router.get('/:assignmentId', (req, res, next) => {
if (!assignment.private && (isTeacher || assignment.publicSubmissions)) {
// Daten für Abgabenübersicht
const sortByStudentAttribute = (attr) => (a, b) => ((a.studentId[attr].toUpperCase() < b.studentId[attr].toUpperCase()) ? -1 : 1);
assignment.submissions = submissions.data.filter((submission) => submission.studentId)
assignment.submissions = submissions.data
.sort(sortByStudentAttribute('firstName'))
.sort(sortByStudentAttribute('lastName'))
.map((sub) => {
Expand All @@ -668,8 +668,7 @@ router.get('/:assignmentId', (req, res, next) => {
});
const studentSubmissions = students.map((student) => ({
student,
submission: assignment.submissions.filter((submission) => (submission.studentId._id == student._id)
|| (submission.teamMembers?.includes(student._id.toString())))[0],
submission: assignment.submissions.filter((submission) => (submission.teamMemberIds?.includes(student._id.toString())))[0],
}));

let studentsWithSubmission = [];
Expand Down

0 comments on commit 5c55860

Please sign in to comment.