use of org.olat.ims.qti21.AssessmentTestSession in project OpenOLAT by OpenOLAT.
the class AssessmentItemComponentRenderer method render.
@Override
public void render(Renderer renderer, StringOutput sb, Component source, URLBuilder ubu, Translator translator, RenderResult renderResult, String[] args) {
AssessmentItemComponent cmp = (AssessmentItemComponent) source;
sb.append("<div class='qtiworks o_assessmentitem'>");
ItemSessionController itemSessionController = cmp.getItemSessionController();
CandidateSessionContext candidateSessionContext = cmp.getCandidateSessionContext();
/* Create appropriate options that link back to this controller */
final AssessmentTestSession candidateSession = candidateSessionContext.getCandidateSession();
if (candidateSession != null && candidateSession.isExploded()) {
renderExploded(sb, translator);
} else if (candidateSessionContext.isTerminated()) {
renderTerminated(sb, translator);
} else {
/* Look up most recent event */
// assertSessionEntered(candidateSession);
final CandidateEvent latestEvent = candidateSessionContext.getLastEvent();
/* Load the ItemSessionState */
// candidateDataService.loadItemSessionState(latestEvent);
final ItemSessionState itemSessionState = cmp.getItemSessionController().getItemSessionState();
/* Touch the session's duration state if appropriate */
if (itemSessionState.isEntered() && !itemSessionState.isEnded() && !itemSessionState.isSuspended()) {
final Date timestamp = candidateSessionContext.getCurrentRequestTimestamp();
itemSessionController.touchDuration(timestamp);
}
/* Render event */
AssessmentRenderer renderHints = new AssessmentRenderer(renderer);
renderItemEvent(renderHints, sb, cmp, latestEvent, itemSessionState, ubu, translator);
}
sb.append("</div>");
}
use of org.olat.ims.qti21.AssessmentTestSession in project OpenOLAT by OpenOLAT.
the class IQIdentityListCourseNodeController method getExtraTimes.
/**
* @return A map identity key to extra time
*/
private Map<Long, ExtraTimeInfos> getExtraTimes() {
Map<Long, ExtraTimeInfos> identityToExtraTime = new HashMap<>();
List<AssessmentTestSession> sessions = qtiService.getAssessmentTestSessions(getCourseRepositoryEntry(), courseNode.getIdent(), getReferencedRepositoryEntry());
// sort by identity, then by creation date
Collections.sort(sessions, new AssessmentTestSessionComparator());
Long currentIdentityKey = null;
for (AssessmentTestSession session : sessions) {
Long identityKey = session.getIdentity().getKey();
if (currentIdentityKey == null || !currentIdentityKey.equals(identityKey)) {
if (session.getFinishTime() == null && session.getExtraTime() != null) {
Integer extraTimeInSeconds = session.getExtraTime();
Date start = session.getCreationDate();
ExtraTimeInfos infos = new ExtraTimeInfos(extraTimeInSeconds, start);
identityToExtraTime.put(identityKey, infos);
}
currentIdentityKey = identityKey;
}
}
return identityToExtraTime;
}
use of org.olat.ims.qti21.AssessmentTestSession in project OpenOLAT by OpenOLAT.
the class IQIdentityListCourseNodeController method doConfirmExtraTime.
private void doConfirmExtraTime(UserRequest ureq) {
List<IdentityRef> identities = getSelectedIdentities();
if (identities == null || identities.isEmpty()) {
showWarning("warning.users.extra.time");
return;
}
List<AssessmentTestSession> testSessions = new ArrayList<>(identities.size());
for (IdentityRef identity : identities) {
List<AssessmentTestSessionStatistics> sessionsStatistics = qtiService.getAssessmentTestSessionsStatistics(getCourseRepositoryEntry(), courseNode.getIdent(), identity);
if (!sessionsStatistics.isEmpty()) {
if (sessionsStatistics.size() > 1) {
Collections.sort(sessionsStatistics, new AssessmentTestSessionDetailsComparator());
}
AssessmentTestSession lastSession = sessionsStatistics.get(0).getTestSession();
if (lastSession != null && lastSession.getFinishTime() == null) {
testSessions.add(lastSession);
}
}
}
if (testSessions == null || testSessions.isEmpty()) {
showWarning("warning.users.extra.time");
return;
}
extraTimeCtrl = new ConfirmExtraTimeController(ureq, getWindowControl(), getCourseRepositoryEntry(), testSessions);
listenTo(extraTimeCtrl);
String title = translate("extra.time");
cmc = new CloseableModalController(getWindowControl(), null, extraTimeCtrl.getInitialComponent(), true, title, true);
listenTo(cmc);
cmc.activate();
}
use of org.olat.ims.qti21.AssessmentTestSession in project OpenOLAT by OpenOLAT.
the class QTI21IdentityListCourseNodeToolsController method doConfirmExtraTime.
private void doConfirmExtraTime(UserRequest ureq) {
List<AssessmentTestSession> testSessions = Collections.singletonList(lastSession);
extraTimeCtrl = new ConfirmExtraTimeController(ureq, getWindowControl(), courseEntry, testSessions);
listenTo(extraTimeCtrl);
String title = translate("extra.time");
cmc = new CloseableModalController(getWindowControl(), null, extraTimeCtrl.getInitialComponent(), true, title, true);
listenTo(cmc);
cmc.activate();
}
use of org.olat.ims.qti21.AssessmentTestSession in project OpenOLAT by OpenOLAT.
the class QTI21AssessmentRunController method doDownloadSignature.
private void doDownloadSignature(UserRequest ureq) {
MediaResource resource = null;
if (courseNode instanceof IQTESTCourseNode) {
IQTESTCourseNode testCourseNode = (IQTESTCourseNode) courseNode;
AssessmentEntry assessmentEntry = testCourseNode.getUserAssessmentEntry(userCourseEnv);
AssessmentTestSession session = qtiService.getAssessmentTestSession(assessmentEntry.getAssessmentId());
File signature = qtiService.getAssessmentResultSignature(session);
if (signature.exists()) {
resource = new DownloadeableMediaResource(signature);
}
}
if (resource == null) {
resource = new NotFoundMediaResource();
}
ureq.getDispatchResult().setResultingMediaResource(resource);
}
Aggregations