SEBSERV-430 fixed

This commit is contained in:
anhefti 2023-04-06 14:44:45 +02:00
parent 21dbab0a65
commit a7d6370305
4 changed files with 19 additions and 10 deletions

View file

@ -78,6 +78,10 @@ public class POSTMapper {
}
}
public boolean contains(final String name) {
return this.params.containsKey(name);
}
private String decode(final String val) {
try {
return Utils.decodeFormURL_UTF_8(val);

View file

@ -60,6 +60,13 @@ public class FilterMap extends POSTMapper {
super(params, uriQueryString);
}
public boolean containsAny(final Set<String> extFilter) {
return extFilter.stream()
.filter(this.params::containsKey)
.findFirst()
.isPresent();
}
public Integer getActiveAsInt() {
return getBooleanAsInteger(Entity.FILTER_ATTR_ACTIVE);
}
@ -345,11 +352,4 @@ public class FilterMap extends POSTMapper {
}
}
public boolean containsAny(final Set<String> extFilter) {
return extFilter.stream()
.filter(this.params::containsKey)
.findFirst()
.isPresent();
}
}

View file

@ -33,6 +33,7 @@ import org.springframework.transaction.annotation.Transactional;
import ch.ethz.seb.sebserver.gbl.Constants;
import ch.ethz.seb.sebserver.gbl.api.EntityType;
import ch.ethz.seb.sebserver.gbl.model.Domain;
import ch.ethz.seb.sebserver.gbl.model.exam.Exam;
import ch.ethz.seb.sebserver.gbl.model.exam.Exam.ExamStatus;
import ch.ethz.seb.sebserver.gbl.model.exam.Exam.ExamType;
@ -216,10 +217,14 @@ public class ExamRecordDAO {
or(ExamRecordDynamicSqlSupport.quizEndTime, isNull()));
}
final String nameCriteria = filterMap.contains(QuizData.FILTER_ATTR_NAME)
? filterMap.getSQLWildcard(QuizData.FILTER_ATTR_NAME)
: filterMap.getSQLWildcard(Domain.EXAM.ATTR_QUIZ_NAME);
final List<ExamRecord> records = whereClause
.and(
ExamRecordDynamicSqlSupport.quizName,
isLikeWhenPresent(filterMap.getSQLWildcard(QuizData.FILTER_ATTR_NAME)))
isLikeWhenPresent(nameCriteria))
.build()
.execute();

View file

@ -502,8 +502,8 @@ sebserver.exam.list.column.name=Name
sebserver.exam.list.column.name.tooltip=The name of the exam<br/><br/>Use the filter above to narrow down to a specific exam name<br/>{0}
sebserver.exam.list.column.name.filter.tooltip=Use the filter to narrow down to a specific exam name
sebserver.exam.list.column.starttime=Start Time {0}
sebserver.exam.list.column.starttime.tooltip=The start time of the exam<br/><br/>Use the filter above to set a specific from date<br/>{0}
sebserver.exam.list.column.starttime.filter.tooltip=Use the filter to set a specific from date
sebserver.exam.list.column.starttime.tooltip=The start time of the exam<br/><br/>Use the filter above to filter by date..<br/>Note that this is applied to the date range between start- and end-date and not to the start-date alone.<br/><br/>{0}
sebserver.exam.list.column.starttime.filter.tooltip=Use this to filter by date.<br/>Note that this is applied to the date range between start- and end-date and not to the start-date alone.<br/>Running and up-coming exams are still available as long as the filter date is not in the future.
sebserver.exam.list.column.type=Type
sebserver.exam.list.column.type.tooltip=The type of the exam<br/><br/>Use the filter above to set a specific exam type<br/>{0}
sebserver.exam.list.column.type.filter.tooltip=Use the filter to set a specific exam type