fixed exam filter

This commit is contained in:
anhefti 2019-04-04 11:20:44 +02:00
parent 8278f3f43d
commit 95af203dde
4 changed files with 5 additions and 7 deletions

View file

@ -30,7 +30,6 @@ public final class Exam implements GrantEntity, Activatable {
public static final String ATTR_STATUS = "examStatus";
public static final String FILTER_ATTR_TYPE = "type";
public static final String FILTER_ATTR_FROM = "from";
public enum ExamStatus {
UP_COMING,

View file

@ -179,9 +179,9 @@ public class QuizDiscoveryList implements TemplateComposer {
private PageAction importQuizData(final PageAction action, final EntityTable<QuizData> table) {
final QuizData selectedROWData = table.getSelectedROWData();
if (selectedROWData.endTime != null) {
if (selectedROWData.startTime != null) {
final DateTime now = DateTime.now(DateTimeZone.UTC);
if (selectedROWData.endTime.isBefore(now)) {
if (selectedROWData.startTime.isBefore(now)) {
throw new PageMessageException(NO_IMPORT_OF_OUT_DATED_QUIZ);
}
}

View file

@ -18,7 +18,6 @@ import ch.ethz.seb.sebserver.gbl.model.exam.Exam;
import ch.ethz.seb.sebserver.gbl.model.exam.Indicator;
import ch.ethz.seb.sebserver.gbl.model.exam.QuizData;
import ch.ethz.seb.sebserver.gbl.model.institution.LmsSetup;
import ch.ethz.seb.sebserver.gbl.model.institution.SebClientConfig;
import ch.ethz.seb.sebserver.gbl.model.user.UserInfo;
import ch.ethz.seb.sebserver.gbl.util.Utils;
@ -79,11 +78,11 @@ public class FilterMap extends POSTMapper {
}
public DateTime getExamFromTime() {
return Utils.toDateTime(getString(Exam.FILTER_ATTR_FROM));
return Utils.toDateTime(getString(QuizData.FILTER_ATTR_START_TIME));
}
public DateTime getSebClientConfigFromTime() {
return Utils.toDateTime(getString(SebClientConfig.FILTER_ATTR_FROM));
return getQuizFromTime();
}
public Long getLmsSetupId() {

View file

@ -100,7 +100,7 @@ public class ExamDAOImpl implements ExamDAO {
return Result.tryCatch(() -> {
final String name = filterMap.getName();
final String name = filterMap.getQuizName();
final DateTime from = filterMap.getExamFromTime();
final Predicate<Exam> quizDataFilter = exam -> {
if (StringUtils.isNoneBlank(name)) {