Skip to content
Snippets Groups Projects

Fix division and group import inconsistencies

4 files
+ 66
2
Compare changes
  • Side-by-side
  • Inline

Files

@@ -21,10 +21,12 @@ import static com.querydsl.jpa.JPAExpressions.select;
import static nl.tudelft.labracore.model.QRole.role;
import static nl.tudelft.labracore.model.QStudentGroup.studentGroup;
import java.util.Collection;
import java.util.List;
import nl.tudelft.labracore.model.Module;
import nl.tudelft.labracore.model.ModuleDivision;
import nl.tudelft.labracore.model.Person;
import nl.tudelft.labracore.model.StudentGroup;
import org.springframework.data.jpa.repository.JpaRepository;
@@ -118,6 +120,17 @@ public interface StudentGroupRepository
"StudentGroup was not found for person, module: " + personId + ", " + moduleId));
}
/**
* @param moduleId The id of the module to lookup.
* @param people The people to look for
* @return The groups that contains the given people in the given module.
*/
default List<StudentGroup> findAllByModuleAndPersonIn(Long moduleId, Collection<Person> people) {
BooleanExpression q = studentGroup.module.id.eq(moduleId).and(
studentGroup.members.any().person.in(people));
return findAll(q);
}
/**
* @param personId The id of the person to lookup.
* @param assignmentId The id of the assignment to lookup.
Loading