fixed some tests and filtering
This commit is contained in:
parent
0790b5827f
commit
d3a794c5b1
8 changed files with 32 additions and 17 deletions
7
pom.xml
7
pom.xml
|
@ -5,7 +5,7 @@
|
|||
|
||||
<groupId>ch.ethz.seb</groupId>
|
||||
<artifactId>seb-server</artifactId>
|
||||
<version>${sebserver-version}</version>
|
||||
<version>${revision}</version>
|
||||
<name>seb-server</name>
|
||||
<description>web-service for SEB maintenance and monitoring active SEB sessions</description>
|
||||
|
||||
|
@ -20,8 +20,10 @@
|
|||
<properties>
|
||||
<sebserver-version>1.1.0-SNAPSHOT</sebserver-version>
|
||||
<build-version>${sebserver-version}</build-version>
|
||||
<revision>${sebserver-version}</revision>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<file.encoding>UTF-8</file.encoding>
|
||||
</properties>
|
||||
|
||||
<!-- NOTE: There currently are two profiles, a default one to build on
|
||||
|
@ -77,6 +79,9 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
|
|
|
@ -192,14 +192,14 @@ public class ExamFormConfigs implements TemplateComposer {
|
|||
})
|
||||
.publishIf(() -> modifyGrant && configurationTable.hasAnyContent() && editable, false)
|
||||
|
||||
.newAction(ActionDefinition.EXAM_CONFIGURATION_EXPORT)
|
||||
.withParentEntityKey(entityKey)
|
||||
.withSelect(
|
||||
getConfigSelection(configurationTable),
|
||||
this::downloadExamConfigAction,
|
||||
CONFIG_EMPTY_SELECTION_TEXT_KEY)
|
||||
.noEventPropagation()
|
||||
.publishIf(() -> readGrant && configurationTable.hasAnyContent(), false)
|
||||
// .newAction(ActionDefinition.EXAM_CONFIGURATION_EXPORT)
|
||||
// .withParentEntityKey(entityKey)
|
||||
// .withSelect(
|
||||
// getConfigSelection(configurationTable),
|
||||
// this::downloadExamConfigAction,
|
||||
// CONFIG_EMPTY_SELECTION_TEXT_KEY)
|
||||
// .noEventPropagation()
|
||||
// .publishIf(() -> readGrant && configurationTable.hasAnyContent(), false)
|
||||
|
||||
.newAction(ActionDefinition.EXAM_CONFIGURATION_GET_CONFIG_KEY)
|
||||
.withSelect(
|
||||
|
|
|
@ -105,12 +105,14 @@ public interface LmsAPIService {
|
|||
}
|
||||
final String name = filterMap.getQuizName();
|
||||
final DateTime from = filterMap.getQuizFromTime();
|
||||
final DateTime now = DateTime.now(DateTimeZone.UTC);
|
||||
return q -> {
|
||||
final boolean nameFilter = StringUtils.isBlank(name) || (q.name != null && q.name.contains(name));
|
||||
final boolean startTimeFilter =
|
||||
(from == null) || (q.startTime != null && (q.startTime.isEqual(from) || q.startTime.isAfter(from)));
|
||||
final boolean currentlyRunning = q.endTime == null || DateTime.now(DateTimeZone.UTC).isBefore(q.endTime);
|
||||
return nameFilter && (startTimeFilter || currentlyRunning);
|
||||
from == null || (q.startTime != null && (q.startTime.isEqual(from) || q.startTime.isAfter(from)));
|
||||
final DateTime endTime = now.isAfter(from) ? now : from;
|
||||
final boolean fromTimeFilter = (endTime == null || q.endTime == null || endTime.isBefore(q.endTime));
|
||||
return nameFilter && (startTimeFilter || fromTimeFilter);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -246,6 +246,8 @@ public class MoodleCourseAccess extends CourseAccess {
|
|||
? Utils.toUnixTimeInSeconds(filterMap.getQuizFromTime())
|
||||
: Utils.toUnixTimeInSeconds(DateTime.now(DateTimeZone.UTC).minusYears(DEFAULT_FROM_YEARS));
|
||||
|
||||
System.out.println("******************** fromTime=" + fromTime);
|
||||
|
||||
// first get courses from Moodle for page
|
||||
final Map<String, CourseData> courseData = new HashMap<>();
|
||||
final Collection<CourseData> coursesPage = getCoursesPage(restTemplate, fromTime, page, 100);
|
||||
|
@ -694,8 +696,8 @@ public class MoodleCourseAccess extends CourseAccess {
|
|||
final String course_module;
|
||||
final String name;
|
||||
final String intro; // HTML
|
||||
final Long time_open;
|
||||
final Long time_close;
|
||||
final Long time_open; // unix-time seconds UTC
|
||||
final Long time_close; // unix-time seconds UTC
|
||||
final Long time_limit; // unix-time seconds UTC
|
||||
|
||||
@JsonCreator
|
||||
|
|
|
@ -238,7 +238,6 @@ public class WebServiceSecurityConfig extends WebSecurityConfigurerAdapter {
|
|||
tokenStore,
|
||||
webServiceClientDetails,
|
||||
authenticationManager,
|
||||
// TODO create a proper error handling here with also documentation on SEB Binding Specification
|
||||
(request, response, exception) -> {
|
||||
response.setContentType(MediaType.APPLICATION_JSON_UTF8_VALUE);
|
||||
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
|
||||
|
|
|
@ -19,7 +19,7 @@ server.tomcat.uri-encoding=UTF-8
|
|||
|
||||
### encoding
|
||||
file.encoding=UTF-8
|
||||
spring.mandatory-file-encoding=UTF-8
|
||||
spring.mandatoryFileEncoding=UTF-8
|
||||
spring.http.encoding.charset=UTF-8
|
||||
spring.http.encoding.enabled=true
|
||||
|
||||
|
|
|
@ -442,7 +442,7 @@ sebserver.exam.action.delete=Delete Exam
|
|||
sebserver.exam.action.sebrestriction.enable=Apply SEB Lock
|
||||
sebserver.exam.action.sebrestriction.disable=Release SEB Lock
|
||||
sebserver.exam.action.sebrestriction.details=SEB Restriction Details
|
||||
sebserver.exam.action.createClientToStartExam=Export Start Exam Config
|
||||
sebserver.exam.action.createClientToStartExam=Export SEB Start Config
|
||||
|
||||
sebserver.exam.info.pleaseSelect=At first please select an Exam from the list
|
||||
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
### encoding
|
||||
server.tomcat.uri-encoding=UTF-8
|
||||
file.encoding=UTF-8
|
||||
spring.mandatoryFileEncoding=UTF-8
|
||||
spring.http.encoding.charset=UTF-8
|
||||
spring.http.encoding.enabled=true
|
||||
|
||||
server.address=localhost
|
||||
server.port=8080
|
||||
server.servlet.context-path=/
|
||||
|
|
Loading…
Reference in a new issue