use of org.olat.modules.assessment.AssessmentEntry in project openolat by klemens.
the class CourseAssessmentManagerImpl method updateCurrentCompletion.
@Override
public void updateCurrentCompletion(CourseNode courseNode, Identity assessedIdentity, UserCourseEnvironment userCourseEnvironment, Double currentCompletion, AssessmentRunStatus runStatus, Role by) {
AssessmentEntry nodeAssessment = getOrCreate(assessedIdentity, courseNode);
nodeAssessment.setCurrentRunCompletion(currentCompletion);
nodeAssessment.setCurrentRunStatus(runStatus);
if (by == Role.coach) {
nodeAssessment.setLastCoachModified(new Date());
} else if (by == Role.user) {
nodeAssessment.setLastUserModified(new Date());
}
assessmentService.updateAssessmentEntry(nodeAssessment);
DBFactory.getInstance().commit();
}
use of org.olat.modules.assessment.AssessmentEntry in project openolat by klemens.
the class CourseAssessmentManagerImpl method saveNodeComment.
@Override
public void saveNodeComment(CourseNode courseNode, Identity identity, Identity assessedIdentity, String comment) {
ICourse course = CourseFactory.loadCourse(cgm.getCourseEntry());
AssessmentEntry nodeAssessment = getOrCreate(assessedIdentity, courseNode);
nodeAssessment.setComment(comment);
assessmentService.updateAssessmentEntry(nodeAssessment);
// node log
UserNodeAuditManager am = course.getCourseEnvironment().getAuditManager();
am.appendToUserNodeLog(courseNode, identity, assessedIdentity, "COMMENT set to: " + comment);
// notify about changes
AssessmentChangedEvent ace = new AssessmentChangedEvent(AssessmentChangedEvent.TYPE_USER_COMMENT_CHANGED, assessedIdentity);
CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(ace, course);
// user activity logging
ThreadLocalUserActivityLogger.log(AssessmentLoggingAction.ASSESSMENT_USERCOMMENT_UPDATED, getClass(), LoggingResourceable.wrap(assessedIdentity), LoggingResourceable.wrapNonOlatResource(StringResourceableType.qtiUserComment, "", StringHelper.stripLineBreaks(comment)));
}
use of org.olat.modules.assessment.AssessmentEntry in project openolat by klemens.
the class GTANotifications method createAssessmentItem.
private void createAssessmentItem(Task task, Identity assessedIdentity, boolean coach) {
if (task == null || task.getGraduationDate() == null)
return;
if (task.getGraduationDate().after(compareDate)) {
RepositoryEntry courseEntry = courseEnv.getCourseGroupManager().getCourseEntry();
AssessmentEntry assessment = courseNodeAssessmentDao.loadAssessmentEntry(assessedIdentity, courseEntry, gtaNode.getIdent());
boolean resultsVisible = assessment != null && (assessment.getUserVisibility() == null || assessment.getUserVisibility().booleanValue());
if (resultsVisible) {
String score = null;
String status = null;
if (gtaNode.hasScoreConfigured() && assessment.getScore() != null) {
score = AssessmentHelper.getRoundedScore(assessment.getScore());
}
if (gtaNode.hasPassedConfigured() && assessment.getPassed() != null) {
status = assessment.getPassed().booleanValue() ? translator.translate("notifications.assessment.passed.true") : translator.translate("notifications.assessment.passed.false");
}
Date graduationDate = task.getGraduationDate();
String[] params = new String[] { getTaskName(task), courseEntry.getDisplayname(), score, status };
if (score != null && status != null) {
if (assessment.getPassed().booleanValue()) {
appendSubscriptionItem("notifications.assessment.score.passed", params, assessedIdentity, graduationDate, coach);
} else {
appendSubscriptionItem("notifications.assessment.score.notpassed", params, assessedIdentity, graduationDate, coach);
}
} else if (score != null) {
appendSubscriptionItem("notifications.assessment.score", params, assessedIdentity, graduationDate, coach);
} else if (status != null) {
appendSubscriptionItem("notifications.assessment.passed", params, assessedIdentity, graduationDate, coach);
}
ICourse course = CourseFactory.loadCourse(courseEnv.getCourseGroupManager().getCourseEntry());
UserCourseEnvironment assessedUserCourseEnv = AssessmentHelper.createAndInitUserCourseEnvironment(assessedIdentity, course);
List<File> docs = gtaNode.getIndividualAssessmentDocuments(assessedUserCourseEnv);
for (File doc : docs) {
String[] docParams = new String[] { getTaskName(task), courseEntry.getDisplayname(), doc.getName() };
appendSubscriptionItemForFile("notifications.assessment.doc", docParams, assessedIdentity, "[assessment:0]", doc, graduationDate, coach);
}
}
}
}
use of org.olat.modules.assessment.AssessmentEntry in project openolat by klemens.
the class QTI21ServiceImpl method deleteAssessmentTestSession.
@Override
public boolean deleteAssessmentTestSession(List<Identity> identities, RepositoryEntryRef testEntry, RepositoryEntryRef entry, String subIdent) {
Set<AssessmentEntry> entries = new HashSet<>();
for (Identity identity : identities) {
List<AssessmentTestSession> sessions = testSessionDao.getTestSessions(testEntry, entry, subIdent, identity);
for (AssessmentTestSession session : sessions) {
if (session.getAssessmentEntry() != null) {
entries.add(session.getAssessmentEntry());
}
File fileStorage = testSessionDao.getSessionStorage(session);
testSessionDao.deleteTestSession(session);
FileUtils.deleteDirsAndFiles(fileStorage, true, true);
}
}
for (AssessmentEntry assessmentEntry : entries) {
assessmentEntryDao.resetAssessmentEntry(assessmentEntry);
}
return true;
}
use of org.olat.modules.assessment.AssessmentEntry in project openolat by klemens.
the class AssessmentItemSessionDAOTest method createAndGetItemSession.
@Test
public void createAndGetItemSession() {
// prepare a test and a user
RepositoryEntry testEntry = JunitTestHelper.createAndPersistRepositoryEntry();
Identity assessedIdentity = JunitTestHelper.createAndPersistIdentityAsRndUser("response-session-1");
AssessmentEntry assessmentEntry = assessmentService.getOrCreateAssessmentEntry(assessedIdentity, null, testEntry, "-", testEntry);
dbInstance.commit();
String itemIdentifier = UUID.randomUUID().toString();
ParentPartItemRefs parentParts = new ParentPartItemRefs();
String sectionIdentifier = UUID.randomUUID().toString();
parentParts.setSectionIdentifier(sectionIdentifier);
String testPartIdentifier = UUID.randomUUID().toString();
parentParts.setTestPartIdentifier(testPartIdentifier);
// make test, item and response
AssessmentTestSession testSession = testSessionDao.createAndPersistTestSession(testEntry, testEntry, "_", assessmentEntry, assessedIdentity, null, true);
Assert.assertNotNull(testSession);
AssessmentItemSession itemSession = itemSessionDao.createAndPersistAssessmentItemSession(testSession, parentParts, itemIdentifier);
Assert.assertNotNull(itemSession);
dbInstance.commitAndCloseSession();
AssessmentItemSession reloadedItemSession = itemSessionDao.getAssessmentItemSession(testSession, itemIdentifier);
Assert.assertNotNull(reloadedItemSession);
Assert.assertNotNull(reloadedItemSession.getCreationDate());
Assert.assertNotNull(reloadedItemSession.getLastModified());
Assert.assertEquals(itemIdentifier, reloadedItemSession.getAssessmentItemIdentifier());
Assert.assertEquals(sectionIdentifier, reloadedItemSession.getSectionIdentifier());
Assert.assertEquals(testPartIdentifier, reloadedItemSession.getTestPartIdentifier());
}
Aggregations