Added tutor filtering?

This commit is contained in:
neviyn 2018-09-27 16:45:26 +01:00
parent 8a9a28c782
commit 1ef05d3822

View File

@ -40,6 +40,9 @@ public class ObservationDao extends AbstractDAO<Observation> {
if (site != null) {
predicates.add(builder.equal(root.get("site"), site));
}
if (tutor != null) {
predicates.add(builder.equal(root.join("tutors"), tutor));
}
if (startDate != null) {
predicates.add(builder.greaterThanOrEqualTo(root.get("date"), startDate));
}
@ -67,7 +70,6 @@ public class ObservationDao extends AbstractDAO<Observation> {
* @param whom Restrict to a particular person/group who was observed.
* @return Average observation scores per day.
*/
// TODO: Add tutor filter
public List<AverageStats> averageStats(Site site, Tutor tutor, DateTime startDate, DateTime endDate, String whom) {
CriteriaBuilder builder = currentSession().getCriteriaBuilder();
CriteriaQuery<AverageStats> criteriaQuery = builder.createQuery(AverageStats.class);
@ -80,6 +82,9 @@ public class ObservationDao extends AbstractDAO<Observation> {
if (site != null) {
predicates.add(builder.equal(root.get("site"), site));
}
if (tutor != null) {
predicates.add(builder.equal(root.join("tutors"), tutor));
}
if (startDate != null) {
predicates.add(builder.greaterThanOrEqualTo(root.get("date"), startDate));
}