use of org.olat.modules.assessment.AssessmentEntry in project OpenOLAT by OpenOLAT.
the class QTI21AssessmentDetailsController method doUpdateEntry.
private void doUpdateEntry(AssessmentTestSession session) {
AssessmentEntry assessmentEntry = assessmentService.loadAssessmentEntry(assessedIdentity, entry, null, entry);
assessmentEntry.setScore(session.getFinalScore());
assessmentEntry.setAssessmentId(session.getKey());
assessmentService.updateAssessmentEntry(assessmentEntry);
}
use of org.olat.modules.assessment.AssessmentEntry in project openolat by klemens.
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 klemens.
the class BinderPickerController method updateAssessmentInfos.
private void updateAssessmentInfos(Date returnDate) {
if (returnDate != null) {
String rDate = formatter.formatDateAndTime(returnDate);
uifactory.addStaticTextElement("map.returnDate", rDate, infosContainer);
AssessmentEntry assessmentEntry = assessmentService.loadAssessmentEntry(getIdentity(), templateEntry, null, templateEntry);
assessmentInfosContainer.contextPut("hasScoreField", Boolean.FALSE);
/* score
if(courseNode.hasScoreConfigured()) {
Float score = scoreEval.getScore();
Float minScore = courseNode.getMinScoreConfiguration();
Float maxScore = courseNode.getMaxScoreConfiguration();
assessmentInfosContainer.contextPut("scoreMin", AssessmentHelper.getRoundedScore(minScore));
assessmentInfosContainer.contextPut("scoreMax", AssessmentHelper.getRoundedScore(maxScore));
assessmentInfosContainer.contextPut("score", AssessmentHelper.getRoundedScore(score));
}
*/
// passed
assessmentInfosContainer.contextPut("hasPassedField", Boolean.TRUE);
// if(courseNode.hasPassedConfigured()) {
Boolean passed = assessmentEntry.getPassed();
assessmentInfosContainer.contextPut("passed", passed);
assessmentInfosContainer.contextPut("hasPassedValue", new Boolean(passed != null));
// Float cutValue = courseNode.getCutValueConfiguration();
// assessmentInfosContainer.contextPut("passedCutValue", AssessmentHelper.getRoundedScore(cutValue));
// }
// get comment
String comment = assessmentEntry.getComment();
assessmentInfosContainer.contextPut("hasCommentField", new Boolean(comment != null));
if (comment != null) {
assessmentInfosContainer.contextPut("comment", comment);
}
assessmentInfosContainer.setVisible(true);
} else {
assessmentInfosContainer.setVisible(false);
}
}
use of org.olat.modules.assessment.AssessmentEntry in project openolat by klemens.
the class PortfolioServiceImpl method setAssessmentStatus.
@Override
public void setAssessmentStatus(Identity assessedIdentity, BinderRef binderRef, AssessmentEntryStatus status, Identity coachingIdentity) {
Boolean fullyAssessed = Boolean.FALSE;
if (status == AssessmentEntryStatus.done) {
fullyAssessed = Boolean.TRUE;
}
Binder binder = binderDao.loadByKey(binderRef.getKey());
RepositoryEntry entry = binder.getEntry();
if ("CourseModule".equals(entry.getOlatResource().getResourceableTypeName())) {
ICourse course = CourseFactory.loadCourse(entry);
CourseNode courseNode = course.getRunStructure().getNode(binder.getSubIdent());
if (courseNode instanceof PortfolioCourseNode) {
PortfolioCourseNode pfNode = (PortfolioCourseNode) courseNode;
UserCourseEnvironment userCourseEnv = AssessmentHelper.createAndInitUserCourseEnvironment(assessedIdentity, course);
AssessmentEvaluation eval = pfNode.getUserScoreEvaluation(userCourseEnv);
ScoreEvaluation scoreEval = new ScoreEvaluation(eval.getScore(), eval.getPassed(), status, true, fullyAssessed, null, null, binder.getKey());
pfNode.updateUserScoreEvaluation(scoreEval, userCourseEnv, coachingIdentity, false, Role.coach);
}
} else {
OLATResource resource = ((BinderImpl) binder.getTemplate()).getOlatResource();
RepositoryEntry referenceEntry = repositoryService.loadByResourceKey(resource.getKey());
AssessmentEntry assessmentEntry = assessmentService.getOrCreateAssessmentEntry(assessedIdentity, null, binder.getEntry(), binder.getSubIdent(), referenceEntry);
assessmentEntry.setFullyAssessed(fullyAssessed);
assessmentEntry.setAssessmentStatus(status);
assessmentService.updateAssessmentEntry(assessmentEntry);
}
}
use of org.olat.modules.assessment.AssessmentEntry in project openolat by klemens.
the class AssessmentEntryDAOTest method deleteEntryForRepositoryEntry.
@Test
public void deleteEntryForRepositoryEntry() {
Identity assessedIdentity1 = JunitTestHelper.createAndPersistIdentityAsRndUser("as-node-20");
Identity assessedIdentity2 = JunitTestHelper.createAndPersistIdentityAsRndUser("as-node-21");
RepositoryEntry entry = JunitTestHelper.createAndPersistRepositoryEntry();
RepositoryEntry refEntry = JunitTestHelper.createAndPersistRepositoryEntry();
String subIdent = UUID.randomUUID().toString();
AssessmentEntry nodeAssessment1 = assessmentEntryDao.createAssessmentEntry(assessedIdentity1, null, entry, subIdent, refEntry);
AssessmentEntry nodeAssessment2 = assessmentEntryDao.createAssessmentEntry(assessedIdentity2, null, entry, subIdent, refEntry, 3.0f, Boolean.FALSE, null, null);
AssessmentEntry nodeAssessment3 = assessmentEntryDao.createAssessmentEntry(assessedIdentity2, null, entry, null, entry, 3.0f, Boolean.FALSE, null, null);
AssessmentEntry nodeAssessment4 = assessmentEntryDao.createAssessmentEntry(assessedIdentity1, null, refEntry, subIdent, refEntry, 3.0f, Boolean.FALSE, null, null);
dbInstance.commitAndCloseSession();
// delete by reference
assessmentEntryDao.deleteEntryForRepositoryEntry(entry);
dbInstance.commitAndCloseSession();
// check
AssessmentEntry deletedAssessmentEntry1 = assessmentEntryDao.loadAssessmentEntryById(nodeAssessment1.getKey());
Assert.assertNull(deletedAssessmentEntry1);
AssessmentEntry deletedAssessmentEntry2 = assessmentEntryDao.loadAssessmentEntryById(nodeAssessment2.getKey());
Assert.assertNull(deletedAssessmentEntry2);
AssessmentEntry deletedAssessmentEntry3 = assessmentEntryDao.loadAssessmentEntryById(nodeAssessment3.getKey());
Assert.assertNull(deletedAssessmentEntry3);
AssessmentEntry deletedAssessmentEntry4 = assessmentEntryDao.loadAssessmentEntryById(nodeAssessment4.getKey());
Assert.assertNotNull(deletedAssessmentEntry4);
}
Aggregations