Skip to content

Commit

Permalink
Use await before converting to IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
Ell1ott committed Apr 12, 2024
1 parent ded56df commit 36a9f20
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions routes/assignments.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,17 +132,18 @@ router.post("/:id/deploy", async function (req, res, next) {

// Create assignment answers for all students in assigned groups
const assigned_groups = deployed_assignment.asigned_groups_ids;
const students_ids = await prisma.user_group
.findMany({
where: {
groupId: {
in: assigned_groups,
},
const students_groups = await prisma.user_group.findMany({
where: {
groupId: {
in: assigned_groups,
},
})
.map((g) => g.userId);
},
});

students_ids = [...students_ids, ...deployed_assignment.asigned_users_ids];
students_ids = [
...students_ids.map((g) => g.userId),
...deployed_assignment.asigned_users_ids,
];
// Filter out duplicates
const unique_students_ids = students_ids.filter(
(v, i, a) => a.findIndex((t) => t === v) === i
Expand Down

0 comments on commit 36a9f20

Please sign in to comment.