From 71a75bb406d456e05da9ecd04adee4256831e017 Mon Sep 17 00:00:00 2001 From: anhefti Date: Fri, 5 Apr 2019 15:58:59 +0200 Subject: [PATCH] fixed for demo, code cleanup --- .../seb/sebserver/gui/content/ExamForm.java | 23 ++++---- .../seb/sebserver/gui/content/ExamList.java | 40 +++++++------- .../gui/content/InstitutionForm.java | 11 ++-- .../sebserver/gui/content/LmsSetupForm.java | 48 ++++++++-------- .../sebserver/gui/content/LmsSetupList.java | 5 +- .../UserAccountChangePasswordForm.java | 11 ++-- .../gui/content/UserAccountForm.java | 55 ++++++++++--------- .../gui/content/UserAccountList.java | 5 +- .../seb/sebserver/gui/form/FieldBuilder.java | 6 -- .../seb/sebserver/gui/form/FormBuilder.java | 40 +++++++++----- .../seb/sebserver/gui/table/TableBuilder.java | 16 +++++- .../servicelayer/dao/impl/ExamDAOImpl.java | 2 +- src/main/resources/messages.properties | 1 + 13 files changed, 148 insertions(+), 115 deletions(-) diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/ExamForm.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/ExamForm.java index f6de331c..36269bfc 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/ExamForm.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/ExamForm.java @@ -195,12 +195,13 @@ public class ExamForm implements TemplateComposer { "sebserver.exam.form.status", i18nSupport.getText(new LocTextKey("sebserver.exam.status." + examStatus.name()))) .readonly(true)) - .addField(FormBuilder.multiComboSelection( - Domain.EXAM.ATTR_SUPPORTER, - "sebserver.exam.form.supporter", - StringUtils.join(exam.supporter, Constants.LIST_SEPARATOR_CHAR), - this.resourceService::examSupporterResources) - .withCondition(isNotNew)) + .addFieldIf( + isNotNew, + () -> FormBuilder.multiComboSelection( + Domain.EXAM.ATTR_SUPPORTER, + "sebserver.exam.form.supporter", + StringUtils.join(exam.supporter, Constants.LIST_SEPARATOR_CHAR), + this.resourceService::examSupporterResources)) .buildFor(importFromQuizData ? restService.getRestCall(ImportAsExam.class) @@ -267,10 +268,12 @@ public class ExamForm implements TemplateComposer { thresholdColumnKey, ExamForm::thresholdsValue, false)) - .withDefaultAction(actionBuilder - .newAction(ActionDefinition.EXAM_INDICATOR_MODIFY_FROM_LIST) - .withParentEntityKey(entityKey) - .create()) + .withDefaultActionIf( + () -> editable, + () -> actionBuilder + .newAction(ActionDefinition.EXAM_INDICATOR_MODIFY_FROM_LIST) + .withParentEntityKey(entityKey) + .create()) .compose(content); diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/ExamList.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/ExamList.java index 6d0de6f7..fcc1d3c5 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/ExamList.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/ExamList.java @@ -11,6 +11,8 @@ package ch.ethz.seb.sebserver.gui.content; import java.util.function.Function; import org.eclipse.swt.widgets.Composite; +import org.joda.time.DateTime; +import org.joda.time.DateTimeZone; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Component; @@ -18,17 +20,16 @@ import org.springframework.stereotype.Component; 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.Entity; import ch.ethz.seb.sebserver.gbl.model.exam.Exam; 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.user.UserRole; import ch.ethz.seb.sebserver.gbl.profile.GuiProfile; import ch.ethz.seb.sebserver.gui.content.action.ActionDefinition; import ch.ethz.seb.sebserver.gui.service.ResourceService; import ch.ethz.seb.sebserver.gui.service.i18n.I18nSupport; import ch.ethz.seb.sebserver.gui.service.i18n.LocTextKey; import ch.ethz.seb.sebserver.gui.service.page.PageContext; +import ch.ethz.seb.sebserver.gui.service.page.PageMessageException; import ch.ethz.seb.sebserver.gui.service.page.PageService; import ch.ethz.seb.sebserver.gui.service.page.PageService.PageActionBuilder; import ch.ethz.seb.sebserver.gui.service.page.TemplateComposer; @@ -60,8 +61,9 @@ public class ExamList implements TemplateComposer { new LocTextKey("sebserver.exam.list.column.name"); private final static LocTextKey columnTitleTypeKey = new LocTextKey("sebserver.exam.list.column.type"); + private final static LocTextKey noModifyOfOutDatedExams = + new LocTextKey("sebserver.exam.list.modify.out.dated"); - private final TableFilterAttribute institutionFilter; private final TableFilterAttribute lmsFilter; private final TableFilterAttribute nameFilter = new TableFilterAttribute(CriteriaType.TEXT, QuizData.FILTER_ATTR_NAME); @@ -77,11 +79,6 @@ public class ExamList implements TemplateComposer { this.resourceService = resourceService; this.pageSize = (pageSize != null) ? pageSize : 20; - this.institutionFilter = new TableFilterAttribute( - CriteriaType.SINGLE_SELECTION, - Entity.FILTER_ATTR_INSTITUTION, - this.resourceService::institutionResource); - this.lmsFilter = new TableFilterAttribute( CriteriaType.SINGLE_SELECTION, LmsSetup.FILTER_ATTR_LMS_SETUP, @@ -101,7 +98,6 @@ public class ExamList implements TemplateComposer { pageContext.getParent(), new LocTextKey("sebserver.exam.list.title")); - final boolean isSEBAdmin = currentUser.get().hasRole(UserRole.SEB_SERVER_ADMIN); final PageActionBuilder actionBuilder = this.pageService.pageActionBuilder(pageContext.clearEntityKeys()); // table @@ -109,13 +105,6 @@ public class ExamList implements TemplateComposer { this.pageService.entityTableBuilder(restService.getRestCall(GetExams.class)) .withEmptyMessage(new LocTextKey("sebserver.exam.list.empty")) .withPaging(this.pageSize) - .withColumnIf(() -> isSEBAdmin, - new ColumnDefinition<>( - Domain.EXAM.ATTR_INSTITUTION_ID, - new LocTextKey("sebserver.exam.list.column.institution"), - examInstitutionNameFunction(this.resourceService), - this.institutionFilter, - false)) .withColumn(new ColumnDefinition<>( Domain.EXAM.ATTR_LMS_SETUP_ID, columnTitleLmsSetupKey, @@ -158,14 +147,25 @@ public class ExamList implements TemplateComposer { .publishIf(table::hasAnyContent) .newAction(ActionDefinition.EXAM_MODIFY_FROM_LIST) - .withSelect(table::getSelection, PageAction::applySingleSelection, emptySelectionTextKey) + .withSelect( + table::getSelection, + action -> this.modifyExam(action, table), + emptySelectionTextKey) .publishIf(() -> userGrant.im() && table.hasAnyContent()); } - private static Function examInstitutionNameFunction(final ResourceService resourceService) { - return exam -> resourceService.getInstitutionNameFunction() - .apply(String.valueOf(exam.institutionId)); + private PageAction modifyExam(final PageAction action, final EntityTable table) { + final Exam exam = table.getSelectedROWData(); + + if (exam.startTime != null) { + final DateTime now = DateTime.now(DateTimeZone.UTC); + if (exam.startTime.isBefore(now)) { + throw new PageMessageException(noModifyOfOutDatedExams); + } + } + + return action.withEntityKey(action.getSingleSelection()); } private static Function examLmsSetupNameFunction(final ResourceService resourceService) { diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/InstitutionForm.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/InstitutionForm.java index 340af3b1..ef353efa 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/InstitutionForm.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/InstitutionForm.java @@ -129,11 +129,12 @@ public class InstitutionForm implements TemplateComposer { Domain.INSTITUTION.ATTR_URL_SUFFIX, "sebserver.institution.form.urlSuffix", institution.urlSuffix)) - .addField(FormBuilder.imageUpload( - Domain.INSTITUTION.ATTR_LOGO_IMAGE, - "sebserver.institution.form.logoImage", - institution.logoImage) - .withCondition(() -> !isNew && modifyGrant)) + .addFieldIf( + () -> !isNew && modifyGrant, + () -> FormBuilder.imageUpload( + Domain.INSTITUTION.ATTR_LOGO_IMAGE, + "sebserver.institution.form.logoImage", + institution.logoImage)) .buildFor((isNew) ? this.restService.getRestCall(NewInstitution.class) : this.restService.getRestCall(SaveInstitution.class)); diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/LmsSetupForm.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/LmsSetupForm.java index 48b1b09e..b4b68d0e 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/LmsSetupForm.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/LmsSetupForm.java @@ -137,13 +137,14 @@ public class LmsSetupForm implements TemplateComposer { .putStaticValueIf(isNotNew, Domain.LMS_SETUP.ATTR_LMS_TYPE, String.valueOf(lmsSetup.getLmsType())) - .addField(FormBuilder.singleSelection( - Domain.LMS_SETUP.ATTR_INSTITUTION_ID, - "sebserver.lmssetup.form.institution", - String.valueOf(lmsSetup.getInstitutionId()), - () -> this.resourceService.institutionResource()) - .withCondition(isSEBAdmin) - .readonlyIf(isNotNew)) + .addFieldIf( + isSEBAdmin, + () -> FormBuilder.singleSelection( + Domain.LMS_SETUP.ATTR_INSTITUTION_ID, + "sebserver.lmssetup.form.institution", + String.valueOf(lmsSetup.getInstitutionId()), + () -> this.resourceService.institutionResource()) + .readonlyIf(isNotNew)) .addField(FormBuilder.text( Domain.LMS_SETUP.ATTR_NAME, "sebserver.lmssetup.form.name", @@ -154,21 +155,24 @@ public class LmsSetupForm implements TemplateComposer { (lmsType != null) ? lmsType.name() : null, this.resourceService::lmsTypeResources) .readonlyIf(isNotNew)) - .addField(FormBuilder.text( - Domain.LMS_SETUP.ATTR_LMS_URL, - "sebserver.lmssetup.form.url", - lmsSetup.getLmsApiUrl()) - .withCondition(() -> isNotNew.getAsBoolean())) - .addField(FormBuilder.text( - Domain.LMS_SETUP.ATTR_LMS_CLIENTNAME, - "sebserver.lmssetup.form.clientname.lms", - lmsSetup.getLmsAuthName()) - .withCondition(() -> isNotNew.getAsBoolean())) - .addField(FormBuilder.text( - Domain.LMS_SETUP.ATTR_LMS_CLIENTSECRET, - "sebserver.lmssetup.form.secret.lms") - .asPasswordField() - .withCondition(() -> isNotNew.getAsBoolean())) + .addFieldIf( + () -> isNotNew.getAsBoolean(), + () -> FormBuilder.text( + Domain.LMS_SETUP.ATTR_LMS_URL, + "sebserver.lmssetup.form.url", + lmsSetup.getLmsApiUrl())) + .addFieldIf( + () -> isNotNew.getAsBoolean(), + () -> FormBuilder.text( + Domain.LMS_SETUP.ATTR_LMS_CLIENTNAME, + "sebserver.lmssetup.form.clientname.lms", + lmsSetup.getLmsAuthName())) + .addFieldIf( + () -> isNotNew.getAsBoolean(), + () -> FormBuilder.text( + Domain.LMS_SETUP.ATTR_LMS_CLIENTSECRET, + "sebserver.lmssetup.form.secret.lms") + .asPasswordField()) .buildFor((entityKey == null) ? restService.getRestCall(NewLmsSetup.class) diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/LmsSetupList.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/LmsSetupList.java index f64d6bcd..44329e77 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/LmsSetupList.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/LmsSetupList.java @@ -108,8 +108,9 @@ public class LmsSetupList implements TemplateComposer { this.pageService.entityTableBuilder(restService.getRestCall(GetLmsSetups.class)) .withEmptyMessage(EMPTY_LIST_TEXT_KEY) .withPaging(this.pageSize) - .withColumnIf(() -> isSEBAdmin, - new ColumnDefinition<>( + .withColumnIf( + () -> isSEBAdmin, + () -> new ColumnDefinition<>( Domain.LMS_SETUP.ATTR_INSTITUTION_ID, INSTITUTION_TEXT_KEY, lmsSetupInstitutionNameFunction(this.resourceService), diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/UserAccountChangePasswordForm.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/UserAccountChangePasswordForm.java index 1c46e2c9..2c1ba340 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/UserAccountChangePasswordForm.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/UserAccountChangePasswordForm.java @@ -95,11 +95,12 @@ public class UserAccountChangePasswordForm implements TemplateComposer { PasswordChange.ATTR_NAME_NEW_PASSWORD, "sebserver.useraccount.form.password.new") .asPasswordField()) - .addField(FormBuilder.text( - PasswordChange.ATTR_NAME_CONFIRM_NEW_PASSWORD, - "sebserver.useraccount.form.password.new.confirm") - .asPasswordField() - .withCondition(() -> entityKey != null)) + .addFieldIf( + () -> entityKey != null, + () -> FormBuilder.text( + PasswordChange.ATTR_NAME_CONFIRM_NEW_PASSWORD, + "sebserver.useraccount.form.password.new.confirm") + .asPasswordField()) .buildFor(this.restService.getRestCall(ChangePassword.class)); this.pageService.pageActionBuilder(pageContext) diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/UserAccountForm.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/UserAccountForm.java index b98fa088..9ae9be92 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/UserAccountForm.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/UserAccountForm.java @@ -138,13 +138,14 @@ public class UserAccountForm implements TemplateComposer { .putStaticValueIf(isNotNew, Domain.USER.ATTR_INSTITUTION_ID, String.valueOf(userAccount.getInstitutionId())) - .addField(FormBuilder.singleSelection( - Domain.USER.ATTR_INSTITUTION_ID, - "sebserver.useraccount.form.institution", - String.valueOf(userAccount.getInstitutionId()), - () -> this.resourceService.institutionResource()) - .withCondition(isSEBAdmin) - .readonlyIf(isNotNew)) + .addFieldIf( + isSEBAdmin, + () -> FormBuilder.singleSelection( + Domain.USER.ATTR_INSTITUTION_ID, + "sebserver.useraccount.form.institution", + String.valueOf(userAccount.getInstitutionId()), + () -> this.resourceService.institutionResource()) + .readonlyIf(isNotNew)) .addField(FormBuilder.text( Domain.USER.ATTR_NAME, "sebserver.useraccount.form.name", @@ -161,29 +162,33 @@ public class UserAccountForm implements TemplateComposer { Domain.USER.ATTR_LANGUAGE, "sebserver.useraccount.form.language", userAccount.getLanguage().getLanguage(), - this.resourceService::languageResources)) + this.resourceService::languageResources) + .readonly(true)) .addField(FormBuilder.singleSelection( Domain.USER.ATTR_TIMEZONE, "sebserver.useraccount.form.timezone", userAccount.getTimeZone().getID(), this.resourceService::timeZoneResources)) - .addField(FormBuilder.multiSelection( - USER_ROLE.REFERENCE_NAME, - "sebserver.useraccount.form.roles", - StringUtils.join(userAccount.getRoles(), Constants.LIST_SEPARATOR_CHAR), - this.resourceService::userRoleResources) - .withCondition(() -> modifyGrant) - .visibleIf(writeGrant)) - .addField(FormBuilder.text( - PasswordChange.ATTR_NAME_NEW_PASSWORD, - "sebserver.useraccount.form.password") - .asPasswordField() - .withCondition(isNew)) - .addField(FormBuilder.text( - PasswordChange.ATTR_NAME_CONFIRM_NEW_PASSWORD, - "sebserver.useraccount.form.password.confirm") - .asPasswordField() - .withCondition(isNew)) + .addFieldIf( + () -> modifyGrant, + () -> FormBuilder.multiSelection( + USER_ROLE.REFERENCE_NAME, + "sebserver.useraccount.form.roles", + StringUtils.join(userAccount.getRoles(), Constants.LIST_SEPARATOR_CHAR), + this.resourceService::userRoleResources) + .visibleIf(writeGrant)) + .addFieldIf( + isNew, + () -> FormBuilder.text( + PasswordChange.ATTR_NAME_NEW_PASSWORD, + "sebserver.useraccount.form.password") + .asPasswordField()) + .addFieldIf( + isNew, + () -> FormBuilder.text( + PasswordChange.ATTR_NAME_CONFIRM_NEW_PASSWORD, + "sebserver.useraccount.form.password.confirm") + .asPasswordField()) .buildFor((entityKey == null) ? restService.getRestCall(NewUserAccount.class) : restService.getRestCall(SaveUserAccount.class)); diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/UserAccountList.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/UserAccountList.java index 2b835e9b..2b13cda4 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/UserAccountList.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/UserAccountList.java @@ -118,8 +118,9 @@ public class UserAccountList implements TemplateComposer { .withEmptyMessage(new LocTextKey("sebserver.useraccount.list.empty")) .withPaging(this.pageSize) - .withColumnIf(isSEBAdmin, - new ColumnDefinition<>( + .withColumnIf( + isSEBAdmin, + () -> new ColumnDefinition<>( Domain.USER.ATTR_INSTITUTION_ID, INSTITUTION_TEXT_KEY, userInstitutionNameFunction(this.resourceService), diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/form/FieldBuilder.java b/src/main/java/ch/ethz/seb/sebserver/gui/form/FieldBuilder.java index 6c66e400..da0e0a4f 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/form/FieldBuilder.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/form/FieldBuilder.java @@ -16,7 +16,6 @@ public abstract class FieldBuilder { int spanEmptyCell = -1; boolean autoEmptyCellSeparation = false; String group = null; - BooleanSupplier condition = null; boolean readonly = false; boolean visible = true; @@ -55,11 +54,6 @@ public abstract class FieldBuilder { return this; } - public FieldBuilder withCondition(final BooleanSupplier condition) { - this.condition = condition; - return this; - } - public FieldBuilder readonly(final boolean readonly) { this.readonly = readonly; return this; diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/form/FormBuilder.java b/src/main/java/ch/ethz/seb/sebserver/gui/form/FormBuilder.java index 4a56c426..b5b51016 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/form/FormBuilder.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/form/FormBuilder.java @@ -145,23 +145,33 @@ public class FormBuilder { return this; } - public FormBuilder addField(final FieldBuilder template) { - if (template.condition == null || template.condition.getAsBoolean()) { - template.spanLabel = (template.spanLabel < 0) ? this.defaultSpanLabel : template.spanLabel; - template.spanInput = (template.spanInput < 0) ? this.defaultSpanInput : template.spanInput; - template.spanEmptyCell = (template.spanEmptyCell < 0) ? this.defaultSpanEmptyCell : template.spanEmptyCell; - template.autoEmptyCellSeparation = template.autoEmptyCellSeparation || this.emptyCellSeparation; + public FormBuilder addFieldIf( + final BooleanSupplier condition, + final Supplier> templateSupplier) { - if (template.autoEmptyCellSeparation && this.form.hasFields()) { - addEmptyCell(template.spanEmptyCell); - } - - template.build(this); - - if (StringUtils.isNoneBlank(template.group)) { - this.form.addToGroup(template.group, template.name); - } + if (condition.getAsBoolean()) { + return addField(templateSupplier.get()); } + + return this; + } + + public FormBuilder addField(final FieldBuilder template) { + template.spanLabel = (template.spanLabel < 0) ? this.defaultSpanLabel : template.spanLabel; + template.spanInput = (template.spanInput < 0) ? this.defaultSpanInput : template.spanInput; + template.spanEmptyCell = (template.spanEmptyCell < 0) ? this.defaultSpanEmptyCell : template.spanEmptyCell; + template.autoEmptyCellSeparation = template.autoEmptyCellSeparation || this.emptyCellSeparation; + + if (template.autoEmptyCellSeparation && this.form.hasFields()) { + addEmptyCell(template.spanEmptyCell); + } + + template.build(this); + + if (StringUtils.isNoneBlank(template.group)) { + this.form.addToGroup(template.group, template.name); + } + return this; } diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/table/TableBuilder.java b/src/main/java/ch/ethz/seb/sebserver/gui/table/TableBuilder.java index 5793b0e4..8220f0b8 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/table/TableBuilder.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/table/TableBuilder.java @@ -12,6 +12,7 @@ import java.util.ArrayList; import java.util.List; import java.util.function.BooleanSupplier; import java.util.function.Function; +import java.util.function.Supplier; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Composite; @@ -80,10 +81,10 @@ public class TableBuilder { public TableBuilder withColumnIf( final BooleanSupplier condition, - final ColumnDefinition columnDefinition) { + final Supplier> columnDefSupplier) { if (condition != null && condition.getAsBoolean()) { - this.columns.add(columnDefinition); + this.columns.add(columnDefSupplier.get()); } return this; } @@ -98,6 +99,17 @@ public class TableBuilder { return this; } + public TableBuilder withDefaultActionIf( + final BooleanSupplier condition, + final Supplier actionSupplier) { + + if (condition.getAsBoolean()) { + return withDefaultAction(actionSupplier.get()); + } + + return this; + } + public TableBuilder withDefaultAction(final PageAction action) { this.defaultActionFunction = table -> action; return this; diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ExamDAOImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ExamDAOImpl.java index 3189fc1c..dbe18e88 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ExamDAOImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ExamDAOImpl.java @@ -110,7 +110,7 @@ public class ExamDAOImpl implements ExamDAO { } if (from != null) { - if (exam.startTime.isAfter(from)) { + if (exam.startTime.isBefore(from)) { return false; } } diff --git a/src/main/resources/messages.properties b/src/main/resources/messages.properties index 8deadddc..6b90f67c 100644 --- a/src/main/resources/messages.properties +++ b/src/main/resources/messages.properties @@ -234,6 +234,7 @@ sebserver.exam.list.column.starttime=Start Time {0} sebserver.exam.list.column.type=Type sebserver.exam.list.empty=No Exams has been found. Please adapt the filter or import one from Quiz +sebserver.exam.list.modify.out.dated=Running or finished exams cannot be modified. sebserver.exam.action.list=Exam sebserver.exam.action.list.view=View Exam