Skip to content
Snippets Groups Projects
Commit 212b898b authored by srosse's avatar srosse
Browse files

Merge OpenOLAT 11.4 to OpenOLAT default branch with 827bcfcad2f42094186fbd3829ba906d05aa519c

parents 5fc77e3c 97ec8fd0
No related branches found
No related tags found
No related merge requests found
......@@ -314,9 +314,7 @@ public class AssessmentTestDisplayController extends BasicController implements
AssessmentTestSession lastSession = qtiService.getResumableAssessmentTestSession(assessedIdentity, anonymousIdentifier, entry, subIdent, testEntry, authorMode);
if(lastSession == null) {
candidateSession = qtiService.createAssessmentTestSession(assessedIdentity, anonymousIdentifier, assessmentEntry, entry, subIdent, testEntry, authorMode);
candidateAuditLogger = qtiService.getAssessmentSessionAuditLogger(candidateSession, authorMode);
testSessionController = enterSession(ureq);
initNewAssessmentTestSession(ureq, assessmentEntry, authorMode);
} else {
candidateSession = lastSession;
candidateAuditLogger = qtiService.getAssessmentSessionAuditLogger(candidateSession, authorMode);
......@@ -324,7 +322,45 @@ public class AssessmentTestDisplayController extends BasicController implements
lastEvent = new CandidateEvent(candidateSession, testEntry, entry);
lastEvent.setTestEventType(CandidateTestEventType.ITEM_EVENT);
testSessionController = resumeSession(ureq);
if(authorMode) {
//check that the resumed session match the current test
try {
testSessionController = resumeSession(ureq);
if(!checkAuthorSession()) {
initNewAssessmentTestSession(ureq, assessmentEntry, authorMode);
}
} catch(Exception e) {
logError("Cannot resume session as author", e);
initNewAssessmentTestSession(ureq, assessmentEntry, authorMode);
}
} else {
testSessionController = resumeSession(ureq);
}
}
}
private void initNewAssessmentTestSession(UserRequest ureq, AssessmentEntry assessmentEntry, boolean authorMode) {
candidateSession = qtiService.createAssessmentTestSession(assessedIdentity, anonymousIdentifier, assessmentEntry, entry, subIdent, testEntry, authorMode);
candidateAuditLogger = qtiService.getAssessmentSessionAuditLogger(candidateSession, authorMode);
testSessionController = enterSession(ureq);
}
/**
* If the session data doesn't match the current assessmentTest and assessmentItems, it will
* return false.
* @return
*/
private boolean checkAuthorSession() {
try {
//
TestSessionState testSessionState = testSessionController.getTestSessionState();
if(!isTerminated() && !testSessionState.isExited() && testSessionState.getCurrentTestPartKey() != null) {
testSessionController.mayEndCurrentTestPart();
}
return true;
} catch(Exception e) {
logError("Cannot resume session as author", e);
return false;
}
}
......
......@@ -23,6 +23,7 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;
......@@ -40,6 +41,10 @@ import org.olat.core.logging.Tracing;
import org.olat.core.util.StringHelper;
import org.olat.restapi.system.MonitoringService.Statistics;
import org.olat.restapi.system.vo.SessionsVO;
import org.olat.search.SearchServiceStatus;
import org.olat.search.service.SearchServiceFactory;
import org.olat.search.service.SearchServiceStatusImpl;
import org.olat.search.service.indexer.FullIndexerStatus;
import org.quartz.JobExecutionContext;
import org.springframework.scheduling.quartz.QuartzJobBean;
import org.w3c.dom.Document;
......@@ -47,6 +52,8 @@ import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXParseException;
import net.fortuna.ical4j.util.TimeZones;
/**
*
* Initial date: 27 févr. 2017<br>
......@@ -108,9 +115,17 @@ public class ProcSamplerJob extends QuartzJobBean {
addValue("totalGroupCount", statistics.getTotalGroupCount(), rootEl, doc);
addValue("publishedCourses", statistics.getPublishedCourses(), rootEl, doc);
//indexer
addValue("lastFullIndexTime", statistics.getLastFullIndexTime(), rootEl, doc);
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
format.setTimeZone(TimeZones.getUtcTimeZone());
SearchServiceStatus status = SearchServiceFactory.getService().getStatus();
if(status instanceof SearchServiceStatusImpl) {
SearchServiceStatusImpl statusImpl = (SearchServiceStatusImpl)status;
FullIndexerStatus fStatus = statusImpl.getFullIndexerStatus();
String date = format.format(new Date(fStatus.getLastFullIndexTime()));
addValue("lastFullIndexTime", date, rootEl, doc);
}
//marker
addValue("lastOpenOLATSampling", new Date().toString(), rootEl, doc);
addValue("lastOpenOLATSampling", format.format(new Date()), rootEl, doc);
// Use a Transformer for output
try(OutputStream out = new FileOutputStream(xmlFile)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment