use of org.olat.modules.assessment.AssessmentEntry in project OpenOLAT by OpenOLAT.
the class ScoreAccounting method evaluateAll.
public boolean evaluateAll(boolean update) {
Identity identity = userCourseEnvironment.getIdentityEnvironment().getIdentity();
List<AssessmentEntry> entries = userCourseEnvironment.getCourseEnvironment().getAssessmentManager().getAssessmentEntries(identity);
AssessableTreeVisitor visitor = new AssessableTreeVisitor(entries, update);
// collect all assessable nodes and eval 'em
CourseNode root = userCourseEnvironment.getCourseEnvironment().getRunStructure().getRootNode();
// breadth first traversal gives an easier order of evaluation for debugging
// however, for live it is absolutely mandatory to use depth first since using breadth first
// the score accoutings local cache hash map will never be used. this can slow down things like
// crazy (course with 10 tests, 300 users and some crazy score and passed calculations will have
// 10 time performance differences)
cachedScoreEvals.clear();
for (AssessmentEntry entry : entries) {
String nodeIdent = entry.getSubIdent();
CourseNode courseNode = userCourseEnvironment.getCourseEnvironment().getRunStructure().getNode(nodeIdent);
if (courseNode instanceof AssessableCourseNode) {
AssessableCourseNode acn = (AssessableCourseNode) courseNode;
AssessmentEvaluation se = AssessmentEvaluation.toAssessmentEvalutation(entry, acn);
cachedScoreEvals.put(acn, se);
}
}
// true=depth first
TreeVisitor tv = new TreeVisitor(visitor, root, true);
tv.visitAll();
return visitor.hasChanges();
}
use of org.olat.modules.assessment.AssessmentEntry in project OpenOLAT by OpenOLAT.
the class QTI21ResultsExportMediaResource method createAssessedMembersDetail.
private List<AssessedMember> createAssessedMembersDetail(ZipOutputStream zout) throws IOException {
AssessmentManager assessmentManager = courseEnv.getAssessmentManager();
List<AssessmentEntry> assessmentEntries = assessmentManager.getAssessmentEntries(courseNode);
Map<Identity, AssessmentEntry> assessmentEntryMap = new HashMap<>();
for (AssessmentEntry assessmentEntry : assessmentEntries) {
assessmentEntryMap.put(assessmentEntry.getIdentity(), assessmentEntry);
}
List<AssessedMember> assessedMembers = new ArrayList<>();
for (Identity identity : identities) {
String idDir = exportFolderName + "/" + DATA + identity.getName();
idDir = idDir.endsWith(SEP) ? idDir : idDir + SEP;
createZipDirectory(zout, idDir);
// content of single assessed member
List<ResultDetail> assessments = createResultDetail(identity, zout, idDir);
List<File> assessmentDocuments = assessmentManager.getIndividualAssessmentDocuments(courseNode, identity);
Boolean passed = null;
BigDecimal score = null;
if (assessmentEntryMap.containsKey(identity)) {
AssessmentEntry assessmentEntry = assessmentEntryMap.get(identity);
passed = assessmentEntry.getPassed();
score = assessmentEntry.getScore();
}
String linkToUser = idDir.replace(exportFolderName + "/", "") + "index.html";
String memberEmail = userManager.getUserDisplayEmail(identity, ureq.getLocale());
AssessedMember member = new AssessedMember(identity.getName(), identity.getUser().getLastName(), identity.getUser().getFirstName(), memberEmail, assessments.size(), passed, score, linkToUser);
String userDataDir = exportFolderName + "/" + DATA + identity.getName();
String singleUserInfoHTML = createResultListingHTML(assessments, assessmentDocuments, member);
convertToZipEntry(zout, userDataDir + "/index.html", singleUserInfoHTML);
assessedMembers.add(member);
// assessment documents
for (File document : assessmentDocuments) {
String assessmentDocDir = userDataDir + "/Assessment_documents/" + document.getName();
ZipUtil.addFileToZip(assessmentDocDir, document, zout);
}
}
return assessedMembers;
}
use of org.olat.modules.assessment.AssessmentEntry in project OpenOLAT by OpenOLAT.
the class AssessmentTestDisplayController method initOrResumeAssessmentTestSession.
private void initOrResumeAssessmentTestSession(UserRequest ureq, boolean authorMode) {
AssessmentEntry assessmentEntry = assessmentService.getOrCreateAssessmentEntry(assessedIdentity, anonymousIdentifier, entry, subIdent, testEntry);
if (outcomesListener == null) {
boolean manualCorrections = AssessmentTestHelper.needManualCorrection(resolvedAssessmentTest);
outcomesListener = new AssessmentEntryOutcomesListener(entry, testEntry, assessmentEntry, manualCorrections, assessmentService, authorMode);
}
AssessmentTestSession lastSession = qtiService.getResumableAssessmentTestSession(assessedIdentity, anonymousIdentifier, entry, subIdent, testEntry, authorMode);
if (lastSession == null) {
initNewAssessmentTestSession(ureq, assessmentEntry, authorMode);
} else {
candidateSession = lastSession;
extraTime = lastSession.getExtraTime();
candidateAuditLogger = qtiService.getAssessmentSessionAuditLogger(candidateSession, authorMode);
lastEvent = new CandidateEvent(candidateSession, testEntry, entry);
lastEvent.setTestEventType(CandidateTestEventType.ITEM_EVENT);
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);
}
}
}
use of org.olat.modules.assessment.AssessmentEntry in project OpenOLAT by OpenOLAT.
the class AssessmentToReviewSmallController method loadModel.
private void loadModel() {
SearchAssessedIdentityParams params = new SearchAssessedIdentityParams(courseEntry, null, null, assessmentCallback);
List<AssessmentEntry> entries = assessmentToolManager.getAssessmentEntries(getIdentity(), params, AssessmentEntryStatus.inReview);
List<UserToReviewRow> rows = new ArrayList<>();
Map<Long, UserToReviewRow> identityKeyToRow = new HashMap<>();
for (AssessmentEntry entry : entries) {
Identity assessedIdentity = entry.getIdentity();
if (identityKeyToRow.containsKey(assessedIdentity.getKey())) {
identityKeyToRow.get(assessedIdentity.getKey()).getSubIndents().add(entry.getSubIdent());
} else {
UserToReviewRow row = new UserToReviewRow(entry.getIdentity(), userPropertyHandlers, getLocale());
row.getSubIndents().add(entry.getSubIdent());
rows.add(row);
identityKeyToRow.put(assessedIdentity.getKey(), row);
}
}
usersTableModel.setObjects(rows);
tableEl.reset();
}
use of org.olat.modules.assessment.AssessmentEntry in project OpenOLAT by OpenOLAT.
the class CheckListExcelExport method writeDataRow.
private void writeDataRow(AssessmentData data, AssessmentEntry entry, int num, OpenXMLWorksheet exportSheet) {
int col = 0;
Identity assessedIdentity = data.getIdentity();
User assessedUser = assessedIdentity.getUser();
Row dataRow = exportSheet.newRow();
// sequence number
dataRow.addCell(col++, num, null);
for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
if (userPropertyHandler != null) {
String property = userPropertyHandler.getUserProperty(assessedUser, translator.getLocale());
dataRow.addCell(col++, property, null);
}
}
// homepage
ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(assessedIdentity);
String homepage = BusinessControlFactory.getInstance().getAsURIString(Collections.singletonList(ce), false);
dataRow.addCell(col++, homepage, null);
// course node points and passed
if (courseNode.hasScoreConfigured()) {
if (entry != null && entry.getScore() != null) {
dataRow.addCell(col++, entry.getScore(), null);
} else {
col++;
}
}
if (courseNode.hasPassedConfigured()) {
if (entry != null && entry.getPassed() != null) {
dataRow.addCell(col++, entry.getPassed().toString(), null);
} else {
col++;
}
}
ModuleConfiguration config = courseNode.getModuleConfiguration();
CheckboxList list = (CheckboxList) config.get(CheckListCourseNode.CONFIG_KEY_CHECKBOX);
if (list != null && list.getList() != null && data.getChecks() != null) {
Map<String, DBCheck> checkMap = data.getChecks().stream().collect(Collectors.toMap(c -> c.getCheckbox().getCheckboxId(), c -> c));
List<Checkbox> checkboxList = list.getList();
for (Checkbox checkbox : checkboxList) {
String boxId = checkbox.getCheckboxId();
DBCheck check = checkMap.get(boxId);
if (check != null && check.getChecked() != null && check.getChecked().booleanValue()) {
dataRow.addCell(col++, "x", null);
} else {
col++;
}
if (courseNode.hasScoreConfigured() && checkbox.getPoints() != null) {
if (check != null && check.getScore() != null) {
dataRow.addCell(col++, check.getScore(), null);
} else {
col++;
}
}
}
}
}
Aggregations