Skip to content

assignment filter on requests page shows duplicate assignments

When filtering on assignment on the requests page, the filter list by what I suspect is the following code:

labs.foreach()
    .map(lab -> lab.assignments())
    .flatMap(assignments::stream)
    .collect(Collectors::toList)

if multiple labs have the same assignment, this assignment ends up in the list multiple times. I suggest we remove duplicates from this list, which is hopefully as simple as:

labs.foreach()
    .map(lab -> lab.assignments())
    .flatMap(assignments::stream)
    .distinct()
    .collect(Collectors::toList)
Edited by Otto Visser